From 20b2b27b7a40d2f865f31e0d627543a8edb902a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20=C4=86wirko?= Date: Sun, 13 Oct 2024 15:16:51 +0200 Subject: [PATCH] update and adjust the code --- CHANGELOG.md | 5 + README.md | 4 + build/elven.js | 67 +- build/types/elven.d.ts | 3 +- build/types/main.d.ts | 2 +- build/types/network-provider.d.ts | 10 +- build/types/types.d.ts | 2 +- esbuild.config.cjs | 2 +- example/elven.js | 67 +- example/index.html | 5 + package-lock.json | 1060 +++++++++++++---------------- package.json | 39 +- src/auth/login-with-extension.ts | 3 +- src/elven.ts | 3 +- src/main.ts | 22 +- src/network-provider.ts | 12 +- src/types.ts | 2 +- 17 files changed, 613 insertions(+), 695 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 272832f..1927ccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### [0.20.0](https://github.com/elven-js/elven.js/releases/tag/v0.20.0) (2024-10-13) +- remove `@multiversx/sdk-network-providers` package (now included in the sdk core) +- remove/replace `SignableMessage` and adjust the code +- update dependencies + ### [0.19.0](https://github.com/elven-js/elven.js/releases/tag/v0.19.0) (2024-08-03) - replace custom webview provider implementation with the dedicated library (xPortal) - update dependencies diff --git a/README.md b/README.md index e12716b..ddf4bf3 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,10 @@ Why? Because it is supposed to be a browser script, it should be as small as pos 4. test on example -> `npm run dev:server` 5. rebuild with every change in the script +To test the MultiversX browser extension you would need to run localhost with SSL. +For quick dev testing tools like [localhost.run](https://localhost.run/) should be enough. +After you run `npm run dev:server`, in separate teriminal window run `ssh -R 80:localhost:3000 localhost.run`. You can also relay on your own SSL setup. + ### Articles - [How to Interact With the MultiversX Blockchain in a Simple Static Website](https://hackernoon.com/how-to-interact-with-the-elrond-blockchain-in-a-simple-static-website) diff --git a/build/elven.js b/build/elven.js index b053efc..86fe667 100644 --- a/build/elven.js +++ b/build/elven.js @@ -1,26 +1,31 @@ -var Nk=Object.create;var Dd=Object.defineProperty;var xk=Object.getOwnPropertyDescriptor;var Ok=Object.getOwnPropertyNames;var Dk=Object.getPrototypeOf,Pk=Object.prototype.hasOwnProperty;var Pd=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var de=(t,e)=>()=>(t&&(e=t(t=0)),e);var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ot=(t,e)=>{for(var r in e)Dd(t,r,{get:e[r],enumerable:!0})},Od=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ok(e))!Pk.call(t,i)&&i!==r&&Dd(t,i,{get:()=>e[i],enumerable:!(n=xk(e,i))||n.enumerable});return t},Tr=(t,e,r)=>(Od(t,e,"default"),r&&Od(r,e,"default")),ge=(t,e,r)=>(r=t!=null?Nk(Dk(t)):{},Od(e||!t||!t.__esModule?Dd(r,"default",{value:t,enumerable:!0}):r,t)),xe=t=>Od(Dd({},"__esModule",{value:!0}),t);var E3=D(Rd=>{"use strict";h();Rd.byteLength=Bk;Rd.toByteArray=Lk;Rd.fromByteArray=qk;var Li=[],Tn=[],Rk=typeof Uint8Array<"u"?Uint8Array:Array,bw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(va=0,v3=bw.length;va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Bk(t){var e=A3(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Mk(t,e,r){return(e+r)*3/4-r}function Lk(t){var e,r=A3(t),n=r[0],i=r[1],s=new Rk(Mk(t,n,i)),o=0,u=i>0?n-4:n,a;for(a=0;a>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Tn[t.charCodeAt(a)]<<2|Tn[t.charCodeAt(a+1)]>>4,s[o++]=e&255),i===1&&(e=Tn[t.charCodeAt(a)]<<10|Tn[t.charCodeAt(a+1)]<<4|Tn[t.charCodeAt(a+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Fk(t){return Li[t>>18&63]+Li[t>>12&63]+Li[t>>6&63]+Li[t&63]}function Uk(t,e,r){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=t[r-1],i.push(Li[e>>2]+Li[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Li[e>>10]+Li[e>>4&63]+Li[e<<2&63]+"=")),i.join("")}});var b3=D(Sw=>{h();Sw.read=function(t,e,r,n,i){var s,o,u=i*8-n-1,a=(1<>1,f=-7,d=r?i-1:0,w=r?-1:1,A=t[e+d];for(d+=w,s=A&(1<<-f)-1,A>>=-f,f+=u;f>0;s=s*256+t[e+d],d+=w,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=w,f-=8);if(s===0)s=1-c;else{if(s===a)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(A?-1:1)*o*Math.pow(2,s-n)};Sw.write=function(t,e,r,n,i,s){var o,u,a,c=s*8-i-1,f=(1<>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,_=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+d>=1?e+=w/a:e+=w*Math.pow(2,1-d),e*a>=2&&(o++,a/=2),o+d>=f?(u=0,o=f):o+d>=1?(u=(e*a-1)*Math.pow(2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+A]=u&255,A+=_,u/=256,i-=8);for(o=o<0;t[r+A]=o&255,A+=_,o/=256,c-=8);t[r+A-_]|=N*128}});var no=D(Tu=>{"use strict";h();var Iw=E3(),_u=b3(),S3=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Tu.Buffer=X;Tu.SlowBuffer=zk;Tu.INSPECT_MAX_BYTES=50;var Bd=2147483647;Tu.kMaxLength=Bd;X.TYPED_ARRAY_SUPPORT=Vk();!X.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 Vk(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(X.prototype,"parent",{enumerable:!0,get:function(){if(X.isBuffer(this))return this.buffer}});Object.defineProperty(X.prototype,"offset",{enumerable:!0,get:function(){if(X.isBuffer(this))return this.byteOffset}});function Ts(t){if(t>Bd)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,X.prototype),e}function X(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Nw(t)}return T3(t,e,r)}X.poolSize=8192;function T3(t,e,r){if(typeof t=="string")return Hk(t,e);if(ArrayBuffer.isView(t))return Gk(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Fi(t,ArrayBuffer)||t&&Fi(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Fi(t,SharedArrayBuffer)||t&&Fi(t.buffer,SharedArrayBuffer)))return Tw(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return X.from(n,e,r);var i=jk(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return X.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}X.from=function(t,e,r){return T3(t,e,r)};Object.setPrototypeOf(X.prototype,Uint8Array.prototype);Object.setPrototypeOf(X,Uint8Array);function C3(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function kk(t,e,r){return C3(t),t<=0?Ts(t):e!==void 0?typeof r=="string"?Ts(t).fill(e,r):Ts(t).fill(e):Ts(t)}X.alloc=function(t,e,r){return kk(t,e,r)};function Nw(t){return C3(t),Ts(t<0?0:xw(t)|0)}X.allocUnsafe=function(t){return Nw(t)};X.allocUnsafeSlow=function(t){return Nw(t)};function Hk(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!X.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=N3(t,e)|0,n=Ts(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function _w(t){for(var e=t.length<0?0:xw(t.length)|0,r=Ts(e),n=0;n=Bd)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Bd.toString(16)+" bytes");return t|0}function zk(t){return+t!=t&&(t=0),X.alloc(+t)}X.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==X.prototype};X.compare=function(e,r){if(Fi(e,Uint8Array)&&(e=X.from(e,e.offset,e.byteLength)),Fi(r,Uint8Array)&&(r=X.from(r,r.offset,r.byteLength)),!X.isBuffer(e)||!X.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?X.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(X.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function N3(t,e){if(X.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Fi(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Cw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return B3(t).length;default:if(i)return n?-1:Cw(t).length;e=(""+e).toLowerCase(),i=!0}}X.byteLength=N3;function Qk(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return rH(this,e,r);case"utf8":case"utf-8":return O3(this,e,r);case"ascii":return eH(this,e,r);case"latin1":case"binary":return tH(this,e,r);case"base64":return Xk(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}X.prototype._isBuffer=!0;function Aa(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}X.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};S3&&(X.prototype[S3]=X.prototype.inspect);X.prototype.compare=function(e,r,n,i,s){if(Fi(e,Uint8Array)&&(e=X.from(e,e.offset,e.byteLength)),!X.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,u=n-r,a=Math.min(o,u),c=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ow(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=X.from(e,n)),X.isBuffer(e))return e.length===0?-1:I3(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):I3(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function I3(t,e,r,n,i){var s=1,o=t.length,u=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,u/=2,r/=2}function a(A,_){return s===1?A[_]:A.readUInt16BE(_*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-u),c=r;c>=0;c--){for(var d=!0,w=0;wi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Kk(this,e,r,n);case"utf8":case"utf-8":return Wk(this,e,r,n);case"ascii":case"latin1":case"binary":return $k(this,e,r,n);case"base64":return Yk(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jk(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};X.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Xk(t,e,r){return e===0&&r===t.length?Iw.fromByteArray(t):Iw.fromByteArray(t.slice(e,r))}function O3(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+u<=r){var a,c,f,d;switch(u){case 1:s<128&&(o=s);break;case 2:a=t[i+1],(a&192)===128&&(d=(s&31)<<6|a&63,d>127&&(o=d));break;case 3:a=t[i+1],c=t[i+2],(a&192)===128&&(c&192)===128&&(d=(s&15)<<12|(a&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:a=t[i+1],c=t[i+2],f=t[i+3],(a&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(a&63)<<12|(c&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=u}return Zk(n)}var _3=4096;function Zk(t){var e=t.length;if(e<=_3)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}X.prototype.readUintLE=X.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};X.prototype.readUint8=X.prototype.readUInt8=function(e,r){return e=e>>>0,r||pr(e,1,this.length),this[e]};X.prototype.readUint16LE=X.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||pr(e,2,this.length),this[e]|this[e+1]<<8};X.prototype.readUint16BE=X.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||pr(e,2,this.length),this[e]<<8|this[e+1]};X.prototype.readUint32LE=X.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};X.prototype.readUint32BE=X.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};X.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};X.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};X.prototype.readInt8=function(e,r){return e=e>>>0,r||pr(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};X.prototype.readInt16LE=function(e,r){e=e>>>0,r||pr(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};X.prototype.readInt16BE=function(e,r){e=e>>>0,r||pr(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};X.prototype.readInt32LE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};X.prototype.readInt32BE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};X.prototype.readFloatLE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),_u.read(this,e,!0,23,4)};X.prototype.readFloatBE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),_u.read(this,e,!1,23,4)};X.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||pr(e,8,this.length),_u.read(this,e,!0,52,8)};X.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||pr(e,8,this.length),_u.read(this,e,!1,52,8)};function Kr(t,e,r,n,i,s){if(!X.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}X.prototype.writeUintLE=X.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Kr(this,e,r,n,s,0)}var o=1,u=0;for(this[r]=e&255;++u>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Kr(this,e,r,n,s,0)}var o=n-1,u=1;for(this[r+o]=e&255;--o>=0&&(u*=256);)this[r+o]=e/u&255;return r+n};X.prototype.writeUint8=X.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,1,255,0),this[r]=e&255,r+1};X.prototype.writeUint16LE=X.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};X.prototype.writeUint16BE=X.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};X.prototype.writeUint32LE=X.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};X.prototype.writeUint32BE=X.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};X.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Kr(this,e,r,n,s-1,-s)}var o=0,u=1,a=0;for(this[r]=e&255;++o>0)-a&255;return r+n};X.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Kr(this,e,r,n,s-1,-s)}var o=n-1,u=1,a=0;for(this[r+o]=e&255;--o>=0&&(u*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/u>>0)-a&255;return r+n};X.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};X.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};X.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};X.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};X.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function D3(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P3(t,e,r,n,i){return e=+e,r=r>>>0,i||D3(t,e,r,4,34028234663852886e22,-34028234663852886e22),_u.write(t,e,r,n,23,4),r+4}X.prototype.writeFloatLE=function(e,r,n){return P3(this,e,r,!0,n)};X.prototype.writeFloatBE=function(e,r,n){return P3(this,e,r,!1,n)};function R3(t,e,r,n,i){return e=+e,r=r>>>0,i||D3(t,e,r,8,17976931348623157e292,-17976931348623157e292),_u.write(t,e,r,n,52,8),r+8}X.prototype.writeDoubleLE=function(e,r,n){return R3(this,e,r,!0,n)};X.prototype.writeDoubleBE=function(e,r,n){return R3(this,e,r,!1,n)};X.prototype.copy=function(e,r,n,i){if(!X.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function oH(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function B3(t){return Iw.toByteArray(sH(t))}function Md(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Fi(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ow(t){return t!==t}var uH=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var q3=D((bpe,U3)=>{h();var Wt=U3.exports={},Ui,qi;function Dw(){throw new Error("setTimeout has not been defined")}function Pw(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Ui=setTimeout:Ui=Dw}catch{Ui=Dw}try{typeof clearTimeout=="function"?qi=clearTimeout:qi=Pw}catch{qi=Pw}})();function M3(t){if(Ui===setTimeout)return setTimeout(t,0);if((Ui===Dw||!Ui)&&setTimeout)return Ui=setTimeout,setTimeout(t,0);try{return Ui(t,0)}catch{try{return Ui.call(null,t,0)}catch{return Ui.call(this,t,0)}}}function cH(t){if(qi===clearTimeout)return clearTimeout(t);if((qi===Pw||!qi)&&clearTimeout)return qi=clearTimeout,clearTimeout(t);try{return qi(t)}catch{try{return qi.call(null,t)}catch{return qi.call(this,t)}}}var Cs=[],Cu=!1,Ea,Ld=-1;function lH(){!Cu||!Ea||(Cu=!1,Ea.length?Cs=Ea.concat(Cs):Ld=-1,Cs.length&&L3())}function L3(){if(!Cu){var t=M3(lH);Cu=!0;for(var e=Cs.length;e;){for(Ea=Cs,Cs=[];++Ld1)for(var r=1;r{p=ge(no()),S=ge(q3()),fH=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=fH});var hr={};Ot(hr,{BigNumber:()=>H3,default:()=>Nu});function k3(t){var e,r,n,i=U.prototype={constructor:U,toString:null,valueOf:null},s=new U(1),o=20,u=4,a=-7,c=21,f=-1e7,d=1e7,w=!1,A=1,_=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},P="0123456789abcdefghijklmnopqrstuvwxyz",V=!0;function U(v,C){var R,F,B,l,g,y,E,I,T=this;if(!(T instanceof U))return new U(v,C);if(C==null){if(v&&v._isBigNumber===!0){T.s=v.s,!v.c||v.e>d?T.c=T.e=null:v.e=10;g/=10,l++);l>d?T.c=T.e=null:(T.e=l,T.c=[v]);return}I=String(v)}else{if(!hH.test(I=String(v)))return n(T,I,y);T.s=I.charCodeAt(0)==45?(I=I.slice(1),-1):1}(l=I.indexOf("."))>-1&&(I=I.replace(".","")),(g=I.search(/e/i))>0?(l<0&&(l=g),l+=+I.slice(g+1),I=I.substring(0,g)):l<0&&(l=I.length)}else{if(Ht(C,2,P.length,"Base"),C==10&&V)return T=new U(v),H(T,o+T.e+1,u);if(I=String(v),y=typeof v=="number"){if(v*0!=0)return n(T,I,y,C);if(T.s=1/v<0?(I=I.slice(1),-1):1,U.DEBUG&&I.replace(/^0\.0*|\./,"").length>15)throw Error(V3+v)}else T.s=I.charCodeAt(0)===45?(I=I.slice(1),-1):1;for(R=P.slice(0,C),l=g=0,E=I.length;gl){l=E;continue}}else if(!B&&(I==I.toUpperCase()&&(I=I.toLowerCase())||I==I.toLowerCase()&&(I=I.toUpperCase()))){B=!0,g=-1,l=0;continue}return n(T,String(v),y,C)}y=!1,I=r(I,C,10,T.s),(l=I.indexOf("."))>-1?I=I.replace(".",""):l=I.length}for(g=0;I.charCodeAt(g)===48;g++);for(E=I.length;I.charCodeAt(--E)===48;);if(I=I.slice(g,++E)){if(E-=g,y&&U.DEBUG&&E>15&&(v>Bw||v!==Nn(v)))throw Error(V3+T.s*v);if((l=l-g-1)>d)T.c=T.e=null;else if(l=-mr&&B<=mr&&B===Nn(B)){if(F[0]===0){if(B===0&&F.length===1)return!0;break e}if(C=(B+1)%be,C<1&&(C+=be),String(F[0]).length==C){for(C=0;C=mi||R!==Nn(R))break e;if(R!==0)return!0}}}else if(F===null&&B===null&&(l===null||l===1||l===-1))return!0;throw Error(Wr+"Invalid BigNumber: "+v)},U.maximum=U.max=function(){return L(arguments,-1)},U.minimum=U.min=function(){return L(arguments,1)},U.random=function(){var v=9007199254740992,C=Math.random()*v&2097151?function(){return Nn(Math.random()*v)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(R){var F,B,l,g,y,E=0,I=[],T=new U(s);if(R==null?R=o:Ht(R,0,mr),g=Rw(R/be),w)if(crypto.getRandomValues){for(F=crypto.getRandomValues(new Uint32Array(g*=2));E>>11),y>=9e15?(B=crypto.getRandomValues(new Uint32Array(2)),F[E]=B[0],F[E+1]=B[1]):(I.push(y%1e14),E+=2);E=g/2}else if(crypto.randomBytes){for(F=crypto.randomBytes(g*=7);E=9e15?crypto.randomBytes(7).copy(F,E):(I.push(y%1e14),E+=7);E=g/7}else throw w=!1,Error(Wr+"crypto unavailable");if(!w)for(;E=10;y/=10,E++);EB-1&&(y[g+1]==null&&(y[g+1]=0),y[g+1]+=y[g]/B|0,y[g]%=B)}return y.reverse()}return function(R,F,B,l,g){var y,E,I,T,M,x,m,O,Y=R.indexOf("."),$=o,b=u;for(Y>=0&&(T=_,_=0,R=R.replace(".",""),O=new U(F),x=O.pow(R.length-Y),_=T,O.c=C(xs(Cn(x.c),x.e,"0"),10,B,v),O.e=O.c.length),m=C(R,F,B,g?(y=P,v):(y=v,P)),I=T=m.length;m[--T]==0;m.pop());if(!m[0])return y.charAt(0);if(Y<0?--I:(x.c=m,x.e=I,x.s=l,x=e(x,O,$,b,B),m=x.c,M=x.r,I=x.e),E=I+$+1,Y=m[E],T=B/2,M=M||E<0||m[E+1]!=null,M=b<4?(Y!=null||M)&&(b==0||b==(x.s<0?3:2)):Y>T||Y==T&&(b==4||M||b==6&&m[E-1]&1||b==(x.s<0?8:7)),E<1||!m[0])R=M?xs(y.charAt(1),-$,y.charAt(0)):y.charAt(0);else{if(m.length=E,M)for(--B;++m[--E]>B;)m[E]=0,E||(++I,m=[1].concat(m));for(T=m.length;!m[--T];);for(Y=0,R="";Y<=T;R+=y.charAt(m[Y++]));R=xs(R,I,y.charAt(0))}return R}}(),e=function(){function v(F,B,l){var g,y,E,I,T=0,M=F.length,x=B%io,m=B/io|0;for(F=F.slice();M--;)E=F[M]%io,I=F[M]/io|0,g=m*E+I*x,y=x*E+g%io*io+T,T=(y/l|0)+(g/io|0)+m*I,F[M]=y%l;return T&&(F=[T].concat(F)),F}function C(F,B,l,g){var y,E;if(l!=g)E=l>g?1:-1;else for(y=E=0;yB[y]?1:-1;break}return E}function R(F,B,l,g){for(var y=0;l--;)F[l]-=y,y=F[l]1;F.splice(0,1));}return function(F,B,l,g,y){var E,I,T,M,x,m,O,Y,$,b,j,z,W,ie,te,ee,se,oe=F.s==B.s?1:-1,J=F.c,ue=B.c;if(!J||!J[0]||!ue||!ue[0])return new U(!F.s||!B.s||(J?ue&&J[0]==ue[0]:!ue)?NaN:J&&J[0]==0||!ue?oe*0:oe/0);for(Y=new U(oe),$=Y.c=[],I=F.e-B.e,oe=l+I+1,y||(y=mi,I=xn(F.e/be)-xn(B.e/be),oe=oe/be|0),T=0;ue[T]==(J[T]||0);T++);if(ue[T]>(J[T]||0)&&I--,oe<0)$.push(1),M=!0;else{for(ie=J.length,ee=ue.length,T=0,oe+=2,x=Nn(y/(ue[0]+1)),x>1&&(ue=v(ue,x,y),J=v(J,x,y),ee=ue.length,ie=J.length),W=ee,b=J.slice(0,ee),j=b.length;j=y/2&&te++;do{if(x=0,E=C(ue,b,ee,j),E<0){if(z=b[0],ee!=j&&(z=z*y+(b[1]||0)),x=Nn(z/te),x>1)for(x>=y&&(x=y-1),m=v(ue,x,y),O=m.length,j=b.length;C(m,b,O,j)==1;)x--,R(m,ee=10;oe/=10,T++);H(Y,l+(Y.e=T+I*be-1)+1,g,M)}else Y.e=I,Y.r=+M;return Y}}();function Q(v,C,R,F){var B,l,g,y,E;if(R==null?R=u:Ht(R,0,8),!v.c)return v.toString();if(B=v.c[0],g=v.e,C==null)E=Cn(v.c),E=F==1||F==2&&(g<=a||g>=c)?Ud(E,g):xs(E,g,"0");else if(v=H(new U(v),C,R),l=v.e,E=Cn(v.c),y=E.length,F==1||F==2&&(C<=l||l<=a)){for(;yy){if(--C>0)for(E+=".";C--;E+="0");}else if(C+=l-y,C>0)for(l+1==y&&(E+=".");C--;E+="0");return v.s<0&&B?"-"+E:E}function L(v,C){for(var R,F,B=1,l=new U(v[0]);B=10;B/=10,F++);return(R=F+R*be-1)>d?v.c=v.e=null:R=10;y/=10,B++);if(l=C-B,l<0)l+=be,g=C,E=M[I=0],T=Nn(E/x[B-g-1]%10);else if(I=Rw((l+1)/be),I>=M.length)if(F){for(;M.length<=I;M.push(0));E=T=0,B=1,l%=be,g=l-be+1}else break e;else{for(E=y=M[I],B=1;y>=10;y/=10,B++);l%=be,g=l-be+B,T=g<0?0:Nn(E/x[B-g-1]%10)}if(F=F||C<0||M[I+1]!=null||(g<0?E:E%x[B-g-1]),F=R<4?(T||F)&&(R==0||R==(v.s<0?3:2)):T>5||T==5&&(R==4||F||R==6&&(l>0?g>0?E/x[B-g]:0:M[I-1])%10&1||R==(v.s<0?8:7)),C<1||!M[0])return M.length=0,F?(C-=v.e+1,M[0]=x[(be-C%be)%be],v.e=-C||0):M[0]=v.e=0,v;if(l==0?(M.length=I,y=1,I--):(M.length=I+1,y=x[be-l],M[I]=g>0?Nn(E/x[B-g]%x[g])*y:0),F)for(;;)if(I==0){for(l=1,g=M[0];g>=10;g/=10,l++);for(g=M[0]+=y,y=1;g>=10;g/=10,y++);l!=y&&(v.e++,M[0]==mi&&(M[0]=1));break}else{if(M[I]+=y,M[I]!=mi)break;M[I--]=0,y=1}for(l=M.length;M[--l]===0;M.pop());}v.e>d?v.c=v.e=null:v.e=c?Ud(C,R):xs(C,R,"0"),v.s<0?"-"+C:C)}return i.absoluteValue=i.abs=function(){var v=new U(this);return v.s<0&&(v.s=1),v},i.comparedTo=function(v,C){return ba(this,new U(v,C))},i.decimalPlaces=i.dp=function(v,C){var R,F,B,l=this;if(v!=null)return Ht(v,0,mr),C==null?C=u:Ht(C,0,8),H(new U(l),v+l.e+1,C);if(!(R=l.c))return null;if(F=((B=R.length-1)-xn(this.e/be))*be,B=R[B])for(;B%10==0;B/=10,F--);return F<0&&(F=0),F},i.dividedBy=i.div=function(v,C){return e(this,new U(v,C),o,u)},i.dividedToIntegerBy=i.idiv=function(v,C){return e(this,new U(v,C),0,1)},i.exponentiatedBy=i.pow=function(v,C){var R,F,B,l,g,y,E,I,T,M=this;if(v=new U(v),v.c&&!v.isInteger())throw Error(Wr+"Exponent not an integer: "+q(v));if(C!=null&&(C=new U(C)),y=v.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!v.c||!v.c[0])return T=new U(Math.pow(+q(M),y?v.s*(2-Fd(v)):+q(v))),C?T.mod(C):T;if(E=v.s<0,C){if(C.c?!C.c[0]:!C.s)return new U(NaN);F=!E&&M.isInteger()&&C.isInteger(),F&&(M=M.mod(C))}else{if(v.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||y&&M.c[1]>=24e7:M.c[0]<8e13||y&&M.c[0]<=9999975e7)))return l=M.s<0&&Fd(v)?-0:0,M.e>-1&&(l=1/l),new U(E?1/l:l);_&&(l=Rw(_/be+2))}for(y?(R=new U(.5),E&&(v.s=1),I=Fd(v)):(B=Math.abs(+q(v)),I=B%2),T=new U(s);;){if(I){if(T=T.times(M),!T.c)break;l?T.c.length>l&&(T.c.length=l):F&&(T=T.mod(C))}if(B){if(B=Nn(B/2),B===0)break;I=B%2}else if(v=v.times(R),H(v,v.e+1,1),v.e>14)I=Fd(v);else{if(B=+q(v),B===0)break;I=B%2}M=M.times(M),l?M.c&&M.c.length>l&&(M.c.length=l):F&&(M=M.mod(C))}return F?T:(E&&(T=s.div(T)),C?T.mod(C):l?H(T,_,u,g):T)},i.integerValue=function(v){var C=new U(this);return v==null?v=u:Ht(v,0,8),H(C,C.e+1,v)},i.isEqualTo=i.eq=function(v,C){return ba(this,new U(v,C))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(v,C){return ba(this,new U(v,C))>0},i.isGreaterThanOrEqualTo=i.gte=function(v,C){return(C=ba(this,new U(v,C)))===1||C===0},i.isInteger=function(){return!!this.c&&xn(this.e/be)>this.c.length-2},i.isLessThan=i.lt=function(v,C){return ba(this,new U(v,C))<0},i.isLessThanOrEqualTo=i.lte=function(v,C){return(C=ba(this,new U(v,C)))===-1||C===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(v,C){var R,F,B,l,g=this,y=g.s;if(v=new U(v,C),C=v.s,!y||!C)return new U(NaN);if(y!=C)return v.s=-C,g.plus(v);var E=g.e/be,I=v.e/be,T=g.c,M=v.c;if(!E||!I){if(!T||!M)return T?(v.s=-C,v):new U(M?g:NaN);if(!T[0]||!M[0])return M[0]?(v.s=-C,v):new U(T[0]?g:u==3?-0:0)}if(E=xn(E),I=xn(I),T=T.slice(),y=E-I){for((l=y<0)?(y=-y,B=T):(I=E,B=M),B.reverse(),C=y;C--;B.push(0));B.reverse()}else for(F=(l=(y=T.length)<(C=M.length))?y:C,y=C=0;C0)for(;C--;T[R++]=0);for(C=mi-1;F>y;){if(T[--F]=0;){for(R=0,x=z[B]%$,m=z[B]/$|0,g=E,l=B+g;l>B;)I=j[--g]%$,T=j[g]/$|0,y=m*I+T*x,I=x*I+y%$*$+O[l]+R,R=(I/Y|0)+(y/$|0)+m*T,O[l--]=I%Y;O[l]=R}return R?++F:O.splice(0,1),k(v,O,F)},i.negated=function(){var v=new U(this);return v.s=-v.s||null,v},i.plus=function(v,C){var R,F=this,B=F.s;if(v=new U(v,C),C=v.s,!B||!C)return new U(NaN);if(B!=C)return v.s=-C,F.minus(v);var l=F.e/be,g=v.e/be,y=F.c,E=v.c;if(!l||!g){if(!y||!E)return new U(B/0);if(!y[0]||!E[0])return E[0]?v:new U(y[0]?F:B*0)}if(l=xn(l),g=xn(g),y=y.slice(),B=l-g){for(B>0?(g=l,R=E):(B=-B,R=y),R.reverse();B--;R.push(0));R.reverse()}for(B=y.length,C=E.length,B-C<0&&(R=E,E=y,y=R,C=B),B=0;C;)B=(y[--C]=y[C]+E[C]+B)/mi|0,y[C]=mi===y[C]?0:y[C]%mi;return B&&(y=[B].concat(y),++g),k(v,y,g)},i.precision=i.sd=function(v,C){var R,F,B,l=this;if(v!=null&&v!==!!v)return Ht(v,1,mr),C==null?C=u:Ht(C,0,8),H(new U(l),v,C);if(!(R=l.c))return null;if(B=R.length-1,F=B*be+1,B=R[B]){for(;B%10==0;B/=10,F--);for(B=R[0];B>=10;B/=10,F++);}return v&&l.e+1>F&&(F=l.e+1),F},i.shiftedBy=function(v){return Ht(v,-Bw,Bw),this.times("1e"+v)},i.squareRoot=i.sqrt=function(){var v,C,R,F,B,l=this,g=l.c,y=l.s,E=l.e,I=o+4,T=new U("0.5");if(y!==1||!g||!g[0])return new U(!y||y<0&&(!g||g[0])?NaN:g?l:1/0);if(y=Math.sqrt(+q(l)),y==0||y==1/0?(C=Cn(g),(C.length+E)%2==0&&(C+="0"),y=Math.sqrt(+C),E=xn((E+1)/2)-(E<0||E%2),y==1/0?C="5e"+E:(C=y.toExponential(),C=C.slice(0,C.indexOf("e")+1)+E),R=new U(C)):R=new U(y+""),R.c[0]){for(E=R.e,y=E+I,y<3&&(y=0);;)if(B=R,R=T.times(B.plus(e(l,B,I,1))),Cn(B.c).slice(0,y)===(C=Cn(R.c)).slice(0,y))if(R.e0&&O>0){for(l=O%y||y,T=m.substr(0,l);l0&&(T+=I+m.slice(l)),x&&(T="-"+T)}F=M?T+(R.decimalSeparator||"")+((E=+R.fractionGroupSize)?M.replace(new RegExp("\\d{"+E+"}\\B","g"),"$&"+(R.fractionGroupSeparator||"")):M):T}return(R.prefix||"")+F+(R.suffix||"")},i.toFraction=function(v){var C,R,F,B,l,g,y,E,I,T,M,x,m=this,O=m.c;if(v!=null&&(y=new U(v),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(Wr+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+q(y));if(!O)return new U(m);for(C=new U(s),I=R=new U(s),F=E=new U(s),x=Cn(O),l=C.e=x.length-m.e-1,C.c[0]=Mw[(g=l%be)<0?be+g:g],v=!v||y.comparedTo(C)>0?l>0?C:I:y,g=d,d=1/0,y=new U(x),E.c[0]=0;T=e(y,C,0,1),B=R.plus(T.times(F)),B.comparedTo(v)!=1;)R=F,F=B,I=E.plus(T.times(B=I)),E=B,C=y.minus(T.times(B=C)),y=B;return B=e(v.minus(R),F,0,1),E=E.plus(B.times(I)),R=R.plus(B.times(F)),E.s=I.s=m.s,l=l*2,M=e(I,F,l,u).minus(m).abs().comparedTo(e(E,R,l,u).minus(m).abs())<1?[I,F]:[E,R],d=g,M},i.toNumber=function(){return+q(this)},i.toPrecision=function(v,C){return v!=null&&Ht(v,1,mr),Q(this,v,C,2)},i.toString=function(v){var C,R=this,F=R.s,B=R.e;return B===null?F?(C="Infinity",F<0&&(C="-"+C)):C="NaN":(v==null?C=B<=a||B>=c?Ud(Cn(R.c),B):xs(Cn(R.c),B,"0"):v===10&&V?(R=H(new U(R),o+B+1,u),C=xs(Cn(R.c),R.e,"0")):(Ht(v,2,P.length,"Base"),C=r(xs(Cn(R.c),B,"0"),10,v,F,!0)),F<0&&R.c[0]&&(C="-"+C)),C},i.valueOf=i.toJSON=function(){return q(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&U.set(t),U}function xn(t){var e=t|0;return t>0||t===e?e:e-1}function Cn(t){for(var e,r,n=1,i=t.length,s=t[0]+"";nc^r?1:-1;for(u=(a=i.length)<(c=s.length)?a:c,o=0;os[o]^r?1:-1;return a==c?0:a>c^r?1:-1}function Ht(t,e,r,n){if(tr||t!==Nn(t))throw Error(Wr+(n||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Fd(t){var e=t.c.length-1;return xn(t.e/be)==e&&t.c[e]%2!=0}function Ud(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function xs(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e{h();hH=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Rw=Math.ceil,Nn=Math.floor,Wr="[BigNumber Error] ",V3=Wr+"Number primitive has more than 15 significant digits: ",mi=1e14,be=14,Bw=9007199254740991,Mw=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],io=1e7,mr=1e9;H3=k3(),Nu=H3});var Ie=D(ce=>{"use strict";h();Object.defineProperty(ce,"__esModule",{value:!0});ce.ErrSmartContractQuery=ce.ErrParseTransactionOutcome=ce.ErrInvalidInnerTransaction=ce.ErrBadUsage=ce.ErrInvalidTokenIdentifier=ce.ErrIsCompletedFieldIsMissingOnTransaction=ce.ErrGasLimitShouldBe0ForInnerTransaction=ce.ErrInvalidRelayedV2BuilderArguments=ce.ErrInvalidRelayedV1BuilderArguments=ce.ErrNotImplemented=ce.ErrContractInteraction=ce.ErrCodec=ce.ErrCannotParseTransactionOutcome=ce.ErrCannotParseContractResults=ce.ErrMissingFieldOnEnum=ce.ErrMissingFieldOnStruct=ce.ErrTypingSystem=ce.ErrMock=ce.ErrContractHasNoAddress=ce.ErrContract=ce.ErrExpectedTransactionEventsNotFound=ce.ErrExpectedTransactionStatusNotReached=ce.ErrTransactionWatcherTimeout=ce.ErrAsyncTimerAborted=ce.ErrAsyncTimerAlreadyRunning=ce.ErrInvalidFunctionName=ce.ErrSignatureCannotCreate=ce.ErrTransactionOptionsInvalid=ce.ErrTransactionVersionInvalid=ce.ErrNonceInvalid=ce.ErrNotEnoughGas=ce.ErrAddressEmpty=ce.ErrAddressBadHrp=ce.ErrAddressCannotCreate=ce.ErrUnexpectedCondition=ce.ErrInvariantFailed=ce.ErrBadType=ce.ErrUnsupportedOperation=ce.ErrInvalidArgument=ce.Err=void 0;var Te=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};ce.Err=Te;var Lw=class extends Te{constructor(e,r){super(`Invalid argument: ${e}`,r)}};ce.ErrInvalidArgument=Lw;var Fw=class extends Te{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};ce.ErrUnsupportedOperation=Fw;var Uw=class extends Te{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};ce.ErrBadType=Uw;var qw=class extends Te{constructor(e){super(`Invariant failed: [${e}]`)}};ce.ErrInvariantFailed=qw;var Vw=class extends Te{constructor(e){super(`Unexpected condition: [${e}]`)}};ce.ErrUnexpectedCondition=Vw;var kw=class extends Te{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};ce.ErrAddressCannotCreate=kw;var Hw=class extends Te{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};ce.ErrAddressBadHrp=Hw;var Gw=class extends Te{constructor(){super("Address is empty")}};ce.ErrAddressEmpty=Gw;var jw=class extends Te{constructor(e){super(`Not enough gas provided: ${e}`)}};ce.ErrNotEnoughGas=jw;var zw=class extends Te{constructor(e){super(`Invalid nonce: ${e}`)}};ce.ErrNonceInvalid=zw;var Qw=class extends Te{constructor(e){super(`Invalid transaction version: ${e}`)}};ce.ErrTransactionVersionInvalid=Qw;var Kw=class extends Te{constructor(e){super(`Invalid transaction options: ${e}`)}};ce.ErrTransactionOptionsInvalid=Kw;var Ww=class extends Te{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};ce.ErrSignatureCannotCreate=Ww;var $w=class extends Te{constructor(){super("Invalid function name")}};ce.ErrInvalidFunctionName=$w;var Yw=class extends Te{constructor(){super("Async timer already running")}};ce.ErrAsyncTimerAlreadyRunning=Yw;var Jw=class extends Te{constructor(){super("Async timer aborted")}};ce.ErrAsyncTimerAborted=Jw;var Xw=class extends Te{constructor(){super("TransactionWatcher has timed out")}};ce.ErrTransactionWatcherTimeout=Xw;var Zw=class extends Te{constructor(){super("Expected transaction status not reached")}};ce.ErrExpectedTransactionStatusNotReached=Zw;var ev=class extends Te{constructor(){super("Expected transaction events not found")}};ce.ErrExpectedTransactionEventsNotFound=ev;var qd=class extends Te{constructor(e){super(e)}};ce.ErrContract=qd;var tv=class extends qd{constructor(){super(` +var LK=Object.create;var Rp=Object.defineProperty;var FK=Object.getOwnPropertyDescriptor;var qK=Object.getOwnPropertyNames;var UK=Object.getPrototypeOf,kK=Object.prototype.hasOwnProperty;var Mp=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var pe=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Zt=(t,e)=>{for(var r in e)Rp(t,r,{get:e[r],enumerable:!0})},Pp=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of qK(e))!kK.call(t,i)&&i!==r&&Rp(t,i,{get:()=>e[i],enumerable:!(n=FK(e,i))||n.enumerable});return t},$r=(t,e,r)=>(Pp(t,e,"default"),r&&Pp(r,e,"default")),ge=(t,e,r)=>(r=t!=null?LK(UK(t)):{},Pp(e||!t||!t.__esModule?Rp(r,"default",{value:t,enumerable:!0}):r,t)),qe=t=>Pp(Rp({},"__esModule",{value:!0}),t);var wC=L(Dp=>{"use strict";h();Dp.byteLength=HK;Dp.toByteArray=zK;Dp.fromByteArray=KK;var bs=[],ni=[],VK=typeof Uint8Array<"u"?Uint8Array:Array,dA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(vc=0,vC=dA.length;vc0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function HK(t){var e=bC(t),r=e[0],n=e[1];return(r+n)*3/4-n}function GK(t,e,r){return(e+r)*3/4-r}function zK(t){var e,r=bC(t),n=r[0],i=r[1],s=new VK(GK(t,n,i)),o=0,c=i>0?n-4:n,a;for(a=0;a>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ni[t.charCodeAt(a)]<<2|ni[t.charCodeAt(a+1)]>>4,s[o++]=e&255),i===1&&(e=ni[t.charCodeAt(a)]<<10|ni[t.charCodeAt(a+1)]<<4|ni[t.charCodeAt(a+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function jK(t){return bs[t>>18&63]+bs[t>>12&63]+bs[t>>6&63]+bs[t&63]}function QK(t,e,r){for(var n,i=[],s=e;sc?c:o+s));return n===1?(e=t[r-1],i.push(bs[e>>2]+bs[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(bs[e>>10]+bs[e>>4&63]+bs[e<<2&63]+"=")),i.join("")}});var AC=L(hA=>{h();hA.read=function(t,e,r,n,i){var s,o,c=i*8-n-1,a=(1<>1,f=-7,p=r?i-1:0,S=r?-1:1,I=t[e+p];for(p+=S,s=I&(1<<-f)-1,I>>=-f,f+=c;f>0;s=s*256+t[e+p],p+=S,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+p],p+=S,f-=8);if(s===0)s=1-u;else{if(s===a)return o?NaN:(I?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(I?-1:1)*o*Math.pow(2,s-n)};hA.write=function(t,e,r,n,i,s){var o,c,a,u=s*8-i-1,f=(1<>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=n?0:s-1,N=n?1:-1,R=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+p>=1?e+=S/a:e+=S*Math.pow(2,1-p),e*a>=2&&(o++,a/=2),o+p>=f?(c=0,o=f):o+p>=1?(c=(e*a-1)*Math.pow(2,i),o=o+p):(c=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[r+I]=c&255,I+=N,c/=256,i-=8);for(o=o<0;t[r+I]=o&255,I+=N,o/=256,u-=8);t[r+I-N]|=R*128}});var wo=L(Uu=>{"use strict";h();var pA=wC(),qu=AC(),EC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Uu.Buffer=se;Uu.SlowBuffer=ZK;Uu.INSPECT_MAX_BYTES=50;var Bp=2147483647;Uu.kMaxLength=Bp;se.TYPED_ARRAY_SUPPORT=WK();!se.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 WK(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(se.prototype,"parent",{enumerable:!0,get:function(){if(se.isBuffer(this))return this.buffer}});Object.defineProperty(se.prototype,"offset",{enumerable:!0,get:function(){if(se.isBuffer(this))return this.byteOffset}});function bo(t){if(t>Bp)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,se.prototype),e}function se(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return vA(t)}return TC(t,e,r)}se.poolSize=8192;function TC(t,e,r){if(typeof t=="string")return YK(t,e);if(ArrayBuffer.isView(t))return JK(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(ws(t,ArrayBuffer)||t&&ws(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ws(t,SharedArrayBuffer)||t&&ws(t.buffer,SharedArrayBuffer)))return mA(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return se.from(n,e,r);var i=XK(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return se.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}se.from=function(t,e,r){return TC(t,e,r)};Object.setPrototypeOf(se.prototype,Uint8Array.prototype);Object.setPrototypeOf(se,Uint8Array);function IC(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function $K(t,e,r){return IC(t),t<=0?bo(t):e!==void 0?typeof r=="string"?bo(t).fill(e,r):bo(t).fill(e):bo(t)}se.alloc=function(t,e,r){return $K(t,e,r)};function vA(t){return IC(t),bo(t<0?0:bA(t)|0)}se.allocUnsafe=function(t){return vA(t)};se.allocUnsafeSlow=function(t){return vA(t)};function YK(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!se.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=CC(t,e)|0,n=bo(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function gA(t){for(var e=t.length<0?0:bA(t.length)|0,r=bo(e),n=0;n=Bp)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Bp.toString(16)+" bytes");return t|0}function ZK(t){return+t!=t&&(t=0),se.alloc(+t)}se.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==se.prototype};se.compare=function(e,r){if(ws(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),ws(r,Uint8Array)&&(r=se.from(r,r.offset,r.byteLength)),!se.isBuffer(e)||!se.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?se.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(se.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function CC(t,e){if(se.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||ws(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return yA(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return MC(t).length;default:if(i)return n?-1:yA(t).length;e=(""+e).toLowerCase(),i=!0}}se.byteLength=CC;function eW(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return lW(this,e,r);case"utf8":case"utf-8":return NC(this,e,r);case"ascii":return cW(this,e,r);case"latin1":case"binary":return uW(this,e,r);case"base64":return oW(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fW(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}se.prototype._isBuffer=!0;function bc(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}se.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};EC&&(se.prototype[EC]=se.prototype.inspect);se.prototype.compare=function(e,r,n,i,s){if(ws(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),!se.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,c=n-r,a=Math.min(o,c),u=this.slice(i,s),f=e.slice(r,n),p=0;p2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,wA(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=se.from(e,n)),se.isBuffer(e))return e.length===0?-1:SC(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):SC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function SC(t,e,r,n,i){var s=1,o=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,c/=2,r/=2}function a(I,N){return s===1?I[N]:I.readUInt16BE(N*s)}var u;if(i){var f=-1;for(u=r;uo&&(r=o-c),u=r;u>=0;u--){for(var p=!0,S=0;Si&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return tW(this,e,r,n);case"utf8":case"utf-8":return rW(this,e,r,n);case"ascii":case"latin1":case"binary":return nW(this,e,r,n);case"base64":return iW(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sW(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};se.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function oW(t,e,r){return e===0&&r===t.length?pA.fromByteArray(t):pA.fromByteArray(t.slice(e,r))}function NC(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+c<=r){var a,u,f,p;switch(c){case 1:s<128&&(o=s);break;case 2:a=t[i+1],(a&192)===128&&(p=(s&31)<<6|a&63,p>127&&(o=p));break;case 3:a=t[i+1],u=t[i+2],(a&192)===128&&(u&192)===128&&(p=(s&15)<<12|(a&63)<<6|u&63,p>2047&&(p<55296||p>57343)&&(o=p));break;case 4:a=t[i+1],u=t[i+2],f=t[i+3],(a&192)===128&&(u&192)===128&&(f&192)===128&&(p=(s&15)<<18|(a&63)<<12|(u&63)<<6|f&63,p>65535&&p<1114112&&(o=p))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return aW(n)}var _C=4096;function aW(t){var e=t.length;if(e<=_C)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}se.prototype.readUintLE=se.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};se.prototype.readUint8=se.prototype.readUInt8=function(e,r){return e=e>>>0,r||Fr(e,1,this.length),this[e]};se.prototype.readUint16LE=se.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Fr(e,2,this.length),this[e]|this[e+1]<<8};se.prototype.readUint16BE=se.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Fr(e,2,this.length),this[e]<<8|this[e+1]};se.prototype.readUint32LE=se.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};se.prototype.readUint32BE=se.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};se.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};se.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};se.prototype.readInt8=function(e,r){return e=e>>>0,r||Fr(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};se.prototype.readInt16LE=function(e,r){e=e>>>0,r||Fr(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};se.prototype.readInt16BE=function(e,r){e=e>>>0,r||Fr(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};se.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};se.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};se.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),qu.read(this,e,!0,23,4)};se.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),qu.read(this,e,!1,23,4)};se.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Fr(e,8,this.length),qu.read(this,e,!0,52,8)};se.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Fr(e,8,this.length),qu.read(this,e,!1,52,8)};function Cn(t,e,r,n,i,s){if(!se.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}se.prototype.writeUintLE=se.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Cn(this,e,r,n,s,0)}var o=1,c=0;for(this[r]=e&255;++c>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Cn(this,e,r,n,s,0)}var o=n-1,c=1;for(this[r+o]=e&255;--o>=0&&(c*=256);)this[r+o]=e/c&255;return r+n};se.prototype.writeUint8=se.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,1,255,0),this[r]=e&255,r+1};se.prototype.writeUint16LE=se.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};se.prototype.writeUint16BE=se.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};se.prototype.writeUint32LE=se.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};se.prototype.writeUint32BE=se.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};se.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Cn(this,e,r,n,s-1,-s)}var o=0,c=1,a=0;for(this[r]=e&255;++o>0)-a&255;return r+n};se.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Cn(this,e,r,n,s-1,-s)}var o=n-1,c=1,a=0;for(this[r+o]=e&255;--o>=0&&(c*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/c>>0)-a&255;return r+n};se.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};se.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};se.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};se.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};se.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function OC(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function PC(t,e,r,n,i){return e=+e,r=r>>>0,i||OC(t,e,r,4,34028234663852886e22,-34028234663852886e22),qu.write(t,e,r,n,23,4),r+4}se.prototype.writeFloatLE=function(e,r,n){return PC(this,e,r,!0,n)};se.prototype.writeFloatBE=function(e,r,n){return PC(this,e,r,!1,n)};function RC(t,e,r,n,i){return e=+e,r=r>>>0,i||OC(t,e,r,8,17976931348623157e292,-17976931348623157e292),qu.write(t,e,r,n,52,8),r+8}se.prototype.writeDoubleLE=function(e,r,n){return RC(this,e,r,!0,n)};se.prototype.writeDoubleBE=function(e,r,n){return RC(this,e,r,!1,n)};se.prototype.copy=function(e,r,n,i){if(!se.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function pW(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function MC(t){return pA.toByteArray(hW(t))}function Lp(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function ws(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function wA(t){return t!==t}var mW=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var qC=L((AEe,FC)=>{h();var Ar=FC.exports={},As,Es;function AA(){throw new Error("setTimeout has not been defined")}function EA(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?As=setTimeout:As=AA}catch{As=AA}try{typeof clearTimeout=="function"?Es=clearTimeout:Es=EA}catch{Es=EA}})();function DC(t){if(As===setTimeout)return setTimeout(t,0);if((As===AA||!As)&&setTimeout)return As=setTimeout,setTimeout(t,0);try{return As(t,0)}catch{try{return As.call(null,t,0)}catch{return As.call(this,t,0)}}}function yW(t){if(Es===clearTimeout)return clearTimeout(t);if((Es===EA||!Es)&&clearTimeout)return Es=clearTimeout,clearTimeout(t);try{return Es(t)}catch{try{return Es.call(null,t)}catch{return Es.call(this,t)}}}var Ao=[],ku=!1,wc,Fp=-1;function vW(){!ku||!wc||(ku=!1,wc.length?Ao=wc.concat(Ao):Fp=-1,Ao.length&&BC())}function BC(){if(!ku){var t=DC(vW);ku=!0;for(var e=Ao.length;e;){for(wc=Ao,Ao=[];++Fp1)for(var r=1;r{b=ge(wo()),O=ge(qC()),bW=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=bW});var jt={};Zt(jt,{BigNumber:()=>VC,default:()=>Vu});function kC(t){var e,r,n,i=k.prototype={constructor:k,toString:null,valueOf:null},s=new k(1),o=20,c=4,a=-7,u=21,f=-1e7,p=1e7,S=!1,I=1,N=0,R={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},D="0123456789abcdefghijklmnopqrstuvwxyz",U=!0;function k(C,B){var x,g,v,l,d,m,w,_,A=this;if(!(A instanceof k))return new k(C,B);if(B==null){if(C&&C._isBigNumber===!0){A.s=C.s,!C.c||C.e>p?A.c=A.e=null:C.e=10;d/=10,l++);l>p?A.c=A.e=null:(A.e=l,A.c=[C]);return}_=String(C)}else{if(!wW.test(_=String(C)))return n(A,_,m);A.s=_.charCodeAt(0)==45?(_=_.slice(1),-1):1}(l=_.indexOf("."))>-1&&(_=_.replace(".","")),(d=_.search(/e/i))>0?(l<0&&(l=d),l+=+_.slice(d+1),_=_.substring(0,d)):l<0&&(l=_.length)}else{if(fr(B,2,D.length,"Base"),B==10&&U)return A=new k(C),V(A,o+A.e+1,c);if(_=String(C),m=typeof C=="number"){if(C*0!=0)return n(A,_,m,B);if(A.s=1/C<0?(_=_.slice(1),-1):1,k.DEBUG&&_.replace(/^0\.0*|\./,"").length>15)throw Error(UC+C)}else A.s=_.charCodeAt(0)===45?(_=_.slice(1),-1):1;for(x=D.slice(0,B),l=d=0,w=_.length;dl){l=w;continue}}else if(!v&&(_==_.toUpperCase()&&(_=_.toLowerCase())||_==_.toLowerCase()&&(_=_.toUpperCase()))){v=!0,d=-1,l=0;continue}return n(A,String(C),m,B)}m=!1,_=r(_,B,10,A.s),(l=_.indexOf("."))>-1?_=_.replace(".",""):l=_.length}for(d=0;_.charCodeAt(d)===48;d++);for(w=_.length;_.charCodeAt(--w)===48;);if(_=_.slice(d,++w)){if(w-=d,m&&k.DEBUG&&w>15&&(C>_A||C!==si(C)))throw Error(UC+A.s*C);if((l=l-d-1)>p)A.c=A.e=null;else if(l=-qr&&v<=qr&&v===si(v)){if(g[0]===0){if(v===0&&g.length===1)return!0;break e}if(B=(v+1)%ke,B<1&&(B+=ke),String(g[0]).length==B){for(B=0;B=Wi||x!==si(x))break e;if(x!==0)return!0}}}else if(g===null&&v===null&&(l===null||l===1||l===-1))return!0;throw Error(xn+"Invalid BigNumber: "+C)},k.maximum=k.max=function(){return H(arguments,-1)},k.minimum=k.min=function(){return H(arguments,1)},k.random=function(){var C=9007199254740992,B=Math.random()*C&2097151?function(){return si(Math.random()*C)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var g,v,l,d,m,w=0,_=[],A=new k(s);if(x==null?x=o:fr(x,0,qr),d=SA(x/ke),S)if(crypto.getRandomValues){for(g=crypto.getRandomValues(new Uint32Array(d*=2));w>>11),m>=9e15?(v=crypto.getRandomValues(new Uint32Array(2)),g[w]=v[0],g[w+1]=v[1]):(_.push(m%1e14),w+=2);w=d/2}else if(crypto.randomBytes){for(g=crypto.randomBytes(d*=7);w=9e15?crypto.randomBytes(7).copy(g,w):(_.push(m%1e14),w+=7);w=d/7}else throw S=!1,Error(xn+"crypto unavailable");if(!S)for(;w=10;m/=10,w++);wv-1&&(m[d+1]==null&&(m[d+1]=0),m[d+1]+=m[d]/v|0,m[d]%=v)}return m.reverse()}return function(x,g,v,l,d){var m,w,_,A,y,T,E,M,W=x.indexOf("."),Y=o,P=c;for(W>=0&&(A=N,N=0,x=x.replace(".",""),M=new k(g),T=M.pow(x.length-W),N=A,M.c=B(So(ii(T.c),T.e,"0"),10,v,C),M.e=M.c.length),E=B(x,g,v,d?(m=D,C):(m=C,D)),_=A=E.length;E[--A]==0;E.pop());if(!E[0])return m.charAt(0);if(W<0?--_:(T.c=E,T.e=_,T.s=l,T=e(T,M,Y,P,v),E=T.c,y=T.r,_=T.e),w=_+Y+1,W=E[w],A=v/2,y=y||w<0||E[w+1]!=null,y=P<4?(W!=null||y)&&(P==0||P==(T.s<0?3:2)):W>A||W==A&&(P==4||y||P==6&&E[w-1]&1||P==(T.s<0?8:7)),w<1||!E[0])x=y?So(m.charAt(1),-Y,m.charAt(0)):m.charAt(0);else{if(E.length=w,y)for(--v;++E[--w]>v;)E[w]=0,w||(++_,E=[1].concat(E));for(A=E.length;!E[--A];);for(W=0,x="";W<=A;x+=m.charAt(E[W++]));x=So(x,_,m.charAt(0))}return x}}(),e=function(){function C(g,v,l){var d,m,w,_,A=0,y=g.length,T=v%ta,E=v/ta|0;for(g=g.slice();y--;)w=g[y]%ta,_=g[y]/ta|0,d=E*w+_*T,m=T*w+d%ta*ta+A,A=(m/l|0)+(d/ta|0)+E*_,g[y]=m%l;return A&&(g=[A].concat(g)),g}function B(g,v,l,d){var m,w;if(l!=d)w=l>d?1:-1;else for(m=w=0;mv[m]?1:-1;break}return w}function x(g,v,l,d){for(var m=0;l--;)g[l]-=m,m=g[l]1;g.splice(0,1));}return function(g,v,l,d,m){var w,_,A,y,T,E,M,W,Y,P,G,Q,$,ee,ie,X,re,ae=g.s==v.s?1:-1,Z=g.c,oe=v.c;if(!Z||!Z[0]||!oe||!oe[0])return new k(!g.s||!v.s||(Z?oe&&Z[0]==oe[0]:!oe)?NaN:Z&&Z[0]==0||!oe?ae*0:ae/0);for(W=new k(ae),Y=W.c=[],_=g.e-v.e,ae=l+_+1,m||(m=Wi,_=oi(g.e/ke)-oi(v.e/ke),ae=ae/ke|0),A=0;oe[A]==(Z[A]||0);A++);if(oe[A]>(Z[A]||0)&&_--,ae<0)Y.push(1),y=!0;else{for(ee=Z.length,X=oe.length,A=0,ae+=2,T=si(m/(oe[0]+1)),T>1&&(oe=C(oe,T,m),Z=C(Z,T,m),X=oe.length,ee=Z.length),$=X,P=Z.slice(0,X),G=P.length;G=m/2&&ie++;do{if(T=0,w=B(oe,P,X,G),w<0){if(Q=P[0],X!=G&&(Q=Q*m+(P[1]||0)),T=si(Q/ie),T>1)for(T>=m&&(T=m-1),E=C(oe,T,m),M=E.length,G=P.length;B(E,P,M,G)==1;)T--,x(E,X=10;ae/=10,A++);V(W,l+(W.e=A+_*ke-1)+1,d,y)}else W.e=_,W.r=+y;return W}}();function z(C,B,x,g){var v,l,d,m,w;if(x==null?x=c:fr(x,0,8),!C.c)return C.toString();if(v=C.c[0],d=C.e,B==null)w=ii(C.c),w=g==1||g==2&&(d<=a||d>=u)?Up(w,d):So(w,d,"0");else if(C=V(new k(C),B,x),l=C.e,w=ii(C.c),m=w.length,g==1||g==2&&(B<=l||l<=a)){for(;mm){if(--B>0)for(w+=".";B--;w+="0");}else if(B+=l-m,B>0)for(l+1==m&&(w+=".");B--;w+="0");return C.s<0&&v?"-"+w:w}function H(C,B){for(var x,g,v=1,l=new k(C[0]);v=10;v/=10,g++);return(x=g+x*ke-1)>p?C.c=C.e=null:x=10;m/=10,v++);if(l=B-v,l<0)l+=ke,d=B,w=y[_=0],A=si(w/T[v-d-1]%10);else if(_=SA((l+1)/ke),_>=y.length)if(g){for(;y.length<=_;y.push(0));w=A=0,v=1,l%=ke,d=l-ke+1}else break e;else{for(w=m=y[_],v=1;m>=10;m/=10,v++);l%=ke,d=l-ke+v,A=d<0?0:si(w/T[v-d-1]%10)}if(g=g||B<0||y[_+1]!=null||(d<0?w:w%T[v-d-1]),g=x<4?(A||g)&&(x==0||x==(C.s<0?3:2)):A>5||A==5&&(x==4||g||x==6&&(l>0?d>0?w/T[v-d]:0:y[_-1])%10&1||x==(C.s<0?8:7)),B<1||!y[0])return y.length=0,g?(B-=C.e+1,y[0]=T[(ke-B%ke)%ke],C.e=-B||0):y[0]=C.e=0,C;if(l==0?(y.length=_,m=1,_--):(y.length=_+1,m=T[ke-l],y[_]=d>0?si(w/T[v-d]%T[d])*m:0),g)for(;;)if(_==0){for(l=1,d=y[0];d>=10;d/=10,l++);for(d=y[0]+=m,m=1;d>=10;d/=10,m++);l!=m&&(C.e++,y[0]==Wi&&(y[0]=1));break}else{if(y[_]+=m,y[_]!=Wi)break;y[_--]=0,m=1}for(l=y.length;y[--l]===0;y.pop());}C.e>p?C.c=C.e=null:C.e=u?Up(B,x):So(B,x,"0"),C.s<0?"-"+B:B)}return i.absoluteValue=i.abs=function(){var C=new k(this);return C.s<0&&(C.s=1),C},i.comparedTo=function(C,B){return Ac(this,new k(C,B))},i.decimalPlaces=i.dp=function(C,B){var x,g,v,l=this;if(C!=null)return fr(C,0,qr),B==null?B=c:fr(B,0,8),V(new k(l),C+l.e+1,B);if(!(x=l.c))return null;if(g=((v=x.length-1)-oi(this.e/ke))*ke,v=x[v])for(;v%10==0;v/=10,g--);return g<0&&(g=0),g},i.dividedBy=i.div=function(C,B){return e(this,new k(C,B),o,c)},i.dividedToIntegerBy=i.idiv=function(C,B){return e(this,new k(C,B),0,1)},i.exponentiatedBy=i.pow=function(C,B){var x,g,v,l,d,m,w,_,A,y=this;if(C=new k(C),C.c&&!C.isInteger())throw Error(xn+"Exponent not an integer: "+q(C));if(B!=null&&(B=new k(B)),m=C.e>14,!y.c||!y.c[0]||y.c[0]==1&&!y.e&&y.c.length==1||!C.c||!C.c[0])return A=new k(Math.pow(+q(y),m?C.s*(2-qp(C)):+q(C))),B?A.mod(B):A;if(w=C.s<0,B){if(B.c?!B.c[0]:!B.s)return new k(NaN);g=!w&&y.isInteger()&&B.isInteger(),g&&(y=y.mod(B))}else{if(C.e>9&&(y.e>0||y.e<-1||(y.e==0?y.c[0]>1||m&&y.c[1]>=24e7:y.c[0]<8e13||m&&y.c[0]<=9999975e7)))return l=y.s<0&&qp(C)?-0:0,y.e>-1&&(l=1/l),new k(w?1/l:l);N&&(l=SA(N/ke+2))}for(m?(x=new k(.5),w&&(C.s=1),_=qp(C)):(v=Math.abs(+q(C)),_=v%2),A=new k(s);;){if(_){if(A=A.times(y),!A.c)break;l?A.c.length>l&&(A.c.length=l):g&&(A=A.mod(B))}if(v){if(v=si(v/2),v===0)break;_=v%2}else if(C=C.times(x),V(C,C.e+1,1),C.e>14)_=qp(C);else{if(v=+q(C),v===0)break;_=v%2}y=y.times(y),l?y.c&&y.c.length>l&&(y.c.length=l):g&&(y=y.mod(B))}return g?A:(w&&(A=s.div(A)),B?A.mod(B):l?V(A,N,c,d):A)},i.integerValue=function(C){var B=new k(this);return C==null?C=c:fr(C,0,8),V(B,B.e+1,C)},i.isEqualTo=i.eq=function(C,B){return Ac(this,new k(C,B))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(C,B){return Ac(this,new k(C,B))>0},i.isGreaterThanOrEqualTo=i.gte=function(C,B){return(B=Ac(this,new k(C,B)))===1||B===0},i.isInteger=function(){return!!this.c&&oi(this.e/ke)>this.c.length-2},i.isLessThan=i.lt=function(C,B){return Ac(this,new k(C,B))<0},i.isLessThanOrEqualTo=i.lte=function(C,B){return(B=Ac(this,new k(C,B)))===-1||B===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(C,B){var x,g,v,l,d=this,m=d.s;if(C=new k(C,B),B=C.s,!m||!B)return new k(NaN);if(m!=B)return C.s=-B,d.plus(C);var w=d.e/ke,_=C.e/ke,A=d.c,y=C.c;if(!w||!_){if(!A||!y)return A?(C.s=-B,C):new k(y?d:NaN);if(!A[0]||!y[0])return y[0]?(C.s=-B,C):new k(A[0]?d:c==3?-0:0)}if(w=oi(w),_=oi(_),A=A.slice(),m=w-_){for((l=m<0)?(m=-m,v=A):(_=w,v=y),v.reverse(),B=m;B--;v.push(0));v.reverse()}else for(g=(l=(m=A.length)<(B=y.length))?m:B,m=B=0;B0)for(;B--;A[x++]=0);for(B=Wi-1;g>m;){if(A[--g]=0;){for(x=0,T=Q[v]%Y,E=Q[v]/Y|0,d=w,l=v+d;l>v;)_=G[--d]%Y,A=G[d]/Y|0,m=E*_+A*T,_=T*_+m%Y*Y+M[l]+x,x=(_/W|0)+(m/Y|0)+E*A,M[l--]=_%W;M[l]=x}return x?++g:M.splice(0,1),F(C,M,g)},i.negated=function(){var C=new k(this);return C.s=-C.s||null,C},i.plus=function(C,B){var x,g=this,v=g.s;if(C=new k(C,B),B=C.s,!v||!B)return new k(NaN);if(v!=B)return C.s=-B,g.minus(C);var l=g.e/ke,d=C.e/ke,m=g.c,w=C.c;if(!l||!d){if(!m||!w)return new k(v/0);if(!m[0]||!w[0])return w[0]?C:new k(m[0]?g:v*0)}if(l=oi(l),d=oi(d),m=m.slice(),v=l-d){for(v>0?(d=l,x=w):(v=-v,x=m),x.reverse();v--;x.push(0));x.reverse()}for(v=m.length,B=w.length,v-B<0&&(x=w,w=m,m=x,B=v),v=0;B;)v=(m[--B]=m[B]+w[B]+v)/Wi|0,m[B]=Wi===m[B]?0:m[B]%Wi;return v&&(m=[v].concat(m),++d),F(C,m,d)},i.precision=i.sd=function(C,B){var x,g,v,l=this;if(C!=null&&C!==!!C)return fr(C,1,qr),B==null?B=c:fr(B,0,8),V(new k(l),C,B);if(!(x=l.c))return null;if(v=x.length-1,g=v*ke+1,v=x[v]){for(;v%10==0;v/=10,g--);for(v=x[0];v>=10;v/=10,g++);}return C&&l.e+1>g&&(g=l.e+1),g},i.shiftedBy=function(C){return fr(C,-_A,_A),this.times("1e"+C)},i.squareRoot=i.sqrt=function(){var C,B,x,g,v,l=this,d=l.c,m=l.s,w=l.e,_=o+4,A=new k("0.5");if(m!==1||!d||!d[0])return new k(!m||m<0&&(!d||d[0])?NaN:d?l:1/0);if(m=Math.sqrt(+q(l)),m==0||m==1/0?(B=ii(d),(B.length+w)%2==0&&(B+="0"),m=Math.sqrt(+B),w=oi((w+1)/2)-(w<0||w%2),m==1/0?B="5e"+w:(B=m.toExponential(),B=B.slice(0,B.indexOf("e")+1)+w),x=new k(B)):x=new k(m+""),x.c[0]){for(w=x.e,m=w+_,m<3&&(m=0);;)if(v=x,x=A.times(v.plus(e(l,v,_,1))),ii(v.c).slice(0,m)===(B=ii(x.c)).slice(0,m))if(x.e0&&M>0){for(l=M%m||m,A=E.substr(0,l);l0&&(A+=_+E.slice(l)),T&&(A="-"+A)}g=y?A+(x.decimalSeparator||"")+((w=+x.fractionGroupSize)?y.replace(new RegExp("\\d{"+w+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):y):A}return(x.prefix||"")+g+(x.suffix||"")},i.toFraction=function(C){var B,x,g,v,l,d,m,w,_,A,y,T,E=this,M=E.c;if(C!=null&&(m=new k(C),!m.isInteger()&&(m.c||m.s!==1)||m.lt(s)))throw Error(xn+"Argument "+(m.isInteger()?"out of range: ":"not an integer: ")+q(m));if(!M)return new k(E);for(B=new k(s),_=x=new k(s),g=w=new k(s),T=ii(M),l=B.e=T.length-E.e-1,B.c[0]=TA[(d=l%ke)<0?ke+d:d],C=!C||m.comparedTo(B)>0?l>0?B:_:m,d=p,p=1/0,m=new k(T),w.c[0]=0;A=e(m,B,0,1),v=x.plus(A.times(g)),v.comparedTo(C)!=1;)x=g,g=v,_=w.plus(A.times(v=_)),w=v,B=m.minus(A.times(v=B)),m=v;return v=e(C.minus(x),g,0,1),w=w.plus(v.times(_)),x=x.plus(v.times(g)),w.s=_.s=E.s,l=l*2,y=e(_,g,l,c).minus(E).abs().comparedTo(e(w,x,l,c).minus(E).abs())<1?[_,g]:[w,x],p=d,y},i.toNumber=function(){return+q(this)},i.toPrecision=function(C,B){return C!=null&&fr(C,1,qr),z(this,C,B,2)},i.toString=function(C){var B,x=this,g=x.s,v=x.e;return v===null?g?(B="Infinity",g<0&&(B="-"+B)):B="NaN":(C==null?B=v<=a||v>=u?Up(ii(x.c),v):So(ii(x.c),v,"0"):C===10&&U?(x=V(new k(x),o+v+1,c),B=So(ii(x.c),x.e,"0")):(fr(C,2,D.length,"Base"),B=r(So(ii(x.c),v,"0"),10,C,g,!0)),g<0&&x.c[0]&&(B="-"+B)),B},i.valueOf=i.toJSON=function(){return q(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&k.set(t),k}function oi(t){var e=t|0;return t>0||t===e?e:e-1}function ii(t){for(var e,r,n=1,i=t.length,s=t[0]+"";nu^r?1:-1;for(c=(a=i.length)<(u=s.length)?a:u,o=0;os[o]^r?1:-1;return a==u?0:a>u^r?1:-1}function fr(t,e,r,n){if(tr||t!==si(t))throw Error(xn+(n||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function qp(t){var e=t.c.length-1;return oi(t.e/ke)==e&&t.c[e]%2!=0}function Up(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function So(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e{h();wW=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,SA=Math.ceil,si=Math.floor,xn="[BigNumber Error] ",UC=xn+"Number primitive has more than 15 significant digits: ",Wi=1e14,ke=14,_A=9007199254740991,TA=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ta=1e7,qr=1e9;VC=kC(),Vu=VC});var Ve=L(ue=>{"use strict";h();Object.defineProperty(ue,"__esModule",{value:!0});ue.ErrSmartContractQuery=ue.ErrParseTransactionOutcome=ue.ErrInvalidInnerTransaction=ue.ErrBadUsage=ue.ErrInvalidTokenIdentifier=ue.ErrIsCompletedFieldIsMissingOnTransaction=ue.ErrGasLimitShouldBe0ForInnerTransaction=ue.ErrInvalidRelayedV2BuilderArguments=ue.ErrInvalidRelayedV1BuilderArguments=ue.ErrNotImplemented=ue.ErrContractInteraction=ue.ErrCodec=ue.ErrCannotParseTransactionOutcome=ue.ErrCannotParseContractResults=ue.ErrMissingFieldOnEnum=ue.ErrMissingFieldOnStruct=ue.ErrTypingSystem=ue.ErrMock=ue.ErrContractHasNoAddress=ue.ErrContract=ue.ErrExpectedTransactionEventsNotFound=ue.ErrExpectedTransactionStatusNotReached=ue.ErrTransactionWatcherTimeout=ue.ErrAsyncTimerAborted=ue.ErrAsyncTimerAlreadyRunning=ue.ErrInvalidFunctionName=ue.ErrSignatureCannotCreate=ue.ErrTransactionOptionsInvalid=ue.ErrTransactionVersionInvalid=ue.ErrNonceInvalid=ue.ErrNotEnoughGas=ue.ErrAddressEmpty=ue.ErrAddressBadHrp=ue.ErrAddressCannotCreate=ue.ErrUnexpectedCondition=ue.ErrInvariantFailed=ue.ErrBadType=ue.ErrUnsupportedOperation=ue.ErrInvalidArgument=ue.Err=void 0;var Qe=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};ue.Err=Qe;var IA=class extends Qe{constructor(e,r){super(`Invalid argument: ${e}`,r)}};ue.ErrInvalidArgument=IA;var CA=class extends Qe{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};ue.ErrUnsupportedOperation=CA;var xA=class extends Qe{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};ue.ErrBadType=xA;var NA=class extends Qe{constructor(e){super(`Invariant failed: [${e}]`)}};ue.ErrInvariantFailed=NA;var OA=class extends Qe{constructor(e){super(`Unexpected condition: [${e}]`)}};ue.ErrUnexpectedCondition=OA;var PA=class extends Qe{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};ue.ErrAddressCannotCreate=PA;var RA=class extends Qe{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};ue.ErrAddressBadHrp=RA;var MA=class extends Qe{constructor(){super("Address is empty")}};ue.ErrAddressEmpty=MA;var DA=class extends Qe{constructor(e){super(`Not enough gas provided: ${e}`)}};ue.ErrNotEnoughGas=DA;var BA=class extends Qe{constructor(e){super(`Invalid nonce: ${e}`)}};ue.ErrNonceInvalid=BA;var LA=class extends Qe{constructor(e){super(`Invalid transaction version: ${e}`)}};ue.ErrTransactionVersionInvalid=LA;var FA=class extends Qe{constructor(e){super(`Invalid transaction options: ${e}`)}};ue.ErrTransactionOptionsInvalid=FA;var qA=class extends Qe{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};ue.ErrSignatureCannotCreate=qA;var UA=class extends Qe{constructor(){super("Invalid function name")}};ue.ErrInvalidFunctionName=UA;var kA=class extends Qe{constructor(){super("Async timer already running")}};ue.ErrAsyncTimerAlreadyRunning=kA;var VA=class extends Qe{constructor(){super("Async timer aborted")}};ue.ErrAsyncTimerAborted=VA;var HA=class extends Qe{constructor(){super("TransactionWatcher has timed out")}};ue.ErrTransactionWatcherTimeout=HA;var GA=class extends Qe{constructor(){super("Expected transaction status not reached")}};ue.ErrExpectedTransactionStatusNotReached=GA;var zA=class extends Qe{constructor(){super("Expected transaction events not found")}};ue.ErrExpectedTransactionEventsNotFound=zA;var kp=class extends Qe{constructor(e){super(e)}};ue.ErrContract=kp;var jA=class extends kp{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). -`)}};ce.ErrContractHasNoAddress=tv;var rv=class extends Te{constructor(e){super(e)}};ce.ErrMock=rv;var nv=class extends Te{constructor(e){super(e)}};ce.ErrTypingSystem=nv;var iv=class extends Te{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};ce.ErrMissingFieldOnStruct=iv;var sv=class extends Te{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};ce.ErrMissingFieldOnEnum=sv;var ov=class extends Te{constructor(e){super(`cannot parse contract results: ${e}`)}};ce.ErrCannotParseContractResults=ov;var av=class extends Te{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};ce.ErrCannotParseTransactionOutcome=av;var uv=class extends Te{constructor(e){super(e)}};ce.ErrCodec=uv;var cv=class extends Te{constructor(e){super(e)}};ce.ErrContractInteraction=cv;var lv=class extends Te{constructor(){super("Method not yet implemented")}};ce.ErrNotImplemented=lv;var fv=class extends Te{constructor(){super("invalid arguments for relayed v1 builder")}};ce.ErrInvalidRelayedV1BuilderArguments=fv;var hv=class extends Te{constructor(){super("invalid arguments for relayed v2 builder")}};ce.ErrInvalidRelayedV2BuilderArguments=hv;var dv=class extends Te{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ce.ErrGasLimitShouldBe0ForInnerTransaction=dv;var gv=class extends Te{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};ce.ErrIsCompletedFieldIsMissingOnTransaction=gv;var pv=class extends Te{constructor(e){super(e)}};ce.ErrInvalidTokenIdentifier=pv;var mv=class extends Te{constructor(e){super(e)}};ce.ErrBadUsage=mv;var yv=class extends Te{constructor(e){super(e)}};ce.ErrInvalidInnerTransaction=yv;var wv=class extends Te{constructor(e){super(e)}};ce.ErrParseTransactionOutcome=wv;var vv=class extends Te{constructor(e,r){super(r),this.returnCode=e}};ce.ErrSmartContractQuery=vv});var Ia=D(On=>{"use strict";h();var dH=On&&On.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(On,"__esModule",{value:!0});On.TokenPayment=On.TokenComputer=On.TokenTransfer=On.Token=void 0;var Sa=dH((nr(),xe(hr))),xu=Ie(),G3="EGLD",j3=18;Sa.default.set({ROUNDING_MODE:1});var Vd=class{constructor(e){this.identifier=e.identifier,this.nonce=e.nonce||0n}};On.Token=Vd;var kd=class t{constructor(e){if(this.isLegacyTokenTransferOptions(e)){let r=new Sa.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new xu.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0,this.token=new Vd({identifier:e.tokenIdentifier,nonce:BigInt(e.nonce)}),this.amount=BigInt(this.amountAsBigInteger.toFixed(0))}else this.token=e.token,this.amount=e.amount,this.tokenIdentifier=e.token.identifier,this.nonce=Number(e.token.nonce),this.amountAsBigInteger=new Sa.default(this.amount.toString()),this.numDecimals=0}isLegacyTokenTransferOptions(e){return e.tokenIdentifier!==void 0}static egldFromAmount(e){let r=new Sa.default(e).shiftedBy(j3).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:G3,nonce:0,amountAsBigInteger:e,numDecimals:j3})}static fungibleFromAmount(e,r,n){let i=new Sa.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Sa.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amount.toString()}valueOf(){return new Sa.default(this.amount.toString())}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.token.identifier==G3}isFungible(){return this.token.nonce==0n}};On.TokenTransfer=kd;var Av=class{constructor(){}isFungible(e){return e.nonce===0n}extractNonceFromExtendedIdentifier(e){let r=e.split("-");if(this.checkIfExtendedIdentifierWasProvided(r),this.checkLengthOfRandomSequence(r[1]),r.length==2)return 0;let n=p.Buffer.from(r[2],"hex");return gH(n)}extractIdentifierFromExtendedIdentifier(e){let r=e.split("-");return this.checkIfExtendedIdentifierWasProvided(r),this.ensureTokenTickerValidity(r[0]),this.checkLengthOfRandomSequence(r[1]),r[0]+"-"+r[1]}checkIfExtendedIdentifierWasProvided(e){if(e.length<2||e.length>3)throw new xu.ErrInvalidTokenIdentifier("Invalid extended token identifier provided")}checkLengthOfRandomSequence(e){if(e.length!==6)throw new xu.ErrInvalidTokenIdentifier("The identifier is not valid. The random sequence does not have the right length")}ensureTokenTickerValidity(e){if(e.length<3||e.length>10)throw new xu.ErrInvalidTokenIdentifier("The token ticker should be between 3 and 10 characters");if(!e.match(/^[a-zA-Z0-9]+$/))throw new xu.ErrInvalidTokenIdentifier("The token ticker should only contain alphanumeric characters");if(e!=e.toUpperCase())throw new xu.ErrInvalidTokenIdentifier("The token ticker should be upper case")}};On.TokenComputer=Av;function gH(t){return t.readUIntBE(0,t.length)}var Ev=class extends kd{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};On.TokenPayment=Ev});var yr=D(me=>{"use strict";h();Object.defineProperty(me,"__esModule",{value:!0});me.ESDT_CONTRACT_ADDRESS=me.DELEGATION_MANAGER_SC_ADDRESS=me.CONTRACT_DEPLOY_ADDRESS=me.BECH32_ADDRESS_LENGTH=me.DEFAULT_HRP=me.UNKNOWN_SIGNER=me.SDK_JS_SIGNER=me.METACHAIN_ID=me.WasmVirtualMachine=me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=me.HEX_TRANSACTION_HASH_LENGTH=me.MESSAGE_PREFIX=me.DEFAULT_MESSAGE_VERSION=me.ESDT_CONTRACT_ADDRESS_HEX=me.DELEGATION_MANAGER_SC_ADDRESS_HEX=me.CONTRACT_DEPLOY_ADDRESS_HEX=me.VM_TYPE_WASM_VM=me.ARGUMENTS_SEPARATOR=me.ESDT_TRANSFER_VALUE=me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_GAS_LIMIT=me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=me.TRANSACTION_VERSION_DEFAULT=me.TRANSACTION_OPTIONS_TX_GUARDED=me.TRANSACTION_OPTIONS_TX_HASH_SIGN=me.TRANSACTION_OPTIONS_DEFAULT=me.TRANSACTION_MIN_GAS_PRICE=void 0;me.TRANSACTION_MIN_GAS_PRICE=1e9;me.TRANSACTION_OPTIONS_DEFAULT=0;me.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;me.TRANSACTION_OPTIONS_TX_GUARDED=2;me.TRANSACTION_VERSION_DEFAULT=2;me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=2;me.ESDT_TRANSFER_GAS_LIMIT=5e5;me.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";me.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";me.ESDT_TRANSFER_VALUE="0";me.ARGUMENTS_SEPARATOR="@";me.VM_TYPE_WASM_VM=new Uint8Array([5,0]);me.CONTRACT_DEPLOY_ADDRESS_HEX="0000000000000000000000000000000000000000000000000000000000000000";me.DELEGATION_MANAGER_SC_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000004ffff";me.ESDT_CONTRACT_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000002ffff";me.DEFAULT_MESSAGE_VERSION=1;me.MESSAGE_PREFIX=`Elrond Signed Message: -`;me.HEX_TRANSACTION_HASH_LENGTH=64;me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=3;me.WasmVirtualMachine="0500";me.METACHAIN_ID=4294967295;me.SDK_JS_SIGNER="sdk-js";me.UNKNOWN_SIGNER="unknown";me.DEFAULT_HRP="erd";me.BECH32_ADDRESS_LENGTH=62;me.CONTRACT_DEPLOY_ADDRESS="erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu";me.DELEGATION_MANAGER_SC_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqylllslmq6y6";me.ESDT_CONTRACT_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"});var so=D(Ta=>{"use strict";h();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.Logger=Ta.LogLevel=void 0;var _a;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(_a=Ta.LogLevel||(Ta.LogLevel={}));var Hd=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=_a.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=_a.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=_a.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=_a.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=_a.Error||console.error(e,r)}};Ta.Logger=Hd;Hd.logLevel=_a.Debug});var Jl=D(Dn=>{"use strict";h();var pH=Dn&&Dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mH=Dn&&Dn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yH=Dn&&Dn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pH(e,t,r);return mH(e,t),e};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.TransactionOptions=Dn.TransactionVersion=void 0;var yi=yr(),z3=yH(Ie()),bv=class t{constructor(e){if(e=Number(e),e<1)throw new z3.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(yi.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(yi.TRANSACTION_VERSION_DEFAULT)}valueOf(){return this.value}};Dn.TransactionVersion=bv;var Sv=class t{constructor(e){if(e=Number(e),e<0)throw new z3.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(yi.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=yi.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=yi.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&yi.TRANSACTION_OPTIONS_TX_HASH_SIGN)==yi.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&yi.TRANSACTION_OPTIONS_TX_GUARDED)==yi.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=yi.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=yi.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dn.TransactionOptions=Sv});var _v=D((Lpe,W3)=>{"use strict";h();var jd="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Iv={};for(Xl=0;Xl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Q3(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Ou(e)^n>>5}for(e=Ou(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=Q3(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Ou(n)^o,i+=jd.charAt(o)}for(s=0;s<6;++s)n=Ou(n);for(n^=1,s=0;s<6;++s){var u=n>>(5-s)*5&31;i+=jd.charAt(u)}return i}function K3(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var u=Q3(s);if(typeof u=="string")return u;for(var a=[],c=0;c=o.length)&&a.push(d)}return u!==1?"Invalid checksum for "+t:{prefix:s,words:a}}function vH(){var t=K3.apply(null,arguments);if(typeof t=="object")return t}function AH(t){var e=K3.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zd(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,u.push(i>>s&o);if(n)s>0&&u.push(i<=e)return"Excess padding";if(i<{"use strict";h();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.LibraryConfig=void 0;var Qd=class{};Kd.LibraryConfig=Qd;Qd.DefaultAddressHrp="erd"});var Du=D(Dt=>{"use strict";h();var _H=Dt&&Dt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TH=Dt&&Dt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CH=Dt&&Dt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_H(e,t,r);return TH(e,t),e},NH=Dt&&Dt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.addressToHex=Dt.bigIntToHex=Dt.byteArrayToHex=Dt.boolToHex=Dt.utf8ToHex=Dt.zeroPadStringIfOddLength=Dt.isPaddedHex=Dt.numberToPaddedHex=void 0;var xH=NH((nr(),xe(hr))),OH=ke(),DH=CH(Pu());function PH(t){let e;typeof t=="bigint"||typeof t=="number"?e=t:e=new xH.default(t);let r=e.toString(16);return $d(r)}Dt.numberToPaddedHex=PH;function RH(t){t=t||"";let e=p.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Dt.isPaddedHex=RH;function $d(t){return t=t||"",t.length%2==1?"0"+t:t}Dt.zeroPadStringIfOddLength=$d;function $3(t){let e=p.Buffer.from(t).toString("hex");return $d(e)}Dt.utf8ToHex=$3;function BH(t){return $3(t.toString())}Dt.boolToHex=BH;function MH(t){let e=p.Buffer.from(t).toString("hex");return $d(e)}Dt.byteArrayToHex=MH;function LH(t){return t==0?"":DH.getHexMagnitudeOfBigInt(t)}Dt.bigIntToHex=LH;function FH(t){return OH.Address.fromBech32(t.toString()).pubkey().toString("hex")}Dt.addressToHex=FH});var Pu=D(ir=>{"use strict";h();var UH=ir&&ir.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ir,"__esModule",{value:!0});ir.prependByteToBuffer=ir.flipBufferBitsInPlace=ir.getHexMagnitudeOfBigInt=ir.bigIntToBuffer=ir.bufferToBigInt=ir.cloneBuffer=ir.isMsbZero=ir.isMsbOne=void 0;var Tv=UH((nr(),xe(hr))),qH=Du();function Y3(t,e=0){return t[e]>>7==1}ir.isMsbOne=Y3;function VH(t,e=0){return!Y3(t,e)}ir.isMsbZero=VH;function kH(t){let e=p.Buffer.alloc(t.length);return t.copy(e),e}ir.cloneBuffer=kH;function HH(t){let e=t.toString("hex");return new Tv.default(`0x${e}`,16)}ir.bufferToBigInt=HH;function GH(t){let e=J3(t);return p.Buffer.from(e,"hex")}ir.bigIntToBuffer=GH;function J3(t){return t=new Tv.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Tv.default(-1))),qH.numberToPaddedHex(t)):""}ir.getHexMagnitudeOfBigInt=J3;function jH(t){for(let e=0;e{"use strict";h();var QH=Lt&&Lt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KH=Lt&&Lt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X3=Lt&&Lt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QH(e,t,r);return KH(e,t),e},WH=Lt&&Lt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.bufferToHex=Lt.addressToHex=Lt.bigIntToHex=Lt.utf8ToHex=Lt.bigIntToBuffer=Lt.bufferToBigInt=Lt.stringToBuffer=void 0;var $H=WH((nr(),xe(hr))),Z3=X3(Pu()),YH=X3(Du());function JH(t){return p.Buffer.from(t)}Lt.stringToBuffer=JH;function XH(t){return t.length==0?new $H.default(0):Z3.bufferToBigInt(t)}Lt.bufferToBigInt=XH;function ZH(t){return t==0?p.Buffer.from([]):Z3.bigIntToBuffer(t)}Lt.bigIntToBuffer=ZH;var Cv=Du();Object.defineProperty(Lt,"utf8ToHex",{enumerable:!0,get:function(){return Cv.utf8ToHex}});Object.defineProperty(Lt,"bigIntToHex",{enumerable:!0,get:function(){return Cv.bigIntToHex}});Object.defineProperty(Lt,"addressToHex",{enumerable:!0,get:function(){return Cv.addressToHex}});function eG(t){let e=t.toString("hex");return YH.zeroPadStringIfOddLength(e)}Lt.bufferToHex=eG});var Os=D((Qpe,Nv)=>{"use strict";h();var Ru=typeof Reflect=="object"?Reflect:null,eN=Ru&&typeof Ru.apply=="function"?Ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jd;Ru&&typeof Ru.ownKeys=="function"?Jd=Ru.ownKeys:Object.getOwnPropertySymbols?Jd=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jd=function(e){return Object.getOwnPropertyNames(e)};function tG(t){console&&console.warn&&console.warn(t)}var rN=Number.isNaN||function(e){return e!==e};function Ct(){Ct.init.call(this)}Nv.exports=Ct;Nv.exports.once=sG;Ct.EventEmitter=Ct;Ct.prototype._events=void 0;Ct.prototype._eventsCount=0;Ct.prototype._maxListeners=void 0;var tN=10;function Xd(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ct,"defaultMaxListeners",{enumerable:!0,get:function(){return tN},set:function(t){if(typeof t!="number"||t<0||rN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");tN=t}});Ct.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};Ct.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||rN(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 nN(t){return t._maxListeners===void 0?Ct.defaultMaxListeners:t._maxListeners}Ct.prototype.getMaxListeners=function(){return nN(this)};Ct.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var a=s[e];if(a===void 0)return!1;if(typeof a=="function")eN(a,this,r);else for(var c=a.length,f=uN(a,c),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,tG(u)}return t}Ct.prototype.addListener=function(e,r){return iN(this,e,r,!1)};Ct.prototype.on=Ct.prototype.addListener;Ct.prototype.prependListener=function(e,r){return iN(this,e,r,!0)};function rG(){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 sN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=rG.bind(n);return i.listener=r,n.wrapFn=i,i}Ct.prototype.once=function(e,r){return Xd(r),this.on(e,sN(this,e,r)),this};Ct.prototype.prependOnceListener=function(e,r){return Xd(r),this.prependListener(e,sN(this,e,r)),this};Ct.prototype.removeListener=function(e,r){var n,i,s,o,u;if(Xd(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){u=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():nG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||r)}return this};Ct.prototype.off=Ct.prototype.removeListener;Ct.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function oN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?iG(i):uN(i,i.length)}Ct.prototype.listeners=function(e){return oN(this,e,!0)};Ct.prototype.rawListeners=function(e){return oN(this,e,!1)};Ct.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):aN.call(t,e)};Ct.prototype.listenerCount=aN;function aN(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ct.prototype.eventNames=function(){return this._eventsCount>0?Jd(this._events):[]};function uN(t,e){for(var r=new Array(e),n=0;n{h();lN.exports=Os().EventEmitter});var Ov=D(()=>{h()});var mN=D((Zpe,pN)=>{"use strict";h();function fN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function hN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return Zd.alloc(0);for(var n=Zd.allocUnsafe(r>>>0),i=this.head,s=0;i;)gG(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(u===o.length?s+=o:s+=o.slice(0,r),r-=u,r===0){u===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(u));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=Zd.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,u=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,u),r-=u,r===0){u===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(u));break}++s}return this.length-=s,n}},{key:dG,value:function(r,n){return Dv(this,hN(hN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var Rv=D((t0e,wN)=>{"use strict";h();function pG(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,S.default.nextTick(Pv,this,t)):S.default.nextTick(Pv,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?S.default.nextTick(eg,r):(r._writableState.errorEmitted=!0,S.default.nextTick(yN,r,s)):S.default.nextTick(yN,r,s):e?(S.default.nextTick(eg,r),e(s)):S.default.nextTick(eg,r)}),this)}function yN(t,e){Pv(t,e),eg(t)}function eg(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function mG(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Pv(t,e){t.emit("error",e)}function yG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}wN.exports={destroy:pG,undestroy:mG,errorOrDestroy:yG}});var Ca=D((n0e,EN)=>{"use strict";h();function wG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var AN={};function Pn(t,e,r){r||(r=Error);function n(s,o,u){return typeof e=="string"?e:e(s,o,u)}var i=function(s){wG(o,s);function o(u,a,c){return s.call(this,n(u,a,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,AN[t]=i}function vN(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function vG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function AG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function EG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Pn("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Pn("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&vG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(AG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(vN(e,"type"));else{var s=EG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(vN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Pn("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Pn("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Pn("ERR_STREAM_PREMATURE_CLOSE","Premature close");Pn("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Pn("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Pn("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Pn("ERR_STREAM_WRITE_AFTER_END","write after end");Pn("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Pn("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Pn("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");EN.exports.codes=AN});var Bv=D((s0e,bN)=>{"use strict";h();var bG=Ca().codes.ERR_INVALID_OPT_VALUE;function SG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function IG(t,e,r,n){var i=SG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new bG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}bN.exports={getHighWaterMark:IG}});var Bu=D((a0e,Mv)=>{h();typeof Object.create=="function"?Mv.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mv.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var IN=D((c0e,SN)=>{h();SN.exports=_G;function _G(t,e){if(Lv("noDeprecation"))return t;var r=!1;function n(){if(!r){if(Lv("throwDeprecation"))throw new Error(e);Lv("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function Lv(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var qv=D((f0e,ON)=>{"use strict";h();ON.exports=Gt;function TN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){XG(e,t)}}var Mu;Gt.WritableState=ef;var TG={deprecate:IN()},CN=xv(),rg=no().Buffer,CG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function NG(t){return rg.from(t)}function xG(t){return rg.isBuffer(t)||t instanceof CG}var Uv=Rv(),OG=Bv(),DG=OG.getHighWaterMark,oo=Ca().codes,PG=oo.ERR_INVALID_ARG_TYPE,RG=oo.ERR_METHOD_NOT_IMPLEMENTED,BG=oo.ERR_MULTIPLE_CALLBACK,MG=oo.ERR_STREAM_CANNOT_PIPE,LG=oo.ERR_STREAM_DESTROYED,FG=oo.ERR_STREAM_NULL_VALUES,UG=oo.ERR_STREAM_WRITE_AFTER_END,qG=oo.ERR_UNKNOWN_ENCODING,Lu=Uv.errorOrDestroy;Bu()(Gt,CN);function VG(){}function ef(t,e,r){Mu=Mu||Na(),t=t||{},typeof r!="boolean"&&(r=e instanceof Mu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=DG(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){KG(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new TN(this)}ef.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(ef.prototype,"buffer",{get:TG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var tg;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(tg=Function.prototype[Symbol.hasInstance],Object.defineProperty(Gt,Symbol.hasInstance,{value:function(e){return tg.call(this,e)?!0:this!==Gt?!1:e&&e._writableState instanceof ef}})):tg=function(e){return e instanceof this};function Gt(t){Mu=Mu||Na();var e=this instanceof Mu;if(!e&&!tg.call(Gt,this))return new Gt(t);this._writableState=new ef(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),CN.call(this)}Gt.prototype.pipe=function(){Lu(this,new MG)};function kG(t,e){var r=new UG;Lu(t,r),S.default.nextTick(e,r)}function HG(t,e,r,n){var i;return r===null?i=new FG:typeof r!="string"&&!e.objectMode&&(i=new PG("chunk",["string","Buffer"],r)),i?(Lu(t,i),S.default.nextTick(n,i),!1):!0}Gt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&xG(t);return s&&!rg.isBuffer(t)&&(t=NG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=VG),n.ending?kG(this,r):(s||HG(this,n,t,r))&&(n.pendingcb++,i=jG(this,n,s,t,e,r)),i};Gt.prototype.cork=function(){this._writableState.corked++};Gt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&NN(this,t))};Gt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new qG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function GG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=rg.from(e,r)),e}Object.defineProperty(Gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function jG(t,e,r,n,i,s){if(!r){var o=GG(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var u=e.objectMode?1:n.length;e.length+=u;var a=e.length{"use strict";h();var ZG=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};PN.exports=Vi;var DN=Hv(),kv=qv();Bu()(Vi,DN);for(Vv=ZG(kv.prototype),ng=0;ng{h();var sg=no(),ki=sg.Buffer;function RN(t,e){for(var r in t)e[r]=t[r]}ki.from&&ki.alloc&&ki.allocUnsafe&&ki.allocUnsafeSlow?BN.exports=sg:(RN(sg,Gv),Gv.Buffer=xa);function xa(t,e,r){return ki(t,e,r)}xa.prototype=Object.create(ki.prototype);RN(ki,xa);xa.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ki(t,e,r)};xa.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ki(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};xa.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ki(t)};xa.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return sg.SlowBuffer(t)}});var Qv=D(FN=>{"use strict";h();var zv=MN().Buffer,LN=zv.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function rj(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function nj(t){var e=rj(t);if(typeof e!="string"&&(zv.isEncoding===LN||!LN(t)))throw new Error("Unknown encoding: "+t);return e||t}FN.StringDecoder=tf;function tf(t){this.encoding=nj(t);var e;switch(this.encoding){case"utf16le":this.text=cj,this.end=lj,e=4;break;case"utf8":this.fillLast=oj,e=4;break;case"base64":this.text=fj,this.end=hj,e=3;break;default:this.write=dj,this.end=gj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=zv.allocUnsafe(e)}tf.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function ij(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function sj(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function oj(t){var e=this.lastTotal-this.lastNeed,r=sj(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function aj(t,e){var r=ij(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function uj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function cj(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function lj(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function fj(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function hj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function dj(t){return t.toString(this.encoding)}function gj(t){return t&&t.length?this.write(t):""}});var og=D((w0e,VN)=>{"use strict";h();var UN=Ca().codes.ERR_STREAM_PREMATURE_CLOSE;function pj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";h();var ag;function ao(t,e,r){return e=wj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wj(t){var e=vj(t,"string");return typeof e=="symbol"?e:String(e)}function vj(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Aj=og(),uo=Symbol("lastResolve"),Oa=Symbol("lastReject"),rf=Symbol("error"),ug=Symbol("ended"),Da=Symbol("lastPromise"),Kv=Symbol("handlePromise"),Pa=Symbol("stream");function co(t,e){return{value:t,done:e}}function Ej(t){var e=t[uo];if(e!==null){var r=t[Pa].read();r!==null&&(t[Da]=null,t[uo]=null,t[Oa]=null,e(co(r,!1)))}}function bj(t){S.default.nextTick(Ej,t)}function Sj(t,e){return function(r,n){t.then(function(){if(e[ug]){r(co(void 0,!0));return}e[Kv](r,n)},n)}}var Ij=Object.getPrototypeOf(function(){}),_j=Object.setPrototypeOf((ag={get stream(){return this[Pa]},next:function(){var e=this,r=this[rf];if(r!==null)return Promise.reject(r);if(this[ug])return Promise.resolve(co(void 0,!0));if(this[Pa].destroyed)return new Promise(function(o,u){S.default.nextTick(function(){e[rf]?u(e[rf]):o(co(void 0,!0))})});var n=this[Da],i;if(n)i=new Promise(Sj(n,this));else{var s=this[Pa].read();if(s!==null)return Promise.resolve(co(s,!1));i=new Promise(this[Kv])}return this[Da]=i,i}},ao(ag,Symbol.asyncIterator,function(){return this}),ao(ag,"return",function(){var e=this;return new Promise(function(r,n){e[Pa].destroy(null,function(i){if(i){n(i);return}r(co(void 0,!0))})})}),ag),Ij),Tj=function(e){var r,n=Object.create(_j,(r={},ao(r,Pa,{value:e,writable:!0}),ao(r,uo,{value:null,writable:!0}),ao(r,Oa,{value:null,writable:!0}),ao(r,rf,{value:null,writable:!0}),ao(r,ug,{value:e._readableState.endEmitted,writable:!0}),ao(r,Kv,{value:function(s,o){var u=n[Pa].read();u?(n[Da]=null,n[uo]=null,n[Oa]=null,s(co(u,!1))):(n[uo]=s,n[Oa]=o)},writable:!0}),r));return n[Da]=null,Aj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Oa];s!==null&&(n[Da]=null,n[uo]=null,n[Oa]=null,s(i)),n[rf]=i;return}var o=n[uo];o!==null&&(n[Da]=null,n[uo]=null,n[Oa]=null,o(co(void 0,!0))),n[ug]=!0}),e.on("readable",bj.bind(null,n)),n};kN.exports=Tj});var jN=D((b0e,GN)=>{h();GN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Hv=D((_0e,ex)=>{"use strict";h();ex.exports=Fe;var Fu;Fe.ReadableState=WN;var I0e=Os().EventEmitter,KN=function(e,r){return e.listeners(r).length},sf=xv(),cg=no().Buffer,Cj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Nj(t){return cg.from(t)}function xj(t){return cg.isBuffer(t)||t instanceof Cj}var Wv=Ov(),Ce;Wv&&Wv.debuglog?Ce=Wv.debuglog("stream"):Ce=function(){};var Oj=mN(),tA=Rv(),Dj=Bv(),Pj=Dj.getHighWaterMark,lg=Ca().codes,Rj=lg.ERR_INVALID_ARG_TYPE,Bj=lg.ERR_STREAM_PUSH_AFTER_EOF,Mj=lg.ERR_METHOD_NOT_IMPLEMENTED,Lj=lg.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Uu,$v,Yv;Bu()(Fe,sf);var nf=tA.errorOrDestroy,Jv=["error","close","destroy","pause","resume"];function Fj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function WN(t,e,r){Fu=Fu||Na(),t=t||{},typeof r!="boolean"&&(r=e instanceof Fu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Pj(this,t,"readableHighWaterMark",r),this.buffer=new Oj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Uu||(Uu=Qv().StringDecoder),this.decoder=new Uu(t.encoding),this.encoding=t.encoding)}function Fe(t){if(Fu=Fu||Na(),!(this instanceof Fe))return new Fe(t);var e=this instanceof Fu;this._readableState=new WN(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),sf.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=tA.destroy;Fe.prototype._undestroy=tA.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=cg.from(t,e),e=""),n=!0),$N(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return $N(this,t,null,!0,!1)};function $N(t,e,r,n,i){Ce("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Vj(t,s);else{var o;if(i||(o=Uj(s,e)),o)nf(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==cg.prototype&&(e=Nj(e)),n)s.endEmitted?nf(t,new Lj):Xv(t,s,e,!0);else if(s.ended)nf(t,new Bj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?Xv(t,s,e,!1):eA(t,s)):Xv(t,s,e,!1)}else n||(s.reading=!1,eA(t,s))}return!s.ended&&(s.length=zN?t=zN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function QN(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=qj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){Ce("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Ce("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Zv(this):fg(this),null;if(t=QN(t,e),t===0&&e.ended)return e.length===0&&Zv(this),null;var n=e.needReadable;Ce("need readable",n),(e.length===0||e.length-t0?i=XN(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Zv(this)),i!==null&&this.emit("data",i),i};function Vj(t,e){if(Ce("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?fg(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,YN(t)))}}function fg(t){var e=t._readableState;Ce("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ce("emitReadable",e.flowing),e.emittedReadable=!0,S.default.nextTick(YN,t))}function YN(t){var e=t._readableState;Ce("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,rA(t)}function eA(t,e){e.readingMore||(e.readingMore=!0,S.default.nextTick(kj,t,e))}function kj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&ZN(n.pipes,t)!==-1)&&!c&&(Ce("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function w(P){Ce("onerror",P),N(),t.removeListener("error",w),KN(t,"error")===0&&nf(t,P)}Fj(t,"error",w);function A(){t.removeListener("finish",_),N()}t.once("close",A);function _(){Ce("onfinish"),t.removeListener("close",A),N()}t.once("finish",_);function N(){Ce("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ce("pipe resume"),r.resume()),t};function Hj(t){return function(){var r=t._readableState;Ce("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&KN(t,"data")&&(r.flowing=!0,rA(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Ce("on readable",n.length,n.reading),n.length?fg(this):n.reading||S.default.nextTick(Gj,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=sf.prototype.removeListener.call(this,t,e);return t==="readable"&&S.default.nextTick(JN,this),r};Fe.prototype.removeAllListeners=function(t){var e=sf.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&S.default.nextTick(JN,this),e};function JN(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function Gj(t){Ce("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ce("resume"),t.flowing=!t.readableListening,jj(this,t)),t.paused=!1,this};function jj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,S.default.nextTick(zj,t,e))}function zj(t,e){Ce("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),rA(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return Ce("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ce("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function rA(t){var e=t._readableState;for(Ce("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ce("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(Ce("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var u=e.push(o);u||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(u){return function(){return t[u].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Zv(t){var e=t._readableState;Ce("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,S.default.nextTick(Qj,e,t))}function Qj(t,e){if(Ce("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return Yv===void 0&&(Yv=jN()),Yv(Fe,t,e)});function ZN(t,e){for(var r=0,n=t.length;r{"use strict";h();rx.exports=Ds;var hg=Ca().codes,Kj=hg.ERR_METHOD_NOT_IMPLEMENTED,Wj=hg.ERR_MULTIPLE_CALLBACK,$j=hg.ERR_TRANSFORM_ALREADY_TRANSFORMING,Yj=hg.ERR_TRANSFORM_WITH_LENGTH_0,dg=Na();Bu()(Ds,dg);function Jj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Wj);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";h();ix.exports=of;var nx=nA();Bu()(of,nx);function of(t){if(!(this instanceof of))return new of(t);nx.call(this,t)}of.prototype._transform=function(t,e,r){r(null,t)}});var lx=D((D0e,cx)=>{"use strict";h();var iA;function Zj(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var ux=Ca().codes,ez=ux.ERR_MISSING_ARGS,tz=ux.ERR_STREAM_DESTROYED;function ox(t){if(t)throw t}function rz(t){return t.setHeader&&typeof t.abort=="function"}function nz(t,e,r,n){n=Zj(n);var i=!1;t.on("close",function(){i=!0}),iA===void 0&&(iA=og()),iA(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,rz(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new tz("pipe"))}}}function ax(t){t()}function iz(t,e){return t.pipe(e)}function sz(t){return!t.length||typeof t[t.length-1]!="function"?ox:t.pop()}function oz(){for(var t=arguments.length,e=new Array(t),r=0;r0;return nz(o,a,c,function(f){i||(i=f),f&&s.forEach(ax),!a&&(s.forEach(ax),n(i))})});return e.reduce(iz)}cx.exports=oz});var sA=D((Rn,fx)=>{h();Rn=fx.exports=Hv();Rn.Stream=Rn;Rn.Readable=Rn;Rn.Writable=qv();Rn.Duplex=Na();Rn.Transform=nA();Rn.PassThrough=sx();Rn.finished=og();Rn.pipeline=lx()});var gx=D((B0e,dx)=>{h();var{Transform:az}=sA();dx.exports=t=>class hx extends az{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!p.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return p.Buffer.isBuffer(r)||(r=p.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new hx(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var yx=D((L0e,mx)=>{h();var{Transform:uz}=sA();mx.exports=t=>class px extends uz{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!p.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return p.Buffer.isBuffer(r)||(r=p.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new px(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var vx=D((U0e,wx)=>{h();var cz=gx(),lz=yx();wx.exports=function(t){let e=cz(t),r=lz(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var bx=D(Ex=>{h();var Ax=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Ex.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],a=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],w=f^(i<<1|s>>>31),A=d^(s<<1|i>>>31),_=t[0]^w,N=t[1]^A,P=t[10]^w,V=t[11]^A,U=t[20]^w,Q=t[21]^A,L=t[30]^w,k=t[31]^A,H=t[40]^w,q=t[41]^A;w=r^(o<<1|u>>>31),A=n^(u<<1|o>>>31);let v=t[2]^w,C=t[3]^A,R=t[12]^w,F=t[13]^A,B=t[22]^w,l=t[23]^A,g=t[32]^w,y=t[33]^A,E=t[42]^w,I=t[43]^A;w=i^(a<<1|c>>>31),A=s^(c<<1|a>>>31);let T=t[4]^w,M=t[5]^A,x=t[14]^w,m=t[15]^A,O=t[24]^w,Y=t[25]^A,$=t[34]^w,b=t[35]^A,j=t[44]^w,z=t[45]^A;w=o^(f<<1|d>>>31),A=u^(d<<1|f>>>31);let W=t[6]^w,ie=t[7]^A,te=t[16]^w,ee=t[17]^A,se=t[26]^w,oe=t[27]^A,J=t[36]^w,ue=t[37]^A,vt=t[46]^w,At=t[47]^A;w=a^(r<<1|n>>>31),A=c^(n<<1|r>>>31);let Pi=t[8]^w,Et=t[9]^A,bt=t[18]^w,Ri=t[19]^A,St=t[28]^w,It=t[29]^A,Bi=t[38]^w,_t=t[39]^A,Tt=t[48]^w,Mi=t[49]^A,Ke=_,We=N,si=V<<4|P>>>28,$e=P<<4|V>>>28,Ye=U<<3|Q>>>29,oi=Q<<3|U>>>29,Je=k<<9|L>>>23,Xe=L<<9|k>>>23,ai=H<<18|q>>>14,Ze=q<<18|H>>>14,et=v<<1|C>>>31,ui=C<<1|v>>>31,tt=F<<12|R>>>20,rt=R<<12|F>>>20,ci=B<<10|l>>>22,nt=l<<10|B>>>22,it=y<<13|g>>>19,li=g<<13|y>>>19,st=E<<2|I>>>30,ot=I<<2|E>>>30,fi=M<<30|T>>>2,at=T<<30|M>>>2,ut=x<<6|m>>>26,hi=m<<6|x>>>26,ct=Y<<11|O>>>21,lt=O<<11|Y>>>21,di=$<<15|b>>>17,ft=b<<15|$>>>17,ht=z<<29|j>>>3,gi=j<<29|z>>>3,dt=W<<28|ie>>>4,gt=ie<<28|W>>>4,pi=ee<<23|te>>>9,pt=te<<23|ee>>>9,mt=se<<25|oe>>>7,An=oe<<25|se>>>7,En=J<<21|ue>>>11,bn=ue<<21|J>>>11,Sn=At<<24|vt>>>8,In=vt<<24|At>>>8,_n=Pi<<27|Et>>>5,la=Et<<27|Pi>>>5,fa=bt<<20|Ri>>>12,ha=Ri<<20|bt>>>12,da=It<<7|St>>>25,ga=St<<7|It>>>25,pa=Bi<<8|_t>>>24,ma=_t<<8|Bi>>>24,ya=Tt<<14|Mi>>>18,wa=Mi<<14|Tt>>>18;t[0]=Ke^~tt&ct,t[1]=We^~rt<,t[10]=dt^~fa&Ye,t[11]=gt^~ha&oi,t[20]=et^~ut&mt,t[21]=ui^~hi&An,t[30]=_n^~si&ci,t[31]=la^~$e&nt,t[40]=fi^~pi&da,t[41]=at^~pt&ga,t[2]=tt^~ct&En,t[3]=rt^~lt&bn,t[12]=fa^~Ye&it,t[13]=ha^~oi&li,t[22]=ut^~mt&pa,t[23]=hi^~An&ma,t[32]=si^~ci&di,t[33]=$e^~nt&ft,t[42]=pi^~da&Je,t[43]=pt^~ga&Xe,t[4]=ct^~En&ya,t[5]=lt^~bn&wa,t[14]=Ye^~it&ht,t[15]=oi^~li&gi,t[24]=mt^~pa&ai,t[25]=An^~ma&Ze,t[34]=ci^~di&Sn,t[35]=nt^~ft&In,t[44]=da^~Je&st,t[45]=ga^~Xe&ot,t[6]=En^~ya&Ke,t[7]=bn^~wa&We,t[16]=it^~ht&dt,t[17]=li^~gi>,t[26]=pa^~ai&et,t[27]=ma^~Ze&ui,t[36]=di^~Sn&_n,t[37]=ft^~In&la,t[46]=Je^~st&fi,t[47]=Xe^~ot&at,t[8]=ya^~Ke&tt,t[9]=wa^~We&rt,t[18]=ht^~dt&fa,t[19]=gi^~gt&ha,t[28]=ai^~et&ut,t[29]=Ze^~ui&hi,t[38]=Sn^~_n&si,t[39]=In^~la&$e,t[48]=st^~fi&pi,t[49]=ot^~at&pt,t[0]^=Ax[e*2],t[1]^=Ax[e*2+1]}}});var Ix=D((H0e,Sx)=>{h();var gg=bx();function qu(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}qu.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};qu.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(gg.p1600(this.state),this.count=0);return e};qu.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};Sx.exports=qu});var af=D((j0e,_x)=>{h();_x.exports=vx()(Ix())});var ke=D($r=>{"use strict";h();var fz=$r&&$r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hz=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tx=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fz(e,t,r);return hz(e,t),e},dz=$r&&$r.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($r,"__esModule",{value:!0});$r.AddressComputer=$r.Address=void 0;var Vu=Tx(_v()),gz=dz((nr(),xe(hr))),ku=Wd(),oA=yr(),Ra=Tx(Ie()),pz=Yd(),mz=af(),aA=32,yz="0".repeat(16),pg=class t{constructor(e,r){if(!e){this.publicKey=p.Buffer.from([]),this.hrp=r||ku.LibraryConfig.DefaultAddressHrp;return}if(ArrayBuffer.isView(e)){if(e.length!=aA)throw new Ra.ErrAddressCannotCreate(e);this.publicKey=p.Buffer.from(e),this.hrp=r||ku.LibraryConfig.DefaultAddressHrp;return}if(e instanceof t){if(r)throw new Ra.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");this.publicKey=e.publicKey,this.hrp=e.hrp;return}if(typeof e=="string"){if(t.isValidHex(e)){this.publicKey=p.Buffer.from(e,"hex"),this.hrp=r||ku.LibraryConfig.DefaultAddressHrp;return}if(r)throw new Ra.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");let{hrp:n,pubkey:i}=uA({value:e,allowCustomHrp:!1});this.publicKey=i,this.hrp=n;return}throw new Ra.ErrAddressCannotCreate(e)}static newFromBech32(e){let{hrp:r,pubkey:n}=uA({value:e,allowCustomHrp:!0});return new t(n,r)}static fromBech32(e){let{hrp:r,pubkey:n}=uA({value:e,allowCustomHrp:!1});return new t(n,r)}static newFromHex(e,r){if(!t.isValidHex(e))throw new Ra.ErrAddressCannotCreate(e);return new t(p.Buffer.from(e,"hex"),r)}static fromHex(e,r){return t.newFromHex(e,r)}static fromAddress(e){return new t(e)}static fromBuffer(e,r){return new t(e,r)}static fromString(e,r){return new t(e,r)}static isValidHex(e){return p.Buffer.from(e,"hex").length==aA}static empty(){return new t("")}static isValid(e){let r=Vu.decodeUnsafe(e),n=r?.prefix,i=r?p.Buffer.from(Vu.fromWords(r.words)):void 0;return!(n!==ku.LibraryConfig.DefaultAddressHrp||i?.length!==aA)}hex(){return this.toHex()}toHex(){return this.isEmpty()?"":this.publicKey.toString("hex")}bech32(){return this.toBech32()}toBech32(){if(this.isEmpty())return"";let e=Vu.toWords(this.pubkey());return Vu.encode(this.hrp,e)}pubkey(){return this.getPublicKey()}getPublicKey(){return this.publicKey}getHrp(){return this.hrp}isEmpty(){return this.publicKey.length==0}equals(e){return e?this.publicKey.toString()==e.publicKey.toString():!1}toString(){return this.toBech32()}toJSON(){return{bech32:this.toBech32(),pubkey:this.toHex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.isSmartContract()}isSmartContract(){return this.toHex().startsWith(yz)}};$r.Address=pg;var cA=class{constructor(e){this.numberOfShardsWithoutMeta=e||oA.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META}computeContractAddress(e,r){let n=p.Buffer.alloc(8,0),i=e.getPublicKey(),s=i.slice(30),o=p.Buffer.alloc(8),u=new gz.default(r.toString()),a=pz.bigIntToBuffer(u);o.write(a.reverse().toString("hex"),"hex");let c=p.Buffer.concat([i,o]),f=mz("keccak256").update(c).digest(),d=p.Buffer.from(oA.WasmVirtualMachine,"hex"),w=p.Buffer.concat([n,d,f.slice(10,30),s]);return new pg(w)}getShardOfAddress(e){return this.getShardOfPubkey(e.getPublicKey(),this.numberOfShardsWithoutMeta)}getShardOfPubkey(e,r){let n=parseInt("11",2),i=parseInt("01",2),s=e[31];if(this.isPubkeyOfMetachain(e))return oA.METACHAIN_ID;let o=s&n;return o>r-1&&(o=s&i),o}isPubkeyOfMetachain(e){let r=p.Buffer.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=p.Buffer.from(e).slice(0,r.length);return!!(r.equals(n)||p.Buffer.alloc(32).equals(p.Buffer.from(e)))}};$r.AddressComputer=cA;function uA(t){let e=t.value,r=t.allowCustomHrp,n,i;try{let s=Vu.decode(e);n=s.prefix,i=p.Buffer.from(Vu.fromWords(s.words))}catch(s){throw new Ra.ErrAddressCannotCreate(e,s)}if(!r&&n!=ku.LibraryConfig.DefaultAddressHrp)throw new Ra.ErrAddressBadHrp(ku.LibraryConfig.DefaultAddressHrp,n);return{hrp:n,pubkey:i}}});var Bn=D(Ft=>{"use strict";h();var wz=Ft&&Ft.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vz=Ft&&Ft.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Az=Ft&&Ft.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wz(e,t,r);return vz(e,t),e};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.isEmpty=Ft.guardEmpty=Ft.guardNotEmpty=Ft.guardLength=Ft.guardSameLength=Ft.guardValueIsSetWithMessage=Ft.guardValueIsSet=Ft.guardTrue=void 0;var Hu=Az(Ie());function Ez(t,e){if(!t)throw new Hu.ErrInvariantFailed(`[<${e}>] isn't true`)}Ft.guardTrue=Ez;function bz(t,e){Cx(`${t} isn't set (null or undefined)`,e)}Ft.guardValueIsSet=bz;function Cx(t,e){if(e==null||e===void 0)throw new Hu.ErrInvariantFailed(t)}Ft.guardValueIsSetWithMessage=Cx;function Sz(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Hu.ErrInvariantFailed("arrays do not have the same length")}Ft.guardSameLength=Sz;function Iz(t,e){let r=t.length||0;if(r!=e)throw new Hu.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Ft.guardLength=Iz;function _z(t,e){if(lA(t))throw new Hu.ErrInvariantFailed(`${e} is empty`)}Ft.guardNotEmpty=_z;function Tz(t,e){if(!lA(t))throw new Hu.ErrInvariantFailed(`${e} is not empty`)}Ft.guardEmpty=Tz;function lA(t){return t.isEmpty?t.isEmpty():t.length===0}Ft.isEmpty=lA});var Nx=D(mg=>{"use strict";h();Object.defineProperty(mg,"__esModule",{value:!0});mg.TypeFormula=void 0;var fA=class{constructor(e,r){this.name=e,this.typeParameters=r}toString(){if(this.typeParameters.length>0){let e=this.typeParameters.map(r=>r.toString()).join(", ");return`${this.name}<${e}>`}else return this.name}};mg.TypeFormula=fA});var xx=D(yg=>{"use strict";h();Object.defineProperty(yg,"__esModule",{value:!0});yg.TypeFormulaParser=void 0;var uf=Nx(),Hi=class t{parseExpression(e){e=e.trim();let r=this.tokenizeExpression(e).filter(s=>s!==t.COMMA),n=[];for(let s of r)if(this.isPunctuation(s))if(this.isEndOfTypeParameters(s)){let o=this.acquireTypeWithParameters(n);n.push(o)}else if(this.isBeginningOfTypeParameters(s))n.push(s);else throw new Error(`Unexpected token (punctuation): ${s}`);else n.push(s);if(n.length!==1)throw new Error(`Unexpected stack length at end of parsing: ${n.length}`);if(t.PUNCTUATION.includes(n[0]))throw new Error("Unexpected root element.");let i=n[0];if(i instanceof uf.TypeFormula)return i;if(typeof i=="string")return new uf.TypeFormula(i,[]);throw new Error(`Unexpected item on stack: ${i}`)}tokenizeExpression(e){let r=[],n="";for(let i of e)this.isPunctuation(i)?(n&&(r.push(n.trim()),n=""),r.push(i)):n+=i;return n&&r.push(n.trim()),r}acquireTypeWithParameters(e){let r=this.acquireTypeParameters(e),n=e.pop();return new uf.TypeFormula(n,r.reverse())}acquireTypeParameters(e){let r=[];for(;;){let n=e.pop();if(n===void 0)throw new Error("Badly specified type parameters");if(this.isBeginningOfTypeParameters(n))break;if(n instanceof uf.TypeFormula)r.push(n);else if(typeof n=="string")r.push(new uf.TypeFormula(n,[]));else throw new Error(`Unexpected type parameter object in stack: ${n}`)}return r}isPunctuation(e){return t.PUNCTUATION.includes(e)}isEndOfTypeParameters(e){return e===t.END_TYPE_PARAMETERS}isBeginningOfTypeParameters(e){return e===t.BEGIN_TYPE_PARAMETERS}};yg.TypeFormulaParser=Hi;Hi.BEGIN_TYPE_PARAMETERS="<";Hi.END_TYPE_PARAMETERS=">";Hi.COMMA=",";Hi.PUNCTUATION=[Hi.COMMA,Hi.BEGIN_TYPE_PARAMETERS,Hi.END_TYPE_PARAMETERS]});var Ox=D(wg=>{"use strict";h();Object.defineProperty(wg,"__esModule",{value:!0});wg.getJavascriptPrototypesInHierarchy=void 0;function Cz(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}wg.getJavascriptPrototypesInHierarchy=Cz});var or=D(sr=>{"use strict";h();Object.defineProperty(sr,"__esModule",{value:!0});sr.NullType=sr.TypePlaceholder=sr.isTyped=sr.PrimitiveValue=sr.TypedValue=sr.CustomType=sr.PrimitiveType=sr.TypeCardinality=sr.Type=void 0;var hA=Ox(),Dx=Bn(),lo=class t{constructor(e,r=[],n=cf.fixed(1)){Dx.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return hA.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return Dx.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return hA.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};sr.Type=lo;lo.ClassName="Type";var cf=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};sr.TypeCardinality=cf;cf.MaxCardinality=4096;var vg=class t extends lo{constructor(e){super(e)}getClassName(){return t.ClassName}};sr.PrimitiveType=vg;vg.ClassName="PrimitiveType";var Ag=class t extends lo{getClassName(){return t.ClassName}};sr.CustomType=Ag;Ag.ClassName="CustomType";var lf=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return hA.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};sr.TypedValue=lf;lf.ClassName="TypedValue";var Eg=class t extends lf{constructor(e){super(e)}getClassName(){return t.ClassName}};sr.PrimitiveValue=Eg;Eg.ClassName="PrimitiveValue";function Nz(t){return t.belongsToTypesystem!==void 0}sr.isTyped=Nz;var bg=class t extends lo{constructor(){super("...")}getClassName(){return t.ClassName}};sr.TypePlaceholder=bg;bg.ClassName="TypePlaceholder";var Sg=class t extends lo{constructor(){super("?")}getClassName(){return t.ClassName}};sr.NullType=Sg;Sg.ClassName="NullType"});var ff=D(Ig=>{"use strict";h();Object.defineProperty(Ig,"__esModule",{value:!0});Ig.TypeExpressionParser=void 0;var xz=xx(),Oz=Ie(),Dz=or(),dA=class{constructor(){this.backingTypeFormulaParser=new xz.TypeFormulaParser}parse(e){try{return this.doParse(e)}catch(r){throw new Oz.ErrTypingSystem(`Failed to parse type expression: ${e}. Error: ${r}`)}}doParse(e){let r=this.backingTypeFormulaParser.parseExpression(e);return this.typeFormulaToType(r)}typeFormulaToType(e){let r=e.typeParameters.map(n=>this.typeFormulaToType(n));return new Dz.Type(e.name,r)}};Ig.TypeExpressionParser=dA});var pA=D(fo=>{"use strict";h();Object.defineProperty(fo,"__esModule",{value:!0});fo.EndpointParameterDefinition=fo.EndpointModifiers=fo.EndpointDefinition=void 0;var Pz=ff(),Px="?",Rz="N / A",gA=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?Px:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>hf.fromJSON(s)),n=e.outputs.map(s=>hf.fromJSON(s)),i=new _g(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};fo.EndpointDefinition=gA;var _g=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};fo.EndpointModifiers=_g;var hf=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Pz.TypeExpressionParser().parse(e.type);return new t(e.name||Px,e.description||Rz,r)}};fo.EndpointParameterDefinition=hf});var Gu=D(Yr=>{"use strict";h();var Bz=Yr&&Yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mz=Yr&&Yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lz=Yr&&Yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bz(e,t,r);return Mz(e,t),e};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.Fields=Yr.Field=Yr.FieldDefinition=void 0;var mA=Lz(Ie()),Fz=ff(),yA=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Fz.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};Yr.FieldDefinition=yA;var wA=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new mA.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new mA.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};Yr.Field=wA;var vA=class{static checkTyping(e,r){if(e.length!=r.length)throw new mA.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";h();Object.defineProperty(ho,"__esModule",{value:!0});ho.EnumValue=ho.EnumVariantDefinition=ho.EnumType=void 0;var Uz=Ie(),AA=Bn(),Tg=Gu(),Bx=or(),Rx=256,Cg=class t extends Bx.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>Ng.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>({...n,discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return AA.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return AA.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};ho.EnumType=Cg;Cg.ClassName="EnumType";var Ng=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],AA.guardTrue(rTg.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Tg.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ho.EnumVariantDefinition=Ng;var xg=class t extends Bx.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Tg.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Tg.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Uz.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};ho.EnumValue=xg;xg.ClassName="EnumValue"});var Lx=D(ju=>{"use strict";h();Object.defineProperty(ju,"__esModule",{value:!0});ju.EventTopicDefinition=ju.EventDefinition=void 0;var qz=ff(),Mx="?",EA=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?Mx:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>Og.fromJSON(n));return new t(e.identifier,r)}};ju.EventDefinition=EA;var Og=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new qz.TypeExpressionParser().parse(e.type);return new t({name:e.name||Mx,type:r,indexed:e.indexed})}};ju.EventTopicDefinition=Og});var Qu=D(zu=>{"use strict";h();Object.defineProperty(zu,"__esModule",{value:!0});zu.Struct=zu.StructType=void 0;var Vz=Ie(),Dg=Gu(),Fx=or(),Pg=class t extends Fx.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Dg.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Dg.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};zu.StructType=Pg;Pg.ClassName="StructType";var Rg=class t extends Fx.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Dg.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Vz.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return Dg.Fields.equals(r,n)}};zu.Struct=Rg;Rg.ClassName="Struct"});var Wu=D(Ku=>{"use strict";h();Object.defineProperty(Ku,"__esModule",{value:!0});Ku.AddressValue=Ku.AddressType=void 0;var kz=ke(),Ux=or(),gf=class t extends Ux.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Ku.AddressType=gf;gf.ClassName="AddressType";var Bg=class t extends Ux.PrimitiveValue{constructor(e){super(new gf),this.value=new kz.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ku.AddressValue=Bg;Bg.ClassName="AddressValue"});var Lg=D($u=>{"use strict";h();Object.defineProperty($u,"__esModule",{value:!0});$u.OptionalValue=$u.OptionalType=void 0;var Hz=Bn(),pf=or(),mf=class t extends pf.Type{constructor(e){super("Optional",[e],pf.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(pf.NullType.ClassName);return r||n}};$u.OptionalType=mf;mf.ClassName="OptionalType";var Mg=class t extends pf.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new mf(new pf.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return Hz.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};$u.OptionalValue=Mg;Mg.ClassName="OptionalValue"});var wf=D(Yu=>{"use strict";h();Object.defineProperty(Yu,"__esModule",{value:!0});Yu.BooleanValue=Yu.BooleanType=void 0;var qx=or(),yf=class t extends qx.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Yu.BooleanType=yf;yf.ClassName="BooleanType";var Fg=class t extends qx.PrimitiveValue{constructor(e){super(new yf),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Yu.BooleanValue=Fg;Fg.ClassName="BooleanValue"});var go=D(Ju=>{"use strict";h();Object.defineProperty(Ju,"__esModule",{value:!0});Ju.BytesValue=Ju.BytesType=void 0;var Vx=or(),vf=class t extends Vx.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Ju.BytesType=vf;vf.ClassName="BytesType";var Ug=class t extends Vx.PrimitiveValue{constructor(e){super(new vf),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=p.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=p.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ju.BytesValue=Ug;Ug.ClassName="BytesValue"});var Hx=D(Xu=>{"use strict";h();Object.defineProperty(Xu,"__esModule",{value:!0});Xu.CodeMetadataValue=Xu.CodeMetadataType=void 0;var kx=or(),qg=class extends kx.PrimitiveType{constructor(){super("CodeMetadata")}};Xu.CodeMetadataType=qg;var bA=class extends kx.PrimitiveValue{constructor(e){super(new qg),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Xu.CodeMetadataValue=bA});var kg=D(Zu=>{"use strict";h();Object.defineProperty(Zu,"__esModule",{value:!0});Zu.CompositeValue=Zu.CompositeType=void 0;var Gz=Bn(),SA=or(),Af=class t extends SA.Type{constructor(...e){super("Composite",e,SA.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Zu.CompositeType=Af;Af.ClassName="CompositeType";var Vg=class t extends SA.TypedValue{constructor(e,r){super(e),Gz.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Af(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.CollectionOfTypedValues=void 0;var IA=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.List=Gi.OptionValue=Gi.ListType=Gi.OptionType=void 0;var jz=Bn(),zz=_A(),Ma=or(),Ba=class t extends Ma.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Ma.NullType.ClassName);return r||n}};Gi.OptionType=Ba;Ba.ClassName="OptionType";var Ef=class t extends Ma.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};Gi.ListType=Ef;Ef.ClassName="ListType";var Gg=class t extends Ma.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Ba(new Ma.NullType);return new t(e)}static newMissingTyped(e){return new t(new Ba(e))}static newProvided(e){let r=new Ba(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return jz.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};Gi.OptionValue=Gg;Gg.ClassName="OptionValue";var jg=class t extends Ma.TypedValue{constructor(e,r){super(e),this.backingCollection=new zz.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Ma.TypePlaceholder,[]);let r=e[0].getType(),n=new Ef(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Gi.List=jg;jg.ClassName="List"});var Kg=D(ec=>{"use strict";h();Object.defineProperty(ec,"__esModule",{value:!0});ec.ArrayVec=ec.ArrayVecType=void 0;var Gx=Bn(),Qz=_A(),jx=or(),zg=class t extends jx.Type{constructor(e,r){super("Array",[r]),Gx.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};ec.ArrayVecType=zg;zg.ClassName="ArrayVecType";var Qg=class t extends jx.TypedValue{constructor(e,r){super(e),Gx.guardLength(r,e.length),this.backingCollection=new Qz.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ec.ArrayVec=Qg;Qg.ClassName="ArrayVec"});var If=D(tc=>{"use strict";h();Object.defineProperty(tc,"__esModule",{value:!0});tc.H256Value=tc.H256Type=void 0;var zx=or(),Sf=class t extends zx.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};tc.H256Type=Sf;Sf.ClassName="H256Type";var Wg=class t extends zx.PrimitiveValue{constructor(e){super(new Sf),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};tc.H256Value=Wg;Wg.ClassName="H256Value"});var Yg=D(rc=>{"use strict";h();Object.defineProperty(rc,"__esModule",{value:!0});rc.NothingValue=rc.NothingType=void 0;var Qx=or(),_f=class t extends Qx.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};rc.NothingType=_f;_f.ClassName="NothingType";var $g=class t extends Qx.PrimitiveValue{constructor(){super(new _f)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};rc.NothingValue=$g;$g.ClassName="NothingValue"});var Lf=D(Ee=>{"use strict";h();var Kz=Ee&&Ee.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wz=Ee&&Ee.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$z=Ee&&Ee.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kz(e,t,r);return Wz(e,t),e},Yz=Ee&&Ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.BigIntValue=Ee.BigUIntValue=Ee.I64Value=Ee.U64Value=Ee.I32Value=Ee.U32Value=Ee.I16Value=Ee.U16Value=Ee.I8Value=Ee.U8Value=Ee.NumericalValue=Ee.BigIntType=Ee.BigUIntType=Ee.I64Type=Ee.U64Type=Ee.I32Type=Ee.U32Type=Ee.I16Type=Ee.U16Type=Ee.I8Type=Ee.U8Type=Ee.NumericalType=void 0;var Jz=Yz((nr(),xe(hr))),Kx=$z(Ie()),Wx=or(),Jr=class t extends Wx.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ee.NumericalType=Jr;Jr.ClassName="NumericalType";var Tf=class t extends Jr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ee.U8Type=Tf;Tf.ClassName="U8Type";var Cf=class t extends Jr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ee.I8Type=Cf;Cf.ClassName="I8Type";var Nf=class t extends Jr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ee.U16Type=Nf;Nf.ClassName="U16Type";var xf=class t extends Jr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ee.I16Type=xf;xf.ClassName="I16Type";var Of=class t extends Jr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ee.U32Type=Of;Of.ClassName="U32Type";var Df=class t extends Jr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ee.I32Type=Df;Df.ClassName="I32Type";var Pf=class t extends Jr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ee.U64Type=Pf;Pf.ClassName="U64Type";var Rf=class t extends Jr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ee.I64Type=Rf;Rf.ClassName="I64Type";var Bf=class t extends Jr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ee.BigUIntType=Bf;Bf.ClassName="BigUIntType";var Mf=class t extends Jr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ee.BigIntType=Mf;Mf.ClassName="BigIntType";var Xr=class t extends Wx.PrimitiveValue{constructor(e,r){if(super(e),typeof r=="bigint"&&(r=r.toString()),this.value=new Jz.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new Kx.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new Kx.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ee.NumericalValue=Xr;Xr.ClassName="NumericalValue";var Jg=class t extends Xr{constructor(e){super(new Tf,e)}getClassName(){return t.ClassName}};Ee.U8Value=Jg;Jg.ClassName="U8Value";var Xg=class t extends Xr{constructor(e){super(new Cf,e)}getClassName(){return t.ClassName}};Ee.I8Value=Xg;Xg.ClassName="I8Value";var Zg=class t extends Xr{constructor(e){super(new Nf,e)}getClassName(){return t.ClassName}};Ee.U16Value=Zg;Zg.ClassName="U16Value";var ep=class t extends Xr{constructor(e){super(new xf,e)}getClassName(){return t.ClassName}};Ee.I16Value=ep;ep.ClassName="I16Value";var tp=class t extends Xr{constructor(e){super(new Of,e)}getClassName(){return t.ClassName}};Ee.U32Value=tp;tp.ClassName="U32Value";var rp=class t extends Xr{constructor(e){super(new Df,e)}getClassName(){return t.ClassName}};Ee.I32Value=rp;rp.ClassName="I32Value";var np=class t extends Xr{constructor(e){super(new Pf,e)}getClassName(){return t.ClassName}};Ee.U64Value=np;np.ClassName="U64Value";var ip=class t extends Xr{constructor(e){super(new Rf,e)}getClassName(){return t.ClassName}};Ee.I64Value=ip;ip.ClassName="I64Value";var sp=class t extends Xr{constructor(e){super(new Bf,e)}getClassName(){return t.ClassName}};Ee.BigUIntValue=sp;sp.ClassName="BigUIntValue";var op=class t extends Xr{constructor(e){super(new Mf,e)}getClassName(){return t.ClassName}};Ee.BigIntValue=op;op.ClassName="BigIntValue"});var up=D(nc=>{"use strict";h();Object.defineProperty(nc,"__esModule",{value:!0});nc.StringValue=nc.StringType=void 0;var $x=or(),Ff=class t extends $x.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};nc.StringType=Ff;Ff.ClassName="StringType";var ap=class t extends $x.PrimitiveValue{constructor(e){super(new Ff),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=p.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};nc.StringValue=ap;ap.ClassName="StringValue"});var sc=D(ic=>{"use strict";h();Object.defineProperty(ic,"__esModule",{value:!0});ic.TokenIdentifierValue=ic.TokenIdentifierType=void 0;var Yx=or(),Xz="EGLD",Uf=class t extends Yx.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};ic.TokenIdentifierType=Uf;Uf.ClassName="TokenIdentifierType";var cp=class t extends Yx.PrimitiveValue{constructor(e){super(new Uf),this.value=e}static egld(){return new t(Xz)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};ic.TokenIdentifierValue=cp;cp.ClassName="TokenIdentifierValue"});var fp=D(Mn=>{"use strict";h();var Zz=Mn&&Mn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eQ=Mn&&Mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tQ=Mn&&Mn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zz(e,t,r);return eQ(e,t),e};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.Tuple=Mn.TupleType=void 0;var rQ=tQ(Ie()),Jx=Gu(),Xx=Qu(),qf=class t extends Xx.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new Jx.FieldDefinition(Zx(i),"anonymous tuple field",n))}};Mn.TupleType=qf;qf.ClassName="TupleType";function Zx(t){return`field${t}`}var lp=class t extends Xx.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new rQ.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new qf(...r),i=e.map((s,o)=>new Jx.Field(s,Zx(o)));return new t(n,i)}};Mn.Tuple=lp;lp.ClassName="Tuple"});var gp=D(po=>{"use strict";h();Object.defineProperty(po,"__esModule",{value:!0});po.VariadicValue=po.CountedVariadicType=po.VariadicType=void 0;var oc=or(),La=class t extends oc.Type{constructor(e,r=!1){super("Variadic",[e],oc.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};po.VariadicType=La;La.ClassName="VariadicType";var hp=class extends oc.Type{constructor(e){super("Variadic",[e],oc.TypeCardinality.variable())}getClassName(){return La.ClassName}};po.CountedVariadicType=hp;hp.ClassName="VariadicType";var dp=class t extends oc.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new La(new oc.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new La(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();var nQ=zi&&zi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iQ=zi&&zi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sQ=zi&&zi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nQ(e,t,r);return iQ(e,t),e};Object.defineProperty(zi,"__esModule",{value:!0});zi.TypeMapper=void 0;var e6=sQ(Ie()),oQ=Wu(),TA=Lg(),aQ=wf(),uQ=go(),cQ=Hx(),pp=kg(),CA=df(),lQ=Gu(),t6=bf(),ji=Kg(),fQ=If(),r6=Yg(),Ln=Lf(),hQ=up(),n6=Qu(),i6=sc(),mo=fp(),mp=gp(),NA=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new t6.OptionType(r[0])],["List",(...r)=>new t6.ListType(r[0])],["VarArgs",(...r)=>new mp.VariadicType(r[0])],["MultiResultVec",(...r)=>new mp.VariadicType(r[0])],["variadic",(...r)=>new mp.VariadicType(r[0])],["counted-variadic",(...r)=>new mp.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new TA.OptionalType(r[0])],["optional",(...r)=>new TA.OptionalType(r[0])],["OptionalResult",(...r)=>new TA.OptionalType(r[0])],["multi",(...r)=>new pp.CompositeType(...r)],["MultiArg",(...r)=>new pp.CompositeType(...r)],["MultiResult",(...r)=>new pp.CompositeType(...r)],["multi",(...r)=>new pp.CompositeType(...r)],["tuple",(...r)=>new mo.TupleType(...r)],["tuple2",(...r)=>new mo.TupleType(...r)],["tuple3",(...r)=>new mo.TupleType(...r)],["tuple4",(...r)=>new mo.TupleType(...r)],["tuple5",(...r)=>new mo.TupleType(...r)],["tuple6",(...r)=>new mo.TupleType(...r)],["tuple7",(...r)=>new mo.TupleType(...r)],["tuple8",(...r)=>new mo.TupleType(...r)],["array2",(...r)=>new ji.ArrayVecType(2,r[0])],["array8",(...r)=>new ji.ArrayVecType(8,r[0])],["array16",(...r)=>new ji.ArrayVecType(16,r[0])],["array20",(...r)=>new ji.ArrayVecType(20,r[0])],["array32",(...r)=>new ji.ArrayVecType(32,r[0])],["array46",(...r)=>new ji.ArrayVecType(46,r[0])],["array48",(...r)=>new ji.ArrayVecType(48,r[0])],["array64",(...r)=>new ji.ArrayVecType(64,r[0])],["array128",(...r)=>new ji.ArrayVecType(128,r[0])],["array256",(...r)=>new ji.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Ln.U8Type],["u16",new Ln.U16Type],["u32",new Ln.U32Type],["u64",new Ln.U64Type],["U64",new Ln.U64Type],["BigUint",new Ln.BigUIntType],["i8",new Ln.I8Type],["i16",new Ln.I16Type],["i32",new Ln.I32Type],["i64",new Ln.I64Type],["Bigint",new Ln.BigIntType],["BigInt",new Ln.BigIntType],["bool",new aQ.BooleanType],["bytes",new uQ.BytesType],["Address",new oQ.AddressType],["H256",new fQ.H256Type],["utf-8 string",new hQ.StringType],["TokenIdentifier",new i6.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new i6.TokenIdentifierType],["CodeMetadata",new cQ.CodeMetadataType],["nothing",new r6.NothingType],["AsyncCall",new r6.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new e6.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(CA.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(n6.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new n6.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new CA.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new CA.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new lQ.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new e6.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};zi.TypeMapper=NA});var u6=D(Qi=>{"use strict";h();var dQ=Qi&&Qi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gQ=Qi&&Qi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pQ=Qi&&Qi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dQ(e,t,r);return gQ(e,t),e};Object.defineProperty(Qi,"__esModule",{value:!0});Qi.AbiRegistry=void 0;var s6=pQ(Ie()),Vf=Bn(),ac=pA(),o6=df(),DA=Lx(),a6=Qu(),mQ=xA(),yQ="?",PA=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.upgradeConstructorDefinition=e.upgradeConstructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||yQ,n=e.constructor||{},i=e.upgradeConstructor||{},s=e.endpoints||[],o=e.types||{},u=e.events||[],a=ac.EndpointDefinition.fromJSON({name:"constructor",...n}),c=ac.EndpointDefinition.fromJSON({name:"upgradeConstructor",...i}),f=s.map(N=>ac.EndpointDefinition.fromJSON(N)),d=[];for(let N in o){let P=o[N];if(P.type=="struct")d.push(a6.StructType.fromJSON({name:N,fields:P.fields}));else if(P.type=="enum"||P.type=="explicit-enum")d.push(o6.EnumType.fromJSON({name:N,variants:P.variants}));else throw new s6.ErrTypingSystem(`Cannot handle custom type: ${N}`)}let w=u.map(N=>DA.EventDefinition.fromJSON(N));return new t({name:r,constructorDefinition:a,upgradeConstructorDefinition:c,endpoints:f,customTypes:d,events:w}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Vf.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(a6.StructType.ClassName));return Vf.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(o6.EnumType.ClassName));return Vf.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Vf.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Vf.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new mQ.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new s6.ErrTypingSystem("Did not re-map all custom types");let n=OA(this.constructorDefinition,e),i=this.upgradeConstructorDefinition?OA(this.upgradeConstructorDefinition,e):void 0,s=[];for(let a of this.endpoints)s.push(OA(a,e));let o=this.events.map(a=>wQ(a,e));return new t({name:this.name,constructorDefinition:n,upgradeConstructorDefinition:i,endpoints:s,customTypes:r,events:o})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(u=>u.getName()==e.getName())>=0)return;for(let u of e.getNamesOfDependencies()){let a=r.find(c=>c.getName()==u);a&&this.mapCustomTypeDepthFirst(a,r,n,i)}let o=n.mapType(e);i.push(o)}};Qi.AbiRegistry=PA;function OA(t,e){let r=t.input.map(i=>new ac.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new ac.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new ac.EndpointDefinition(t.name,r,n,t.modifiers)}function wQ(t,e){let r=t.inputs.map(n=>new DA.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new DA.EventDefinition(t.identifier,r)}});var l6=D(uc=>{"use strict";h();Object.defineProperty(uc,"__esModule",{value:!0});uc.createListOfTokenIdentifiers=uc.createListOfAddresses=void 0;var vQ=Wu(),c6=bf(),AQ=sc();function EQ(t){let e=t.map(n=>new vQ.AddressValue(n));return c6.List.fromItems(e)}uc.createListOfAddresses=EQ;function bQ(t){let e=t.map(n=>new AQ.TokenIdentifierValue(n));return c6.List.fromItems(e)}uc.createListOfTokenIdentifiers=bQ});var I6=D(Pr=>{"use strict";h();var SQ=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IQ=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Q=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SQ(e,t,r);return IQ(e,t),e};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.onPrimitiveTypeSelect=Pr.onPrimitiveValueSelect=Pr.onTypedValueSelect=Pr.onTypeSelect=void 0;var wp=_Q(Ie()),f6=Wu(),h6=wf(),d6=go(),g6=df(),yp=bf(),p6=If(),m6=Lf(),y6=Yg(),w6=Qu(),v6=sc(),A6=fp(),E6=or(),b6=Kg(),S6=up();function TQ(t,e){if(t.hasExactClass(yp.OptionType.ClassName))return e.onOption();if(t.hasExactClass(yp.ListType.ClassName))return e.onList();if(t.hasExactClass(b6.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(E6.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(w6.StructType.ClassName))return e.onStruct();if(t.hasExactClass(A6.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(g6.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`type isn't known: ${t}`)}Pr.onTypeSelect=TQ;function CQ(t,e){if(t.hasClassOrSuperclass(E6.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(yp.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(yp.List.ClassName))return e.onList();if(t.hasExactClass(b6.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(w6.Struct.ClassName))return e.onStruct();if(t.hasExactClass(A6.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(g6.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`value isn't typed: ${t}`)}Pr.onTypedValueSelect=CQ;function NQ(t,e){if(t.hasExactClass(h6.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(m6.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(f6.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(d6.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(S6.StringValue.ClassName))return e.onString();if(t.hasExactClass(p6.H256Value.ClassName))return e.onH256();if(t.hasExactClass(v6.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(y6.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Pr.onPrimitiveValueSelect=NQ;function xQ(t,e){if(t.hasExactClass(h6.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(m6.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(f6.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(d6.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(S6.StringType.ClassName))return e.onString();if(t.hasExactClass(p6.H256Type.ClassName))return e.onH256();if(t.hasExactClass(v6.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(y6.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Pr.onPrimitiveTypeSelect=xQ});var $t=D(He=>{"use strict";h();var OQ=He&&He.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ut=He&&He.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OQ(e,t,r)};Object.defineProperty(He,"__esModule",{value:!0});Ut(u6(),He);Ut(Wu(),He);Ut(Lg(),He);Ut(wf(),He);Ut(go(),He);Ut(kg(),He);Ut(pA(),He);Ut(df(),He);Ut(l6(),He);Ut(Gu(),He);Ut(bf(),He);Ut(Kg(),He);Ut(If(),He);Ut(I6(),He);Ut(Yg(),He);Ut(Lf(),He);Ut(up(),He);Ut(Qu(),He);Ut(sc(),He);Ut(fp(),He);Ut(ff(),He);Ut(xA(),He);Ut(or(),He);Ut(gp(),He)});var T6=D(Ki=>{"use strict";h();var DQ=Ki&&Ki.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PQ=Ki&&Ki.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RQ=Ki&&Ki.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DQ(e,t,r);return PQ(e,t),e};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.OptionValueBinaryCodec=void 0;var _6=RQ(Ie()),vp=$t(),RA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[vp.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new _6.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[vp.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new vp.OptionValue(r);if(e[0]!=1)throw new _6.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new vp.OptionValue(r,n)}encodeNested(e){return e.isSet()?p.Buffer.concat([p.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):p.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?p.Buffer.concat([p.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):p.Buffer.from([])}};Ki.OptionValueBinaryCodec=RA});var C6=D(Ap=>{"use strict";h();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.AddressBinaryCodec=void 0;var BQ=ke(),MQ=$t(),BA=class{decodeNested(e){let r=e.slice(0,32),n=new BQ.Address(r);return[new MQ.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Ap.AddressBinaryCodec=BA});var x6=D(Wi=>{"use strict";h();var LQ=Wi&&Wi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FQ=Wi&&Wi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UQ=Wi&&Wi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LQ(e,t,r);return FQ(e,t),e};Object.defineProperty(Wi,"__esModule",{value:!0});Wi.BooleanBinaryCodec=void 0;var qQ=UQ(Ie()),N6=$t(),kf=class t{decodeNested(e){let r=e.readUInt8(0);return[new N6.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new qQ.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new N6.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?p.Buffer.from([t.TRUE]):p.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?p.Buffer.from([t.TRUE]):p.Buffer.from([])}};Wi.BooleanBinaryCodec=kf;kf.TRUE=1;kf.FALSE=0});var bp=D(Ep=>{"use strict";h();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.SizeOfU32=void 0;Ep.SizeOfU32=4});var D6=D(cc=>{"use strict";h();var VQ=cc&&cc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cc,"__esModule",{value:!0});cc.NumericalBinaryCodec=void 0;var Hf=VQ((nr(),xe(hr))),MA=$t(),O6=bp(),Yt=Pu(),LA=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=O6.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),u=i+n;return[o,u]}decodeTopLevel(e,r){let n=Yt.cloneBuffer(e);if(e.length==0)return new MA.NumericalValue(r,new Hf.default(0));if(!r.withSign||Yt.isMsbZero(n)){let c=Yt.bufferToBigInt(n);return new MA.NumericalValue(r,c)}Yt.flipBufferBitsInPlace(n);let a=Yt.bufferToBigInt(n).multipliedBy(new Hf.default(-1)).minus(new Hf.default(1));return new MA.NumericalValue(r,a)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=p.Buffer.alloc(O6.SizeOfU32);return n.writeUInt32BE(r.length),p.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return p.Buffer.alloc(r,0);if(!e.withSign){let o=Yt.bigIntToBuffer(e.value),u=p.Buffer.alloc(r-o.length,0);return p.Buffer.concat([u,o])}if(e.value.isPositive()){let o=Yt.bigIntToBuffer(e.value);Yt.isMsbOne(o)&&(o=Yt.prependByteToBuffer(o,0));let u=p.Buffer.alloc(r-o.length,0);return p.Buffer.concat([u,o])}let n=e.value.plus(new Hf.default(1)),i=Yt.bigIntToBuffer(n);Yt.flipBufferBitsInPlace(i),Yt.isMsbZero(i)&&(i=Yt.prependByteToBuffer(i,255));let s=p.Buffer.alloc(r-i.length,255);return p.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?p.Buffer.alloc(0):r?this.encodePrimitive(e):Yt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=Yt.bigIntToBuffer(e.value);return Yt.isMsbOne(i)&&(i=Yt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Hf.default(1)),n=Yt.bigIntToBuffer(r);return Yt.flipBufferBitsInPlace(n),Yt.isMsbZero(n)&&(n=Yt.prependByteToBuffer(n,255)),n}};cc.NumericalBinaryCodec=LA});var P6=D(Sp=>{"use strict";h();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.H256BinaryCodec=void 0;var kQ=If(),FA=class{decodeNested(e){let r=e.slice(0,32);return[new kQ.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Sp.H256BinaryCodec=FA});var Tp=D(_p=>{"use strict";h();Object.defineProperty(_p,"__esModule",{value:!0});_p.BytesBinaryCodec=void 0;var R6=go(),Ip=bp(),UA=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(Ip.SizeOfU32,Ip.SizeOfU32+r);return[new R6.BytesValue(n),Ip.SizeOfU32+r]}decodeTopLevel(e){return new R6.BytesValue(e)}encodeNested(e){let r=p.Buffer.alloc(Ip.SizeOfU32);return r.writeUInt32BE(e.getLength()),p.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};_p.BytesBinaryCodec=UA});var M6=D(Cp=>{"use strict";h();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.TokenIdentifierCodec=void 0;var HQ=go(),B6=sc(),GQ=Tp(),qA=class{constructor(){this.bytesCodec=new GQ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new B6.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new B6.TokenIdentifierValue(r.toString())}encodeNested(e){let r=HQ.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return p.Buffer.from(e.valueOf())}};Cp.TokenIdentifierCodec=qA});var F6=D(Np=>{"use strict";h();Object.defineProperty(Np,"__esModule",{value:!0});Np.NothingCodec=void 0;var L6=$t(),VA=class{decodeNested(){return[new L6.NothingValue,0]}decodeTopLevel(){return new L6.NothingValue}encodeNested(){return p.Buffer.from([])}encodeTopLevel(){return p.Buffer.from([])}};Np.NothingCodec=VA});var q6=D(xp=>{"use strict";h();Object.defineProperty(xp,"__esModule",{value:!0});xp.StringBinaryCodec=void 0;var U6=$t(),jQ=go(),zQ=Tp(),kA=class{constructor(){this.bytesBinaryCodec=new zQ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new U6.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new U6.StringValue(e.toString())}encodeNested(e){let r=jQ.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return p.Buffer.from(e.valueOf())}};xp.StringBinaryCodec=kA});var V6=D(Dp=>{"use strict";h();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.PrimitiveBinaryCodec=void 0;var Op=$t(),QQ=C6(),KQ=x6(),WQ=D6(),$Q=P6(),YQ=Tp(),JQ=M6(),XQ=F6(),ZQ=q6(),HA=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new KQ.BooleanBinaryCodec,this.numericalCodec=new WQ.NumericalBinaryCodec,this.addressCodec=new QQ.AddressBinaryCodec,this.h256Codec=new $Q.H256BinaryCodec,this.bytesCodec=new YQ.BytesBinaryCodec,this.stringCodec=new ZQ.StringBinaryCodec,this.tokenIdentifierCodec=new JQ.TokenIdentifierCodec,this.nothingCodec=new XQ.NothingCodec}decodeNested(e,r){return Op.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return Op.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return Op.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 Op.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()})}};Dp.PrimitiveBinaryCodec=HA});var G6=D(Pp=>{"use strict";h();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.ListBinaryCodec=void 0;var k6=$t(),H6=bp(),GA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,u=H6.SizeOfU32;e=o.slice(u);for(let a=0;a0;){let[u,a]=this.binaryCodec.decodeNested(e,n);i.push(u),o+=a,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new k6.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=p.Buffer.alloc(H6.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return p.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return p.Buffer.concat(r)}};Pp.ListBinaryCodec=GA});var zA=D(Rp=>{"use strict";h();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.FieldsBinaryCodec=void 0;var eK=$t(),jA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,u]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(u),i+=u;let a=new eK.Field(o,s.name);n.push(a)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return p.Buffer.concat(r)}};Rp.FieldsBinaryCodec=jA});var KA=D(Bp=>{"use strict";h();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.StructBinaryCodec=void 0;var tK=$t(),rK=zA(),QA=class{constructor(e){this.fieldsCodec=new rK.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new tK.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Bp.StructBinaryCodec=QA});var j6=D(Lp=>{"use strict";h();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.EnumBinaryCodec=void 0;var Mp=$t(),nK=zA(),WA=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new nK.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[u,a]=this.fieldsCodec.decodeNested(e,o);return[new Mp.EnumValue(r,s,u),i+a]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Mp.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Mp.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return p.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Mp.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return p.Buffer.concat([o,i])}};Lp.EnumBinaryCodec=WA});var z6=D(Fp=>{"use strict";h();Object.defineProperty(Fp,"__esModule",{value:!0});Fp.TupleBinaryCodec=void 0;var iK=KA(),$A=class{constructor(e){this.structCodec=new iK.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Fp.TupleBinaryCodec=$A});var Q6=D(Up=>{"use strict";h();Object.defineProperty(Up,"__esModule",{value:!0});Up.ArrayVecBinaryCodec=void 0;var sK=$t(),YA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let u=0;u{"use strict";h();var oK=Fn&&Fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aK=Fn&&Fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uK=Fn&&Fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oK(e,t,r);return aK(e,t),e};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.BinaryCodecConstraints=Fn.BinaryCodec=void 0;var K6=uK(Ie()),qp=$t(),W6=Bn(),cK=T6(),lK=V6(),fK=G6(),hK=KA(),dK=j6(),gK=z6(),pK=Q6(),JA=class{constructor(e=null){this.constraints=e||new Vp,this.optionCodec=new cK.OptionValueBinaryCodec(this),this.listCodec=new fK.ListBinaryCodec(this),this.arrayCodec=new pK.ArrayVecBinaryCodec(this),this.primitiveCodec=new lK.PrimitiveBinaryCodec(this),this.structCodec=new hK.StructBinaryCodec(this),this.tupleCodec=new gK.TupleBinaryCodec(this),this.enumCodec=new dK.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),qp.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=qp.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return W6.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qp.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 W6.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qp.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)})}};Fn.BinaryCodec=JA;var Vp=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new K6.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new K6.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Fn.BinaryCodecConstraints=Vp});var $6=D(Un=>{"use strict";h();var mK=Un&&Un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Un,"__esModule",{value:!0});Un.decodeBigNumber=Un.decodeString=Un.decodeBool=Un.decodeUnsignedNumber=void 0;var yK=mK((nr(),xe(hr))),kp=$t(),wK=XA(),Hp=new wK.BinaryCodec;function vK(t){let e=Hp.decodeTopLevel(t,new kp.BigUIntType);return Number(e.valueOf())}Un.decodeUnsignedNumber=vK;function AK(t){return!!Hp.decodeTopLevel(t,new kp.BooleanType).valueOf()}Un.decodeBool=AK;function EK(t){let e=Hp.decodeTopLevel(t,new kp.BytesType);return String(e.valueOf())}Un.decodeString=EK;function bK(t){let e=Hp.decodeTopLevel(t,new kp.BigUIntType);return new yK.default(e.valueOf())}Un.decodeBigNumber=bK});var ZA=D(yo=>{"use strict";h();var SK=yo&&yo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y6=yo&&yo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SK(e,t,r)};Object.defineProperty(yo,"__esModule",{value:!0});Y6(XA(),yo);Y6($6(),yo)});var lc=D(Gp=>{"use strict";h();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.ArgSerializer=void 0;var J6=yr(),IK=ZA(),X6=$t(),eE=Lg(),tE=kg(),rE=gp(),_K={codec:new IK.BinaryCodec},nE=class{constructor(e){e={..._K,...e},this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(J6.ARGUMENTS_SEPARATOR).map(r=>p.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(J6.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(eE.OptionalValue.ClassName)){let a=o;a.isSet()&&i(a.getTypedValue());return}if(o.hasExactClass(rE.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(tE.CompositeValue.ClassName)){let a=o;for(let c of a.getItems())i(c);return}let u=r.codec.encodeTopLevel(o);n.push(u)}function s(o){if(o.getType().isCounted){let a=new X6.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(a))}for(let a of o.getItems())i(a)}return n}};Gp.ArgSerializer=nE});var iE=D((Qye,Z6)=>{h();Ps.notEqual=CK;Ps.notOk=NK;Ps.equal=TK;Ps.ok=Ps;Z6.exports=Ps;function TK(t,e,r){Ps(t==e,r)}function CK(t,e,r){Ps(t!=e,r)}function NK(t,e){Ps(!t,e)}function Ps(t,e){if(!t)throw new Error(e||"AssertionError")}});var tO=D((Wye,eO)=>{h();eO.exports=sE;sE.supported=typeof WebAssembly<"u";function sE(t){if(!sE.supported)return null;var e=t&&t.imports,r=xK("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(a){i.exports.memory.grow(Math.ceil(Math.abs(a-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(a){if(i.exports)return a();if(n){n.then(a.bind(null,null)).catch(a);return}try{if(t&&t.async)throw new Error("async");u({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(u)}o(a)}function u(a){i.exports=a.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function xK(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(OK)):new(no()).Buffer(t,"base64")}function OK(t){return t.charCodeAt(0)}});var uO=D((Xye,Yi)=>{h();var $i=iE(),Pt=tO()(),Rs=64,jp=[];Yi.exports=qn;var rO=Yi.exports.BYTES_MIN=16,nO=Yi.exports.BYTES_MAX=64,Yye=Yi.exports.BYTES=32,iO=Yi.exports.KEYBYTES_MIN=16,sO=Yi.exports.KEYBYTES_MAX=64,Jye=Yi.exports.KEYBYTES=32,oO=Yi.exports.SALTBYTES=16,aO=Yi.exports.PERSONALBYTES=16;function qn(t,e,r,n,i){if(!(this instanceof qn))return new qn(t,e,r,n,i);if(!(Pt&&Pt.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&($i(t>=rO,"digestLength must be at least "+rO+", was given "+t),$i(t<=nO,"digestLength must be at most "+nO+", was given "+t),e!=null&&$i(e.length>=iO,"key must be at least "+iO+", was given "+e.length),e!=null&&$i(e.length<=sO,"key must be at least "+sO+", was given "+e.length),r!=null&&$i(r.length===oO,"salt must be exactly "+oO+", was given "+r.length),n!=null&&$i(n.length===aO,"personal must be exactly "+aO+", was given "+n.length)),jp.length||(jp.push(Rs),Rs+=216),this.digestLength=t,this.finalized=!1,this.pointer=jp.pop(),Pt.memory.fill(0,0,64),Pt.memory[0]=this.digestLength,Pt.memory[1]=e?e.length:0,Pt.memory[2]=1,Pt.memory[3]=1,r&&Pt.memory.set(r,32),n&&Pt.memory.set(n,48),this.pointer+216>Pt.memory.length&&Pt.realloc(this.pointer+216),Pt.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Pt.memory.fill(0,Rs,Rs+e.length),Pt.memory[this.pointer+200]=128)}qn.prototype.update=function(t){return $i(this.finalized===!1,"Hash instance finalized"),$i(t,"input must be TypedArray or Buffer"),Rs+t.length>Pt.memory.length&&Pt.realloc(Rs+t.length),Pt.memory.set(t,Rs),Pt.exports.blake2b_update(this.pointer,Rs,Rs+t.length),this};qn.prototype.digest=function(t){if($i(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,jp.push(this.pointer),Pt.exports.blake2b_final(this.pointer),!t||t==="binary")return Pt.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return PK(Pt.memory,this.pointer+128,this.digestLength);$i(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{h();var Ao=iE(),jf=uO();function zp(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function cO(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function mO(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function wo(t,e,r,n,i,s){var o=Gf[i],u=Gf[i+1],a=Gf[s],c=Gf[s+1];zp(_e,t,e),cO(_e,t,o,u);var f=_e[n]^_e[t],d=_e[n+1]^_e[t+1];_e[n]=d,_e[n+1]=f,zp(_e,r,n),f=_e[e]^_e[r],d=_e[e+1]^_e[r+1],_e[e]=f>>>24^d<<8,_e[e+1]=d>>>24^f<<8,zp(_e,t,e),cO(_e,t,a,c),f=_e[n]^_e[t],d=_e[n+1]^_e[t+1],_e[n]=f>>>16^d<<16,_e[n+1]=d>>>16^f<<16,zp(_e,r,n),f=_e[e]^_e[r],d=_e[e+1]^_e[r+1],_e[e]=d>>>31^f<<1,_e[e+1]=f>>>31^d<<1}var yO=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),BK=[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],Rr=new Uint8Array(BK.map(function(t){return t*2})),_e=new Uint32Array(32),Gf=new Uint32Array(32);function wO(t,e){var r=0;for(r=0;r<16;r++)_e[r]=t.h[r],_e[r+16]=yO[r];for(_e[24]=_e[24]^t.t,_e[25]=_e[25]^t.t/4294967296,e&&(_e[28]=~_e[28],_e[29]=~_e[29]),r=0;r<32;r++)Gf[r]=mO(t.b,4*r);for(r=0;r<12;r++)wo(0,8,16,24,Rr[r*16+0],Rr[r*16+1]),wo(2,10,18,26,Rr[r*16+2],Rr[r*16+3]),wo(4,12,20,28,Rr[r*16+4],Rr[r*16+5]),wo(6,14,22,30,Rr[r*16+6],Rr[r*16+7]),wo(0,10,20,30,Rr[r*16+8],Rr[r*16+9]),wo(2,12,22,24,Rr[r*16+10],Rr[r*16+11]),wo(4,14,16,26,Rr[r*16+12],Rr[r*16+13]),wo(6,8,18,28,Rr[r*16+14],Rr[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^_e[r]^_e[r+16]}var vo=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 fc(t,e,r,n){vo.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,vo[0]=t,e&&(vo[1]=e.length),vo[2]=1,vo[3]=1,r&&vo.set(r,32),n&&vo.set(n,48);for(var i=0;i<16;i++)this.h[i]=yO[i]^mO(vo,i*4);e&&(vO(this,e),this.c=128)}fc.prototype.update=function(t){return Ao(t!=null,"input must be Uint8Array or Buffer"),vO(this,t),this};fc.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ao(e.length>=this.outlen,"out must have at least outlen bytes of space"),MK(this,e),t==="hex"?LK(e):e};fc.prototype.final=fc.prototype.digest;fc.ready=function(t){jf.ready(function(){t()})};function vO(t,e){for(var r=0;r>2]>>8*(r&3);return e}function LK(t){for(var e="",r=0;r=lO,"outlen must be at least "+lO+", was given "+e),Ao(e<=fO,"outlen must be at most "+fO+", was given "+e),r!=null&&Ao(r.length>=hO,"key must be at least "+hO+", was given "+r.length),r!=null&&Ao(r.length<=dO,"key must be at most "+dO+", was given "+r.length),n!=null&&Ao(n.length===gO,"salt must be exactly "+gO+", was given "+n.length),i!=null&&Ao(i.length===pO,"personal must be exactly "+pO+", was given "+i.length)),new AO(e,r,n,i)};Zr.exports.ready=function(t){jf.ready(function(){t()})};Zr.exports.WASM_SUPPORTED=jf.SUPPORTED;Zr.exports.WASM_LOADED=!1;var lO=Zr.exports.BYTES_MIN=16,fO=Zr.exports.BYTES_MAX=64,e1e=Zr.exports.BYTES=32,hO=Zr.exports.KEYBYTES_MIN=16,dO=Zr.exports.KEYBYTES_MAX=64,t1e=Zr.exports.KEYBYTES=32,gO=Zr.exports.SALTBYTES=16,pO=Zr.exports.PERSONALBYTES=16;jf.ready(function(t){t||(Zr.exports.WASM_LOADED=!0,AO=jf)})});var EO=D(Qp=>{"use strict";h();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.Code=void 0;var UK=oE(),qK=32,aE=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return p.Buffer.from(this.hex,"hex")}computeHash(){let e=UK(qK).update(this.valueOf()).digest();return p.Buffer.from(e)}};Qp.Code=aE});var uE=D(Kp=>{"use strict";h();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.CodeMetadata=void 0;var hc=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBytes(e){return t.fromBuffer(p.Buffer.from(e))}static fromBuffer(e){if(e.length{"use strict";h();var VK=Ji&&Ji.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kK=Ji&&Ji.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HK=Ji&&Ji.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VK(e,t,r);return kK(e,t),e};Object.defineProperty(Ji,"__esModule",{value:!0});Ji.ContractFunction=void 0;var GK=HK(Ie()),cE=class t{constructor(e){if(this.name=e,e==null)throw new GK.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Ji.ContractFunction=cE});var hE=D(Wp=>{"use strict";h();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.Compatibility=void 0;var jK=ke(),fE=class{static guardAddressIsSetAndNonZero(e,r,n){!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==jK.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`)}};Wp.Compatibility=fE});var Bs=D($p=>{"use strict";h();Object.defineProperty($p,"__esModule",{value:!0});$p.TransactionPayload=void 0;var dE=class t{constructor(e){this.data=p.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=p.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>p.Buffer.from(e,"hex"))}length(){return p.Buffer.from(this.data).length}};$p.TransactionPayload=dE});var dc=D(Yp=>{"use strict";h();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.TransactionBuilder=void 0;var zK=yr(),QK=en(),KK=Bs(),gE=class{constructor(e){this.config=e.config,this.sender=e.sender,this.receiver=e.receiver,this.dataParts=e.dataParts,this.providedGasLimit=e.gasLimit,this.addDataMovementGas=e.addDataMovementGas,this.amount=e.amount}computeGasLimit(e){return this.addDataMovementGas?this.config.minGasLimit+this.config.gasLimitPerByte*BigInt(e.length())+this.providedGasLimit:this.providedGasLimit}buildTransactionPayload(){let e=this.dataParts.join(zK.ARGUMENTS_SEPARATOR);return new KK.TransactionPayload(e)}build(){let e=this.buildTransactionPayload(),r=this.computeGasLimit(e);return new QK.Transaction({sender:this.sender.bech32(),receiver:this.receiver.bech32(),gasLimit:r,value:this.amount||0n,data:e.valueOf(),chainID:this.config.chainID})}};Yp.TransactionBuilder=gE});var bO=D(Jp=>{"use strict";h();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.DelegationTransactionsFactory=void 0;var WK=ke(),$K=yr(),YK=Ie(),hn=Vn(),tn=dc(),pE=class{constructor(e){this.config=e.config,this.argSerializer=new hn.ArgSerializer,this.delegationManagerAddress=WK.Address.fromHex($K.DELEGATION_MANAGER_SC_ADDRESS_HEX,this.config.addressHrp)}createTransactionForNewDelegationContract(e){let r=["createNewDelegationContract",...this.argSerializer.valuesToStrings([new hn.BigUIntValue(e.totalDelegationCap),new hn.BigUIntValue(e.serviceFee)])],n=this.config.gasLimitCreateDelegationContract+this.config.additionalGasLimitForDelegationOperations;return new tn.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.delegationManagerAddress,dataParts:r,gasLimit:n,addDataMovementGas:!0,amount:e.amount}).build()}createTransactionForAddingNodes(e){if(e.publicKeys.length!==e.signedMessages.length)throw new YK.Err("The number of public keys should match the number of signed messages");let r=e.signedMessages.map(o=>new hn.BytesValue(p.Buffer.from(o))),n=this.argSerializer.valuesToStrings(r),i=e.publicKeys.length,s=["addNodes"];for(let o=0;o{h();var SO=(nr(),xe(hr)),IO=_O.exports;(function(){"use strict";function t(c){return c<10?"0"+c:c}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,i,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o;function u(c){return r.lastIndex=0,r.test(c)?'"'+c.replace(r,function(f){var d=s[f];return typeof d=="string"?d:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+c+'"'}function a(c,f){var d,w,A,_,N=n,P,V=f[c],U=V!=null&&(V instanceof SO||SO.isBigNumber(V));switch(V&&typeof V=="object"&&typeof V.toJSON=="function"&&(V=V.toJSON(c)),typeof o=="function"&&(V=o.call(f,c,V)),typeof V){case"string":return U?V:u(V);case"number":return isFinite(V)?String(V):"null";case"boolean":case"null":case"bigint":return String(V);case"object":if(!V)return"null";if(n+=i,P=[],Object.prototype.toString.apply(V)==="[object Array]"){for(_=V.length,d=0;d<_;d+=1)P[d]=a(d,V)||"null";return A=P.length===0?"[]":n?`[ -`+n+P.join(`, +`)}};ue.ErrContractHasNoAddress=jA;var QA=class extends Qe{constructor(e){super(e)}};ue.ErrMock=QA;var KA=class extends Qe{constructor(e){super(e)}};ue.ErrTypingSystem=KA;var WA=class extends Qe{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};ue.ErrMissingFieldOnStruct=WA;var $A=class extends Qe{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};ue.ErrMissingFieldOnEnum=$A;var YA=class extends Qe{constructor(e){super(`cannot parse contract results: ${e}`)}};ue.ErrCannotParseContractResults=YA;var JA=class extends Qe{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};ue.ErrCannotParseTransactionOutcome=JA;var XA=class extends Qe{constructor(e){super(e)}};ue.ErrCodec=XA;var ZA=class extends Qe{constructor(e){super(e)}};ue.ErrContractInteraction=ZA;var e2=class extends Qe{constructor(){super("Method not yet implemented")}};ue.ErrNotImplemented=e2;var t2=class extends Qe{constructor(){super("invalid arguments for relayed v1 builder")}};ue.ErrInvalidRelayedV1BuilderArguments=t2;var r2=class extends Qe{constructor(){super("invalid arguments for relayed v2 builder")}};ue.ErrInvalidRelayedV2BuilderArguments=r2;var n2=class extends Qe{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ue.ErrGasLimitShouldBe0ForInnerTransaction=n2;var i2=class extends Qe{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};ue.ErrIsCompletedFieldIsMissingOnTransaction=i2;var s2=class extends Qe{constructor(e){super(e)}};ue.ErrInvalidTokenIdentifier=s2;var o2=class extends Qe{constructor(e){super(e)}};ue.ErrBadUsage=o2;var a2=class extends Qe{constructor(e){super(e)}};ue.ErrInvalidInnerTransaction=a2;var c2=class extends Qe{constructor(e){super(e)}};ue.ErrParseTransactionOutcome=c2;var u2=class extends Qe{constructor(e,r){super(r),this.returnCode=e}};ue.ErrSmartContractQuery=u2});var xr=L(me=>{"use strict";h();Object.defineProperty(me,"__esModule",{value:!0});me.ESDT_CONTRACT_ADDRESS=me.DELEGATION_MANAGER_SC_ADDRESS=me.CONTRACT_DEPLOY_ADDRESS=me.BECH32_ADDRESS_LENGTH=me.DEFAULT_HRP=me.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER=me.UNKNOWN_SIGNER=me.SDK_JS_SIGNER=me.METACHAIN_ID=me.WasmVirtualMachine=me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=me.HEX_TRANSACTION_HASH_LENGTH=me.MESSAGE_PREFIX=me.DEFAULT_MESSAGE_VERSION=me.ESDT_CONTRACT_ADDRESS_HEX=me.DELEGATION_MANAGER_SC_ADDRESS_HEX=me.CONTRACT_DEPLOY_ADDRESS_HEX=me.VM_TYPE_WASM_VM=me.ARGUMENTS_SEPARATOR=me.ESDT_TRANSFER_VALUE=me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_GAS_LIMIT=me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=me.TRANSACTION_VERSION_DEFAULT=me.TRANSACTION_OPTIONS_TX_GUARDED=me.TRANSACTION_OPTIONS_TX_HASH_SIGN=me.TRANSACTION_OPTIONS_DEFAULT=me.TRANSACTION_MIN_GAS_PRICE=void 0;me.TRANSACTION_MIN_GAS_PRICE=1e9;me.TRANSACTION_OPTIONS_DEFAULT=0;me.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;me.TRANSACTION_OPTIONS_TX_GUARDED=2;me.TRANSACTION_VERSION_DEFAULT=2;me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=2;me.ESDT_TRANSFER_GAS_LIMIT=5e5;me.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";me.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";me.ESDT_TRANSFER_VALUE="0";me.ARGUMENTS_SEPARATOR="@";me.VM_TYPE_WASM_VM=new Uint8Array([5,0]);me.CONTRACT_DEPLOY_ADDRESS_HEX="0000000000000000000000000000000000000000000000000000000000000000";me.DELEGATION_MANAGER_SC_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000004ffff";me.ESDT_CONTRACT_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000002ffff";me.DEFAULT_MESSAGE_VERSION=1;me.MESSAGE_PREFIX=`Elrond Signed Message: +`;me.HEX_TRANSACTION_HASH_LENGTH=64;me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=3;me.WasmVirtualMachine="0500";me.METACHAIN_ID=4294967295;me.SDK_JS_SIGNER="sdk-js";me.UNKNOWN_SIGNER="unknown";me.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER="EGLD-000000";me.DEFAULT_HRP="erd";me.BECH32_ADDRESS_LENGTH=62;me.CONTRACT_DEPLOY_ADDRESS="erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu";me.DELEGATION_MANAGER_SC_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqylllslmq6y6";me.ESDT_CONTRACT_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"});var Sc=L(ai=>{"use strict";h();var AW=ai&&ai.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ai,"__esModule",{value:!0});ai.TokenPayment=ai.TokenComputer=ai.TokenTransfer=ai.Token=void 0;var Ec=AW((qt(),qe(jt))),Hu=Ve(),EW=xr(),HC="EGLD",GC=18;Ec.default.set({ROUNDING_MODE:1});var kd=class{constructor(e){this.identifier=e.identifier,this.nonce=e.nonce||0n}};ai.Token=kd;var Vp=class t{constructor(e){if(this.isLegacyTokenTransferOptions(e)){let r=new Ec.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new Hu.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0,this.token=new kd({identifier:e.tokenIdentifier,nonce:BigInt(e.nonce)}),this.amount=BigInt(this.amountAsBigInteger.toFixed(0))}else this.token=e.token,this.amount=e.amount,this.tokenIdentifier=e.token.identifier,this.nonce=Number(e.token.nonce),this.amountAsBigInteger=new Ec.default(this.amount.toString()),this.numDecimals=0}static newFromEgldAmount(e){let r=new kd({identifier:EW.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER});return new t({token:r,amount:e})}isLegacyTokenTransferOptions(e){return e.tokenIdentifier!==void 0}static egldFromAmount(e){let r=new Ec.default(e).shiftedBy(GC).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:HC,nonce:0,amountAsBigInteger:e,numDecimals:GC})}static fungibleFromAmount(e,r,n){let i=new Ec.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Ec.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amount.toString()}valueOf(){return new Ec.default(this.amount.toString())}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.token.identifier==HC}isFungible(){return this.token.nonce==0n}};ai.TokenTransfer=Vp;var l2=class{constructor(){}isFungible(e){return e.nonce===0n}extractNonceFromExtendedIdentifier(e){let r=e.split("-");if(this.checkIfExtendedIdentifierWasProvided(r),this.checkLengthOfRandomSequence(r[1]),r.length==2)return 0;let n=b.Buffer.from(r[2],"hex");return SW(n)}extractIdentifierFromExtendedIdentifier(e){let r=e.split("-");return this.checkIfExtendedIdentifierWasProvided(r),this.ensureTokenTickerValidity(r[0]),this.checkLengthOfRandomSequence(r[1]),r[0]+"-"+r[1]}checkIfExtendedIdentifierWasProvided(e){if(e.length<2||e.length>3)throw new Hu.ErrInvalidTokenIdentifier("Invalid extended token identifier provided")}checkLengthOfRandomSequence(e){if(e.length!==6)throw new Hu.ErrInvalidTokenIdentifier("The identifier is not valid. The random sequence does not have the right length")}ensureTokenTickerValidity(e){if(e.length<3||e.length>10)throw new Hu.ErrInvalidTokenIdentifier("The token ticker should be between 3 and 10 characters");if(!e.match(/^[a-zA-Z0-9]+$/))throw new Hu.ErrInvalidTokenIdentifier("The token ticker should only contain alphanumeric characters");if(e!=e.toUpperCase())throw new Hu.ErrInvalidTokenIdentifier("The token ticker should be upper case")}};ai.TokenComputer=l2;function SW(t){return t.readUIntBE(0,t.length)}var f2=class extends Vp{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ai.TokenPayment=f2});var ra=L(Tc=>{"use strict";h();Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Logger=Tc.LogLevel=void 0;var _c;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(_c=Tc.LogLevel||(Tc.LogLevel={}));var Hp=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=_c.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=_c.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=_c.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=_c.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=_c.Error||console.error(e,r)}};Tc.Logger=Hp;Hp.logLevel=_c.Debug});var Vd=L(ci=>{"use strict";h();var _W=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TW=ci&&ci.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IW=ci&&ci.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_W(e,t,r);return TW(e,t),e};Object.defineProperty(ci,"__esModule",{value:!0});ci.TransactionOptions=ci.TransactionVersion=void 0;var $i=xr(),zC=IW(Ve()),d2=class t{constructor(e){if(e=Number(e),e<1)throw new zC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t($i.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t($i.TRANSACTION_VERSION_DEFAULT)}valueOf(){return this.value}};ci.TransactionVersion=d2;var h2=class t{constructor(e){if(e=Number(e),e<0)throw new zC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t($i.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=$i.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=$i.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&$i.TRANSACTION_OPTIONS_TX_HASH_SIGN)==$i.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&$i.TRANSACTION_OPTIONS_TX_GUARDED)==$i.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=$i.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=$i.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};ci.TransactionOptions=h2});var g2=L((BEe,KC)=>{"use strict";h();var zp="qpzry9x8gf2tvdw0s3jn54khce6mua7l",p2={};for(Hd=0;Hd>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function jC(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Gu(e)^n>>5}for(e=Gu(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=jC(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Gu(n)^o,i+=zp.charAt(o)}for(s=0;s<6;++s)n=Gu(n);for(n^=1,s=0;s<6;++s){var c=n>>(5-s)*5&31;i+=zp.charAt(c)}return i}function QC(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var c=jC(s);if(typeof c=="string")return c;for(var a=[],u=0;u=o.length)&&a.push(p)}return c!==1?"Invalid checksum for "+t:{prefix:s,words:a}}function xW(){var t=QC.apply(null,arguments);if(typeof t=="object")return t}function NW(t){var e=QC.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function jp(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,c.push(i>>s&o);if(n)s>0&&c.push(i<=e)return"Excess padding";if(i<{"use strict";h();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.LibraryConfig=void 0;var Qp=class{};Kp.LibraryConfig=Qp;Qp.DefaultAddressHrp="erd"});var zu=L(er=>{"use strict";h();var DW=er&&er.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BW=er&&er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LW=er&&er.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DW(e,t,r);return BW(e,t),e},FW=er&&er.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(er,"__esModule",{value:!0});er.addressToHex=er.bigIntToHex=er.byteArrayToHex=er.boolToHex=er.utf8ToHex=er.zeroPadStringIfOddLength=er.isPaddedHex=er.numberToPaddedHex=void 0;var qW=FW((qt(),qe(jt))),UW=Nt(),kW=LW(na());function VW(t){let e;typeof t=="bigint"||typeof t=="number"?e=t:e=new qW.default(t);let r=e.toString(16);return $p(r)}er.numberToPaddedHex=VW;function HW(t){t=t||"";let e=b.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}er.isPaddedHex=HW;function $p(t){return t=t||"",t.length%2==1?"0"+t:t}er.zeroPadStringIfOddLength=$p;function WC(t){let e=b.Buffer.from(t).toString("hex");return $p(e)}er.utf8ToHex=WC;function GW(t){return WC(t.toString())}er.boolToHex=GW;function zW(t){let e=b.Buffer.from(t).toString("hex");return $p(e)}er.byteArrayToHex=zW;function jW(t){return t==0?"":kW.getHexMagnitudeOfBigInt(t)}er.bigIntToHex=jW;function QW(t){return UW.Address.fromBech32(t.toString()).pubkey().toString("hex")}er.addressToHex=QW});var na=L(Nr=>{"use strict";h();var KW=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.prependByteToBuffer=Nr.flipBufferBitsInPlace=Nr.getHexMagnitudeOfBigInt=Nr.bigIntToBuffer=Nr.bufferToBigInt=Nr.cloneBuffer=Nr.isMsbZero=Nr.isMsbOne=void 0;var m2=KW((qt(),qe(jt))),WW=zu();function $C(t,e=0){return t[e]>>7==1}Nr.isMsbOne=$C;function $W(t,e=0){return!$C(t,e)}Nr.isMsbZero=$W;function YW(t){let e=b.Buffer.alloc(t.length);return t.copy(e),e}Nr.cloneBuffer=YW;function JW(t){let e=t.toString("hex");return new m2.default(`0x${e}`,16)}Nr.bufferToBigInt=JW;function XW(t){let e=YC(t);return b.Buffer.from(e,"hex")}Nr.bigIntToBuffer=XW;function YC(t){return t=new m2.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new m2.default(-1))),WW.numberToPaddedHex(t)):""}Nr.getHexMagnitudeOfBigInt=YC;function ZW(t){for(let e=0;e{"use strict";h();var t$=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r$=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JC=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t$(e,t,r);return r$(e,t),e},n$=ar&&ar.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ar,"__esModule",{value:!0});ar.bufferToHex=ar.addressToHex=ar.bigIntToHex=ar.utf8ToHex=ar.bigIntToBuffer=ar.bufferToBigInt=ar.stringToBuffer=void 0;var i$=n$((qt(),qe(jt))),XC=JC(na()),s$=JC(zu());function o$(t){return b.Buffer.from(t)}ar.stringToBuffer=o$;function a$(t){return t.length==0?new i$.default(0):XC.bufferToBigInt(t)}ar.bufferToBigInt=a$;function c$(t){return t==0?b.Buffer.from([]):XC.bigIntToBuffer(t)}ar.bigIntToBuffer=c$;var y2=zu();Object.defineProperty(ar,"utf8ToHex",{enumerable:!0,get:function(){return y2.utf8ToHex}});Object.defineProperty(ar,"bigIntToHex",{enumerable:!0,get:function(){return y2.bigIntToHex}});Object.defineProperty(ar,"addressToHex",{enumerable:!0,get:function(){return y2.addressToHex}});function u$(t){let e=t.toString("hex");return s$.zeroPadStringIfOddLength(e)}ar.bufferToHex=u$});var _o=L((jEe,v2)=>{"use strict";h();var ju=typeof Reflect=="object"?Reflect:null,ZC=ju&&typeof ju.apply=="function"?ju.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jp;ju&&typeof ju.ownKeys=="function"?Jp=ju.ownKeys:Object.getOwnPropertySymbols?Jp=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jp=function(e){return Object.getOwnPropertyNames(e)};function l$(t){console&&console.warn&&console.warn(t)}var tx=Number.isNaN||function(e){return e!==e};function Kt(){Kt.init.call(this)}v2.exports=Kt;v2.exports.once=p$;Kt.EventEmitter=Kt;Kt.prototype._events=void 0;Kt.prototype._eventsCount=0;Kt.prototype._maxListeners=void 0;var ex=10;function Xp(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Kt,"defaultMaxListeners",{enumerable:!0,get:function(){return ex},set:function(t){if(typeof t!="number"||t<0||tx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ex=t}});Kt.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};Kt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||tx(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 rx(t){return t._maxListeners===void 0?Kt.defaultMaxListeners:t._maxListeners}Kt.prototype.getMaxListeners=function(){return rx(this)};Kt.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var c=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw c.context=o,c}var a=s[e];if(a===void 0)return!1;if(typeof a=="function")ZC(a,this,r);else for(var u=a.length,f=ax(a,u),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=o.length,l$(c)}return t}Kt.prototype.addListener=function(e,r){return nx(this,e,r,!1)};Kt.prototype.on=Kt.prototype.addListener;Kt.prototype.prependListener=function(e,r){return nx(this,e,r,!0)};function f$(){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 ix(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=f$.bind(n);return i.listener=r,n.wrapFn=i,i}Kt.prototype.once=function(e,r){return Xp(r),this.on(e,ix(this,e,r)),this};Kt.prototype.prependOnceListener=function(e,r){return Xp(r),this.prependListener(e,ix(this,e,r)),this};Kt.prototype.removeListener=function(e,r){var n,i,s,o,c;if(Xp(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){c=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():d$(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,c||r)}return this};Kt.prototype.off=Kt.prototype.removeListener;Kt.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function sx(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?h$(i):ax(i,i.length)}Kt.prototype.listeners=function(e){return sx(this,e,!0)};Kt.prototype.rawListeners=function(e){return sx(this,e,!1)};Kt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ox.call(t,e)};Kt.prototype.listenerCount=ox;function ox(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Kt.prototype.eventNames=function(){return this._eventsCount>0?Jp(this._events):[]};function ax(t,e){for(var r=new Array(e),n=0;n{h();ux.exports=_o().EventEmitter});var w2=L(()=>{h()});var gx=L((XEe,px)=>{"use strict";h();function lx(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fx(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return Zp.alloc(0);for(var n=Zp.allocUnsafe(r>>>0),i=this.head,s=0;i;)S$(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(c===o.length?s+=o:s+=o.slice(0,r),r-=c,r===0){c===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(c));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=Zp.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,c=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,c),r-=c,r===0){c===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(c));break}++s}return this.length-=s,n}},{key:E$,value:function(r,n){return A2(this,fx(fx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var S2=L((eSe,yx)=>{"use strict";h();function _$(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,O.default.nextTick(E2,this,t)):O.default.nextTick(E2,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?O.default.nextTick(eg,r):(r._writableState.errorEmitted=!0,O.default.nextTick(mx,r,s)):O.default.nextTick(mx,r,s):e?(O.default.nextTick(eg,r),e(s)):O.default.nextTick(eg,r)}),this)}function mx(t,e){E2(t,e),eg(t)}function eg(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function T$(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function E2(t,e){t.emit("error",e)}function I$(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}yx.exports={destroy:_$,undestroy:T$,errorOrDestroy:I$}});var Ic=L((rSe,wx)=>{"use strict";h();function C$(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var bx={};function ui(t,e,r){r||(r=Error);function n(s,o,c){return typeof e=="string"?e:e(s,o,c)}var i=function(s){C$(o,s);function o(c,a,u){return s.call(this,n(c,a,u))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,bx[t]=i}function vx(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function x$(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function N$(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function O$(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}ui("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);ui("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&x$(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(N$(t," argument"))i="The ".concat(t," ").concat(n," ").concat(vx(e,"type"));else{var s=O$(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(vx(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);ui("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");ui("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});ui("ERR_STREAM_PREMATURE_CLOSE","Premature close");ui("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});ui("ERR_MULTIPLE_CALLBACK","Callback called multiple times");ui("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");ui("ERR_STREAM_WRITE_AFTER_END","write after end");ui("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ui("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);ui("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");wx.exports.codes=bx});var _2=L((iSe,Ax)=>{"use strict";h();var P$=Ic().codes.ERR_INVALID_OPT_VALUE;function R$(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function M$(t,e,r,n){var i=R$(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new P$(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}Ax.exports={getHighWaterMark:M$}});var Ss=L((oSe,T2)=>{h();typeof Object.create=="function"?T2.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:T2.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Sx=L((cSe,Ex)=>{h();Ex.exports=D$;function D$(t,e){if(I2("noDeprecation"))return t;var r=!1;function n(){if(!r){if(I2("throwDeprecation"))throw new Error(e);I2("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function I2(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var N2=L((lSe,Nx)=>{"use strict";h();Nx.exports=hr;function Tx(t){var e=this;this.next=null,this.entry=null,this.finish=function(){aY(e,t)}}var Qu;hr.WritableState=zd;var B$={deprecate:Sx()},Ix=b2(),rg=wo().Buffer,L$=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function F$(t){return rg.from(t)}function q$(t){return rg.isBuffer(t)||t instanceof L$}var x2=S2(),U$=_2(),k$=U$.getHighWaterMark,ia=Ic().codes,V$=ia.ERR_INVALID_ARG_TYPE,H$=ia.ERR_METHOD_NOT_IMPLEMENTED,G$=ia.ERR_MULTIPLE_CALLBACK,z$=ia.ERR_STREAM_CANNOT_PIPE,j$=ia.ERR_STREAM_DESTROYED,Q$=ia.ERR_STREAM_NULL_VALUES,K$=ia.ERR_STREAM_WRITE_AFTER_END,W$=ia.ERR_UNKNOWN_ENCODING,Ku=x2.errorOrDestroy;Ss()(hr,Ix);function $$(){}function zd(t,e,r){Qu=Qu||Cc(),t=t||{},typeof r!="boolean"&&(r=e instanceof Qu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=k$(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){rY(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Tx(this)}zd.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(zd.prototype,"buffer",{get:B$.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var tg;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(tg=Function.prototype[Symbol.hasInstance],Object.defineProperty(hr,Symbol.hasInstance,{value:function(e){return tg.call(this,e)?!0:this!==hr?!1:e&&e._writableState instanceof zd}})):tg=function(e){return e instanceof this};function hr(t){Qu=Qu||Cc();var e=this instanceof Qu;if(!e&&!tg.call(hr,this))return new hr(t);this._writableState=new zd(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),Ix.call(this)}hr.prototype.pipe=function(){Ku(this,new z$)};function Y$(t,e){var r=new K$;Ku(t,r),O.default.nextTick(e,r)}function J$(t,e,r,n){var i;return r===null?i=new Q$:typeof r!="string"&&!e.objectMode&&(i=new V$("chunk",["string","Buffer"],r)),i?(Ku(t,i),O.default.nextTick(n,i),!1):!0}hr.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&q$(t);return s&&!rg.isBuffer(t)&&(t=F$(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=$$),n.ending?Y$(this,r):(s||J$(this,n,t,r))&&(n.pendingcb++,i=Z$(this,n,s,t,e,r)),i};hr.prototype.cork=function(){this._writableState.corked++};hr.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Cx(this,t))};hr.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new W$(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(hr.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function X$(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=rg.from(e,r)),e}Object.defineProperty(hr.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z$(t,e,r,n,i,s){if(!r){var o=X$(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var c=e.objectMode?1:n.length;e.length+=c;var a=e.length{"use strict";h();var cY=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Px.exports=_s;var Ox=R2(),P2=N2();Ss()(_s,Ox);for(O2=cY(P2.prototype),ng=0;ng{h();var sg=wo(),To=sg.Buffer;function Rx(t,e){for(var r in t)e[r]=t[r]}To.from&&To.alloc&&To.allocUnsafe&&To.allocUnsafeSlow?Mx.exports=sg:(Rx(sg,M2),M2.Buffer=Wu);function Wu(t,e,r){return To(t,e,r)}Rx(To,Wu);Wu.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return To(t,e,r)};Wu.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=To(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Wu.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return To(t)};Wu.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return sg.SlowBuffer(t)}});var L2=L(Lx=>{"use strict";h();var B2=Dx().Buffer,Bx=B2.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function fY(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function dY(t){var e=fY(t);if(typeof e!="string"&&(B2.isEncoding===Bx||!Bx(t)))throw new Error("Unknown encoding: "+t);return e||t}Lx.StringDecoder=jd;function jd(t){this.encoding=dY(t);var e;switch(this.encoding){case"utf16le":this.text=vY,this.end=bY,e=4;break;case"utf8":this.fillLast=gY,e=4;break;case"base64":this.text=wY,this.end=AY,e=3;break;default:this.write=EY,this.end=SY;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=B2.allocUnsafe(e)}jd.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function hY(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function pY(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function gY(t){var e=this.lastTotal-this.lastNeed,r=pY(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function mY(t,e){var r=hY(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function yY(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function vY(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function bY(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function wY(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function AY(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function EY(t){return t.toString(this.encoding)}function SY(t){return t&&t.length?this.write(t):""}});var og=L((ySe,Ux)=>{"use strict";h();var Fx=Ic().codes.ERR_STREAM_PREMATURE_CLOSE;function _Y(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";h();var ag;function sa(t,e,r){return e=CY(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CY(t){var e=xY(t,"string");return typeof e=="symbol"?e:String(e)}function xY(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var NY=og(),oa=Symbol("lastResolve"),xc=Symbol("lastReject"),Qd=Symbol("error"),cg=Symbol("ended"),Nc=Symbol("lastPromise"),F2=Symbol("handlePromise"),Oc=Symbol("stream");function aa(t,e){return{value:t,done:e}}function OY(t){var e=t[oa];if(e!==null){var r=t[Oc].read();r!==null&&(t[Nc]=null,t[oa]=null,t[xc]=null,e(aa(r,!1)))}}function PY(t){O.default.nextTick(OY,t)}function RY(t,e){return function(r,n){t.then(function(){if(e[cg]){r(aa(void 0,!0));return}e[F2](r,n)},n)}}var MY=Object.getPrototypeOf(function(){}),DY=Object.setPrototypeOf((ag={get stream(){return this[Oc]},next:function(){var e=this,r=this[Qd];if(r!==null)return Promise.reject(r);if(this[cg])return Promise.resolve(aa(void 0,!0));if(this[Oc].destroyed)return new Promise(function(o,c){O.default.nextTick(function(){e[Qd]?c(e[Qd]):o(aa(void 0,!0))})});var n=this[Nc],i;if(n)i=new Promise(RY(n,this));else{var s=this[Oc].read();if(s!==null)return Promise.resolve(aa(s,!1));i=new Promise(this[F2])}return this[Nc]=i,i}},sa(ag,Symbol.asyncIterator,function(){return this}),sa(ag,"return",function(){var e=this;return new Promise(function(r,n){e[Oc].destroy(null,function(i){if(i){n(i);return}r(aa(void 0,!0))})})}),ag),MY),BY=function(e){var r,n=Object.create(DY,(r={},sa(r,Oc,{value:e,writable:!0}),sa(r,oa,{value:null,writable:!0}),sa(r,xc,{value:null,writable:!0}),sa(r,Qd,{value:null,writable:!0}),sa(r,cg,{value:e._readableState.endEmitted,writable:!0}),sa(r,F2,{value:function(s,o){var c=n[Oc].read();c?(n[Nc]=null,n[oa]=null,n[xc]=null,s(aa(c,!1))):(n[oa]=s,n[xc]=o)},writable:!0}),r));return n[Nc]=null,NY(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[xc];s!==null&&(n[Nc]=null,n[oa]=null,n[xc]=null,s(i)),n[Qd]=i;return}var o=n[oa];o!==null&&(n[Nc]=null,n[oa]=null,n[xc]=null,o(aa(void 0,!0))),n[cg]=!0}),e.on("readable",PY.bind(null,n)),n};kx.exports=BY});var Gx=L((ASe,Hx)=>{h();Hx.exports=function(){throw new Error("Readable.from is not available in the browser")}});var R2=L((_Se,Zx)=>{"use strict";h();Zx.exports=it;var $u;it.ReadableState=Kx;var SSe=_o().EventEmitter,Qx=function(e,r){return e.listeners(r).length},Wd=b2(),ug=wo().Buffer,LY=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function FY(t){return ug.from(t)}function qY(t){return ug.isBuffer(t)||t instanceof LY}var q2=w2(),Ke;q2&&q2.debuglog?Ke=q2.debuglog("stream"):Ke=function(){};var UY=gx(),j2=S2(),kY=_2(),VY=kY.getHighWaterMark,lg=Ic().codes,HY=lg.ERR_INVALID_ARG_TYPE,GY=lg.ERR_STREAM_PUSH_AFTER_EOF,zY=lg.ERR_METHOD_NOT_IMPLEMENTED,jY=lg.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Yu,U2,k2;Ss()(it,Wd);var Kd=j2.errorOrDestroy,V2=["error","close","destroy","pause","resume"];function QY(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function Kx(t,e,r){$u=$u||Cc(),t=t||{},typeof r!="boolean"&&(r=e instanceof $u),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=VY(this,t,"readableHighWaterMark",r),this.buffer=new UY,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Yu||(Yu=L2().StringDecoder),this.decoder=new Yu(t.encoding),this.encoding=t.encoding)}function it(t){if($u=$u||Cc(),!(this instanceof it))return new it(t);var e=this instanceof $u;this._readableState=new Kx(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Wd.call(this)}Object.defineProperty(it.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});it.prototype.destroy=j2.destroy;it.prototype._undestroy=j2.undestroy;it.prototype._destroy=function(t,e){e(t)};it.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=ug.from(t,e),e=""),n=!0),Wx(this,t,e,!1,n)};it.prototype.unshift=function(t){return Wx(this,t,null,!0,!1)};function Wx(t,e,r,n,i){Ke("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,$Y(t,s);else{var o;if(i||(o=KY(s,e)),o)Kd(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==ug.prototype&&(e=FY(e)),n)s.endEmitted?Kd(t,new jY):H2(t,s,e,!0);else if(s.ended)Kd(t,new GY);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?H2(t,s,e,!1):z2(t,s)):H2(t,s,e,!1)}else n||(s.reading=!1,z2(t,s))}return!s.ended&&(s.length=zx?t=zx:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function jx(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=WY(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}it.prototype.read=function(t){Ke("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Ke("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?G2(this):fg(this),null;if(t=jx(t,e),t===0&&e.ended)return e.length===0&&G2(this),null;var n=e.needReadable;Ke("need readable",n),(e.length===0||e.length-t0?i=Jx(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&G2(this)),i!==null&&this.emit("data",i),i};function $Y(t,e){if(Ke("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?fg(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,$x(t)))}}function fg(t){var e=t._readableState;Ke("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ke("emitReadable",e.flowing),e.emittedReadable=!0,O.default.nextTick($x,t))}function $x(t){var e=t._readableState;Ke("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Q2(t)}function z2(t,e){e.readingMore||(e.readingMore=!0,O.default.nextTick(YY,t,e))}function YY(t,e){for(;!e.reading&&!e.ended&&(e.length1&&Xx(n.pipes,t)!==-1)&&!u&&(Ke("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function S(D){Ke("onerror",D),R(),t.removeListener("error",S),Qx(t,"error")===0&&Kd(t,D)}QY(t,"error",S);function I(){t.removeListener("finish",N),R()}t.once("close",I);function N(){Ke("onfinish"),t.removeListener("close",I),R()}t.once("finish",N);function R(){Ke("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ke("pipe resume"),r.resume()),t};function JY(t){return function(){var r=t._readableState;Ke("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Qx(t,"data")&&(r.flowing=!0,Q2(t))}}it.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Ke("on readable",n.length,n.reading),n.length?fg(this):n.reading||O.default.nextTick(XY,this)),r};it.prototype.addListener=it.prototype.on;it.prototype.removeListener=function(t,e){var r=Wd.prototype.removeListener.call(this,t,e);return t==="readable"&&O.default.nextTick(Yx,this),r};it.prototype.removeAllListeners=function(t){var e=Wd.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&O.default.nextTick(Yx,this),e};function Yx(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function XY(t){Ke("readable nexttick read 0"),t.read(0)}it.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ke("resume"),t.flowing=!t.readableListening,ZY(this,t)),t.paused=!1,this};function ZY(t,e){e.resumeScheduled||(e.resumeScheduled=!0,O.default.nextTick(eJ,t,e))}function eJ(t,e){Ke("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Q2(t),e.flowing&&!e.reading&&t.read(0)}it.prototype.pause=function(){return Ke("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ke("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Q2(t){var e=t._readableState;for(Ke("flow",e.flowing);e.flowing&&t.read()!==null;);}it.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ke("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(Ke("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var c=e.push(o);c||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(c){return function(){return t[c].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function G2(t){var e=t._readableState;Ke("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,O.default.nextTick(tJ,e,t))}function tJ(t,e){if(Ke("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(it.from=function(t,e){return k2===void 0&&(k2=Gx()),k2(it,t,e)});function Xx(t,e){for(var r=0,n=t.length;r{"use strict";h();tN.exports=Io;var dg=Ic().codes,rJ=dg.ERR_METHOD_NOT_IMPLEMENTED,nJ=dg.ERR_MULTIPLE_CALLBACK,iJ=dg.ERR_TRANSFORM_ALREADY_TRANSFORMING,sJ=dg.ERR_TRANSFORM_WITH_LENGTH_0,hg=Cc();Ss()(Io,hg);function oJ(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new nJ);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";h();nN.exports=$d;var rN=K2();Ss()($d,rN);function $d(t){if(!(this instanceof $d))return new $d(t);rN.call(this,t)}$d.prototype._transform=function(t,e,r){r(null,t)}});var uN=L((OSe,cN)=>{"use strict";h();var W2;function cJ(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var aN=Ic().codes,uJ=aN.ERR_MISSING_ARGS,lJ=aN.ERR_STREAM_DESTROYED;function sN(t){if(t)throw t}function fJ(t){return t.setHeader&&typeof t.abort=="function"}function dJ(t,e,r,n){n=cJ(n);var i=!1;t.on("close",function(){i=!0}),W2===void 0&&(W2=og()),W2(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,fJ(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new lJ("pipe"))}}}function oN(t){t()}function hJ(t,e){return t.pipe(e)}function pJ(t){return!t.length||typeof t[t.length-1]!="function"?sN:t.pop()}function gJ(){for(var t=arguments.length,e=new Array(t),r=0;r0;return dJ(o,a,u,function(f){i||(i=f),f&&s.forEach(oN),!a&&(s.forEach(oN),n(i))})});return e.reduce(hJ)}cN.exports=gJ});var $2=L((li,lN)=>{h();li=lN.exports=R2();li.Stream=li;li.Readable=li;li.Writable=N2();li.Duplex=Cc();li.Transform=K2();li.PassThrough=iN();li.finished=og();li.pipeline=uN()});var hN=L((MSe,dN)=>{h();var{Transform:mJ}=$2();dN.exports=t=>class fN extends mJ{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!b.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return b.Buffer.isBuffer(r)||(r=b.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new fN(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var mN=L((BSe,gN)=>{h();var{Transform:yJ}=$2();gN.exports=t=>class pN extends yJ{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!b.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return b.Buffer.isBuffer(r)||(r=b.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new pN(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var vN=L((FSe,yN)=>{h();var vJ=hN(),bJ=mN();yN.exports=function(t){let e=vJ(t),r=bJ(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var AN=L(wN=>{h();var bN=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];wN.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],a=t[6]^t[16]^t[26]^t[36]^t[46],u=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],p=t[9]^t[19]^t[29]^t[39]^t[49],S=f^(i<<1|s>>>31),I=p^(s<<1|i>>>31),N=t[0]^S,R=t[1]^I,D=t[10]^S,U=t[11]^I,k=t[20]^S,z=t[21]^I,H=t[30]^S,F=t[31]^I,V=t[40]^S,q=t[41]^I;S=r^(o<<1|c>>>31),I=n^(c<<1|o>>>31);let C=t[2]^S,B=t[3]^I,x=t[12]^S,g=t[13]^I,v=t[22]^S,l=t[23]^I,d=t[32]^S,m=t[33]^I,w=t[42]^S,_=t[43]^I;S=i^(a<<1|u>>>31),I=s^(u<<1|a>>>31);let A=t[4]^S,y=t[5]^I,T=t[14]^S,E=t[15]^I,M=t[24]^S,W=t[25]^I,Y=t[34]^S,P=t[35]^I,G=t[44]^S,Q=t[45]^I;S=o^(f<<1|p>>>31),I=c^(p<<1|f>>>31);let $=t[6]^S,ee=t[7]^I,ie=t[16]^S,X=t[17]^I,re=t[26]^S,ae=t[27]^I,Z=t[36]^S,oe=t[37]^I,Ot=t[46]^S,De=t[47]^I;S=a^(r<<1|n>>>31),I=u^(n<<1|r>>>31);let Pt=t[8]^S,Rt=t[9]^I,Be=t[18]^S,Mt=t[19]^I,Dt=t[28]^S,Le=t[29]^I,Bt=t[38]^S,Lt=t[39]^I,Fe=t[48]^S,Ft=t[49]^I,at=N,Se=R,ct=U<<4|D>>>28,ut=D<<4|U>>>28,_e=k<<3|z>>>29,lt=z<<3|k>>>29,ft=F<<9|H>>>23,Te=H<<9|F>>>23,dt=V<<18|q>>>14,ht=q<<18|V>>>14,Ie=C<<1|B>>>31,pt=B<<1|C>>>31,gt=g<<12|x>>>20,Ce=x<<12|g>>>20,mt=v<<10|l>>>22,yt=l<<10|v>>>22,xe=m<<13|d>>>19,vt=d<<13|m>>>19,bt=w<<2|_>>>30,Ne=_<<2|w>>>30,wt=y<<30|A>>>2,At=A<<30|y>>>2,Oe=T<<6|E>>>26,Et=E<<6|T>>>26,St=W<<11|M>>>21,Pe=M<<11|W>>>21,_t=Y<<15|P>>>17,Tt=P<<15|Y>>>17,Re=Q<<29|G>>>3,It=G<<29|Q>>>3,Ct=$<<28|ee>>>4,Me=ee<<28|$>>>4,xt=X<<23|ie>>>9,rt=ie<<23|X>>>9,nt=re<<25|ae>>>7,nn=ae<<25|re>>>7,sn=Z<<21|oe>>>11,on=oe<<21|Z>>>11,an=De<<24|Ot>>>8,cn=Ot<<24|De>>>8,un=Pt<<27|Rt>>>5,Ui=Rt<<27|Pt>>>5,ki=Be<<20|Mt>>>12,Vi=Mt<<20|Be>>>12,Hi=Le<<7|Dt>>>25,Gi=Dt<<7|Le>>>25,zi=Bt<<8|Lt>>>24,ji=Lt<<8|Bt>>>24,Qi=Fe<<14|Ft>>>18,Ki=Ft<<14|Fe>>>18;t[0]=at^~gt&St,t[1]=Se^~Ce&Pe,t[10]=Ct^~ki&_e,t[11]=Me^~Vi<,t[20]=Ie^~Oe&nt,t[21]=pt^~Et&nn,t[30]=un^~ct&mt,t[31]=Ui^~ut&yt,t[40]=wt^~xt&Hi,t[41]=At^~rt&Gi,t[2]=gt^~St&sn,t[3]=Ce^~Pe&on,t[12]=ki^~_e&xe,t[13]=Vi^~lt&vt,t[22]=Oe^~nt&zi,t[23]=Et^~nn&ji,t[32]=ct^~mt&_t,t[33]=ut^~yt&Tt,t[42]=xt^~Hi&ft,t[43]=rt^~Gi&Te,t[4]=St^~sn&Qi,t[5]=Pe^~on&Ki,t[14]=_e^~xe&Re,t[15]=lt^~vt&It,t[24]=nt^~zi&dt,t[25]=nn^~ji&ht,t[34]=mt^~_t&an,t[35]=yt^~Tt&cn,t[44]=Hi^~ft&bt,t[45]=Gi^~Te&Ne,t[6]=sn^~Qi&at,t[7]=on^~Ki&Se,t[16]=xe^~Re&Ct,t[17]=vt^~It&Me,t[26]=zi^~dt&Ie,t[27]=ji^~ht&pt,t[36]=_t^~an&un,t[37]=Tt^~cn&Ui,t[46]=ft^~bt&wt,t[47]=Te^~Ne&At,t[8]=Qi^~at>,t[9]=Ki^~Se&Ce,t[18]=Re^~Ct&ki,t[19]=It^~Me&Vi,t[28]=dt^~Ie&Oe,t[29]=ht^~pt&Et,t[38]=an^~un&ct,t[39]=cn^~Ui&ut,t[48]=bt^~wt&xt,t[49]=Ne^~At&rt,t[0]^=bN[e*2],t[1]^=bN[e*2+1]}}});var SN=L((VSe,EN)=>{h();var pg=AN();function Ju(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Ju.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};Ju.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(pg.p1600(this.state),this.count=0);return e};Ju.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};EN.exports=Ju});var Yd=L((GSe,_N)=>{h();_N.exports=vN()(SN())});var Nt=L(Nn=>{"use strict";h();var wJ=Nn&&Nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AJ=Nn&&Nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TN=Nn&&Nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wJ(e,t,r);return AJ(e,t),e},EJ=Nn&&Nn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.AddressComputer=Nn.Address=void 0;var Xu=TN(g2()),SJ=EJ((qt(),qe(jt))),Zu=Wp(),Y2=xr(),Pc=TN(Ve()),_J=Yp(),TJ=Yd(),J2=32,IJ="0".repeat(16),gg=class t{constructor(e,r){if(!e){this.publicKey=b.Buffer.from([]),this.hrp=r||Zu.LibraryConfig.DefaultAddressHrp;return}if(ArrayBuffer.isView(e)){if(e.length!=J2)throw new Pc.ErrAddressCannotCreate(e);this.publicKey=b.Buffer.from(e),this.hrp=r||Zu.LibraryConfig.DefaultAddressHrp;return}if(e instanceof t){if(r)throw new Pc.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");this.publicKey=e.publicKey,this.hrp=e.hrp;return}if(typeof e=="string"){if(t.isValidHex(e)){this.publicKey=b.Buffer.from(e,"hex"),this.hrp=r||Zu.LibraryConfig.DefaultAddressHrp;return}if(r)throw new Pc.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");let{hrp:n,pubkey:i}=X2({value:e,allowCustomHrp:!1});this.publicKey=i,this.hrp=n;return}throw new Pc.ErrAddressCannotCreate(e)}static newFromBech32(e){let{hrp:r,pubkey:n}=X2({value:e,allowCustomHrp:!0});return new t(n,r)}static fromBech32(e){let{hrp:r,pubkey:n}=X2({value:e,allowCustomHrp:!1});return new t(n,r)}static newFromHex(e,r){if(!t.isValidHex(e))throw new Pc.ErrAddressCannotCreate(e);return new t(b.Buffer.from(e,"hex"),r)}static fromHex(e,r){return t.newFromHex(e,r)}static fromAddress(e){return new t(e)}static fromBuffer(e,r){return new t(e,r)}static fromString(e,r){return new t(e,r)}static isValidHex(e){return b.Buffer.from(e,"hex").length==J2}static empty(){return new t("")}static isValid(e){let r=Xu.decodeUnsafe(e),n=r?.prefix,i=r?b.Buffer.from(Xu.fromWords(r.words)):void 0;return!(n!==Zu.LibraryConfig.DefaultAddressHrp||i?.length!==J2)}hex(){return this.toHex()}toHex(){return this.isEmpty()?"":this.publicKey.toString("hex")}bech32(){return this.toBech32()}toBech32(){if(this.isEmpty())return"";let e=Xu.toWords(this.pubkey());return Xu.encode(this.hrp,e)}pubkey(){return this.getPublicKey()}getPublicKey(){return this.publicKey}getHrp(){return this.hrp}isEmpty(){return this.publicKey.length==0}equals(e){return e?this.publicKey.toString()==e.publicKey.toString():!1}toString(){return this.toBech32()}toJSON(){return{bech32:this.toBech32(),pubkey:this.toHex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.isSmartContract()}isSmartContract(){return this.toHex().startsWith(IJ)}};Nn.Address=gg;var Z2=class{constructor(e){this.numberOfShardsWithoutMeta=e||Y2.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META}computeContractAddress(e,r){let n=b.Buffer.alloc(8,0),i=e.getPublicKey(),s=i.slice(30),o=b.Buffer.alloc(8),c=new SJ.default(r.toString()),a=_J.bigIntToBuffer(c);o.write(a.reverse().toString("hex"),"hex");let u=b.Buffer.concat([i,o]),f=TJ("keccak256").update(u).digest(),p=b.Buffer.from(Y2.WasmVirtualMachine,"hex"),S=b.Buffer.concat([n,p,f.slice(10,30),s]);return new gg(S)}getShardOfAddress(e){return this.getShardOfPubkey(e.getPublicKey(),this.numberOfShardsWithoutMeta)}getShardOfPubkey(e,r){let n=parseInt("11",2),i=parseInt("01",2),s=e[31];if(this.isPubkeyOfMetachain(e))return Y2.METACHAIN_ID;let o=s&n;return o>r-1&&(o=s&i),o}isPubkeyOfMetachain(e){let r=b.Buffer.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=b.Buffer.from(e).slice(0,r.length);return!!(r.equals(n)||b.Buffer.alloc(32).equals(b.Buffer.from(e)))}};Nn.AddressComputer=Z2;function X2(t){let e=t.value,r=t.allowCustomHrp,n,i;try{let s=Xu.decode(e);n=s.prefix,i=b.Buffer.from(Xu.fromWords(s.words))}catch(s){throw new Pc.ErrAddressCannotCreate(e,s)}if(!r&&n!=Zu.LibraryConfig.DefaultAddressHrp)throw new Pc.ErrAddressBadHrp(Zu.LibraryConfig.DefaultAddressHrp,n);return{hrp:n,pubkey:i}}});var fi=L(cr=>{"use strict";h();var CJ=cr&&cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xJ=cr&&cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NJ=cr&&cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CJ(e,t,r);return xJ(e,t),e};Object.defineProperty(cr,"__esModule",{value:!0});cr.isEmpty=cr.guardEmpty=cr.guardNotEmpty=cr.guardLength=cr.guardSameLength=cr.guardValueIsSetWithMessage=cr.guardValueIsSet=cr.guardTrue=void 0;var el=NJ(Ve());function OJ(t,e){if(!t)throw new el.ErrInvariantFailed(`[<${e}>] isn't true`)}cr.guardTrue=OJ;function PJ(t,e){IN(`${t} isn't set (null or undefined)`,e)}cr.guardValueIsSet=PJ;function IN(t,e){if(e==null||e===void 0)throw new el.ErrInvariantFailed(t)}cr.guardValueIsSetWithMessage=IN;function RJ(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new el.ErrInvariantFailed("arrays do not have the same length")}cr.guardSameLength=RJ;function MJ(t,e){let r=t.length||0;if(r!=e)throw new el.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}cr.guardLength=MJ;function DJ(t,e){if(eE(t))throw new el.ErrInvariantFailed(`${e} is empty`)}cr.guardNotEmpty=DJ;function BJ(t,e){if(!eE(t))throw new el.ErrInvariantFailed(`${e} is not empty`)}cr.guardEmpty=BJ;function eE(t){return t.isEmpty?t.isEmpty():t.length===0}cr.isEmpty=eE});var CN=L(mg=>{"use strict";h();Object.defineProperty(mg,"__esModule",{value:!0});mg.TypeFormula=void 0;var tE=class{constructor(e,r,n){this.name=e,this.typeParameters=r,this.metadata=n}toString(){let r=this.typeParameters.length>0?`<${this.typeParameters.map(i=>i.toString()).join(", ")}>`:"",n=`${this.name}${r}`;return this.metadata!==void 0?`${n}*${this.metadata}*`:n}};mg.TypeFormula=tE});var xN=L(yg=>{"use strict";h();Object.defineProperty(yg,"__esModule",{value:!0});yg.TypeFormulaParser=void 0;var tl=CN(),Ts=class t{parseExpression(e){e=e.trim();let r=this.tokenizeExpression(e).filter(s=>s!==t.COMMA),n=[];for(let s of r)if(this.isPunctuation(s))if(this.isEndOfTypeParameters(s)){let o=this.acquireTypeWithParameters(n);n.push(o)}else if(this.isBeginningOfTypeParameters(s))n.push(s);else throw new Error(`Unexpected token (punctuation): ${s}`);else n.push(s);if(n.length!==1)throw new Error(`Unexpected stack length at end of parsing: ${n.length}`);if(t.PUNCTUATION.includes(n[0]))throw new Error("Unexpected root element.");let i=n[0];if(i instanceof tl.TypeFormula)return i;if(typeof i=="string")return new tl.TypeFormula(i,[]);throw new Error(`Unexpected item on stack: ${i}`)}tokenizeExpression(e){let r=[],n="";for(let i of e)this.isPunctuation(i)?(n&&(r.push(n.trim()),n=""),r.push(i)):n+=i;return n&&r.push(n.trim()),r}acquireTypeWithParameters(e){let r=this.acquireTypeParameters(e),n=e.pop();if(n==="ManagedDecimal"||n==="ManagedDecimalSigned"){let s=r[0].name;return new tl.TypeFormula(n,[],s)}return new tl.TypeFormula(n,r.reverse())}acquireTypeParameters(e){let r=[];for(;;){let n=e.pop();if(n===void 0)throw new Error("Badly specified type parameters");if(this.isBeginningOfTypeParameters(n))break;if(n instanceof tl.TypeFormula)r.push(n);else if(typeof n=="string")r.push(new tl.TypeFormula(n,[]));else throw new Error(`Unexpected type parameter object in stack: ${n}`)}return r}isPunctuation(e){return t.PUNCTUATION.includes(e)}isEndOfTypeParameters(e){return e===t.END_TYPE_PARAMETERS}isBeginningOfTypeParameters(e){return e===t.BEGIN_TYPE_PARAMETERS}};yg.TypeFormulaParser=Ts;Ts.BEGIN_TYPE_PARAMETERS="<";Ts.END_TYPE_PARAMETERS=">";Ts.COMMA=",";Ts.PUNCTUATION=[Ts.COMMA,Ts.BEGIN_TYPE_PARAMETERS,Ts.END_TYPE_PARAMETERS]});var NN=L(vg=>{"use strict";h();Object.defineProperty(vg,"__esModule",{value:!0});vg.getJavascriptPrototypesInHierarchy=void 0;function LJ(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}vg.getJavascriptPrototypesInHierarchy=LJ});var pr=L(Or=>{"use strict";h();Object.defineProperty(Or,"__esModule",{value:!0});Or.NullType=Or.TypePlaceholder=Or.isTyped=Or.PrimitiveValue=Or.TypedValue=Or.CustomType=Or.PrimitiveType=Or.TypeCardinality=Or.Type=void 0;var rE=NN(),ON=fi(),ca=class t{constructor(e,r=[],n=Jd.fixed(1),i){ON.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n,this.metadata=i}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return rE.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){return this.isGenericType()||this.hasMetadata()?this.getFullNameForGeneric():`multiversx:types:${this.getName()}`}getFullNameForGeneric(){let e=this.getTypeParameters().length>0,r=e?`${this.getTypeParameters().map(i=>i.getFullyQualifiedName()).join(", ")}`:"",n=`multiversx:types:${this.getName()}`;return e&&(n=`${n}<${r}>`),this.metadata!==void 0&&(n=`${n}*${this.metadata}*`),n}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}getMetadata(){return this.metadata}isGenericType(){return this.typeParameters.length>0}hasMetadata(){return!!this.metadata}getFirstTypeParameter(){return ON.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return rE.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Or.Type=ca;ca.ClassName="Type";var Jd=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};Or.TypeCardinality=Jd;Jd.MaxCardinality=4096;var bg=class t extends ca{constructor(e){super(e)}getClassName(){return t.ClassName}};Or.PrimitiveType=bg;bg.ClassName="PrimitiveType";var wg=class t extends ca{getClassName(){return t.ClassName}};Or.CustomType=wg;wg.ClassName="CustomType";var Xd=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return rE.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Or.TypedValue=Xd;Xd.ClassName="TypedValue";var Ag=class t extends Xd{constructor(e){super(e)}getClassName(){return t.ClassName}};Or.PrimitiveValue=Ag;Ag.ClassName="PrimitiveValue";function FJ(t){return t.belongsToTypesystem!==void 0}Or.isTyped=FJ;var Eg=class t extends ca{constructor(){super("...")}getClassName(){return t.ClassName}};Or.TypePlaceholder=Eg;Eg.ClassName="TypePlaceholder";var Sg=class t extends ca{constructor(){super("?")}getClassName(){return t.ClassName}};Or.NullType=Sg;Sg.ClassName="NullType"});var Zd=L(_g=>{"use strict";h();Object.defineProperty(_g,"__esModule",{value:!0});_g.TypeExpressionParser=void 0;var qJ=xN(),UJ=Ve(),kJ=pr(),nE=class{constructor(){this.backingTypeFormulaParser=new qJ.TypeFormulaParser}parse(e){try{return this.doParse(e)}catch(r){throw new UJ.ErrTypingSystem(`Failed to parse type expression: ${e}. Error: ${r}`)}}doParse(e){let r=this.backingTypeFormulaParser.parseExpression(e);return this.typeFormulaToType(r)}typeFormulaToType(e){let r=e.typeParameters.map(n=>this.typeFormulaToType(n));return new kJ.Type(e.name,r,void 0,e.metadata)}};_g.TypeExpressionParser=nE});var sE=L(ua=>{"use strict";h();Object.defineProperty(ua,"__esModule",{value:!0});ua.EndpointParameterDefinition=ua.EndpointModifiers=ua.EndpointDefinition=void 0;var VJ=Zd(),PN="?",HJ="N / A",iE=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?PN:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>eh.fromJSON(s)),n=e.outputs.map(s=>eh.fromJSON(s)),i=new Tg(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};ua.EndpointDefinition=iE;var Tg=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};ua.EndpointModifiers=Tg;var eh=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new VJ.TypeExpressionParser().parse(e.type);return new t(e.name||PN,e.description||HJ,r)}};ua.EndpointParameterDefinition=eh});var rl=L(On=>{"use strict";h();var GJ=On&&On.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zJ=On&&On.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jJ=On&&On.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GJ(e,t,r);return zJ(e,t),e};Object.defineProperty(On,"__esModule",{value:!0});On.Fields=On.Field=On.FieldDefinition=void 0;var oE=jJ(Ve()),QJ=Zd(),aE=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new QJ.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};On.FieldDefinition=aE;var cE=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new oE.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new oE.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};On.Field=cE;var uE=class{static checkTyping(e,r){if(e.length!=r.length)throw new oE.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";h();Object.defineProperty(la,"__esModule",{value:!0});la.EnumValue=la.EnumVariantDefinition=la.EnumType=void 0;var KJ=Ve(),lE=fi(),Ig=rl(),MN=pr(),RN=256,Cg=class t extends MN.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>xg.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>({...n,discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return lE.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return lE.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};la.EnumType=Cg;Cg.ClassName="EnumType";var xg=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],lE.guardTrue(rIg.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Ig.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};la.EnumVariantDefinition=xg;var Ng=class t extends MN.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Ig.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Ig.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new KJ.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};la.EnumValue=Ng;Ng.ClassName="EnumValue"});var BN=L(nl=>{"use strict";h();Object.defineProperty(nl,"__esModule",{value:!0});nl.EventTopicDefinition=nl.EventDefinition=void 0;var WJ=Zd(),DN="?",fE=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?DN:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>Og.fromJSON(n));return new t(e.identifier,r)}};nl.EventDefinition=fE;var Og=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new WJ.TypeExpressionParser().parse(e.type);return new t({name:e.name||DN,type:r,indexed:e.indexed})}};nl.EventTopicDefinition=Og});var sl=L(il=>{"use strict";h();Object.defineProperty(il,"__esModule",{value:!0});il.Struct=il.StructType=void 0;var $J=Ve(),Pg=rl(),LN=pr(),Rg=class t extends LN.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Pg.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Pg.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};il.StructType=Rg;Rg.ClassName="StructType";var Mg=class t extends LN.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Pg.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new $J.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return Pg.Fields.equals(r,n)}};il.Struct=Mg;Mg.ClassName="Struct"});var al=L(ol=>{"use strict";h();Object.defineProperty(ol,"__esModule",{value:!0});ol.AddressValue=ol.AddressType=void 0;var YJ=Nt(),FN=pr(),rh=class t extends FN.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};ol.AddressType=rh;rh.ClassName="AddressType";var Dg=class t extends FN.PrimitiveValue{constructor(e){super(new rh),this.value=YJ.Address.newFromBech32(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ol.AddressValue=Dg;Dg.ClassName="AddressValue"});var Lg=L(cl=>{"use strict";h();Object.defineProperty(cl,"__esModule",{value:!0});cl.OptionalValue=cl.OptionalType=void 0;var JJ=fi(),nh=pr(),ih=class t extends nh.Type{constructor(e){super("Optional",[e],nh.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(nh.NullType.ClassName);return r||n}};cl.OptionalType=ih;ih.ClassName="OptionalType";var Bg=class t extends nh.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new ih(new nh.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return JJ.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};cl.OptionalValue=Bg;Bg.ClassName="OptionalValue"});var oh=L(ul=>{"use strict";h();Object.defineProperty(ul,"__esModule",{value:!0});ul.BooleanValue=ul.BooleanType=void 0;var qN=pr(),sh=class t extends qN.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};ul.BooleanType=sh;sh.ClassName="BooleanType";var Fg=class t extends qN.PrimitiveValue{constructor(e){super(new sh),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ul.BooleanValue=Fg;Fg.ClassName="BooleanValue"});var fa=L(ll=>{"use strict";h();Object.defineProperty(ll,"__esModule",{value:!0});ll.BytesValue=ll.BytesType=void 0;var UN=pr(),ah=class t extends UN.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};ll.BytesType=ah;ah.ClassName="BytesType";var qg=class t extends UN.PrimitiveValue{constructor(e){super(new ah),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=b.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=b.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};ll.BytesValue=qg;qg.ClassName="BytesValue"});var ch=L(fl=>{"use strict";h();Object.defineProperty(fl,"__esModule",{value:!0});fl.CodeMetadataValue=fl.CodeMetadataType=void 0;var kN=pr(),Ug=class extends kN.PrimitiveType{constructor(){super("CodeMetadata")}};fl.CodeMetadataType=Ug;var dE=class extends kN.PrimitiveValue{constructor(e){super(new Ug),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};fl.CodeMetadataValue=dE});var Vg=L(dl=>{"use strict";h();Object.defineProperty(dl,"__esModule",{value:!0});dl.CompositeValue=dl.CompositeType=void 0;var XJ=fi(),hE=pr(),uh=class t extends hE.Type{constructor(...e){super("Composite",e,hE.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};dl.CompositeType=uh;uh.ClassName="CompositeType";var kg=class t extends hE.TypedValue{constructor(e,r){super(e),XJ.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new uh(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.CollectionOfTypedValues=void 0;var pE=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Is,"__esModule",{value:!0});Is.List=Is.OptionValue=Is.ListType=Is.OptionType=void 0;var ZJ=fi(),eX=gE(),Mc=pr(),Rc=class t extends Mc.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Mc.NullType.ClassName);return r||n}};Is.OptionType=Rc;Rc.ClassName="OptionType";var lh=class t extends Mc.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};Is.ListType=lh;lh.ClassName="ListType";var Gg=class t extends Mc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Rc(new Mc.NullType);return new t(e)}static newMissingTyped(e){return new t(new Rc(e))}static newProvided(e){let r=new Rc(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return ZJ.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};Is.OptionValue=Gg;Gg.ClassName="OptionValue";var zg=class t extends Mc.TypedValue{constructor(e,r){super(e),this.backingCollection=new eX.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Mc.TypePlaceholder,[]);let r=e[0].getType(),n=new lh(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Is.List=zg;zg.ClassName="List"});var Kg=L(hl=>{"use strict";h();Object.defineProperty(hl,"__esModule",{value:!0});hl.ArrayVec=hl.ArrayVecType=void 0;var VN=fi(),tX=gE(),HN=pr(),jg=class t extends HN.Type{constructor(e,r){super("Array",[r]),VN.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};hl.ArrayVecType=jg;jg.ClassName="ArrayVecType";var Qg=class t extends HN.TypedValue{constructor(e,r){super(e),VN.guardLength(r,e.length),this.backingCollection=new tX.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};hl.ArrayVec=Qg;Qg.ClassName="ArrayVec"});var hh=L(pl=>{"use strict";h();Object.defineProperty(pl,"__esModule",{value:!0});pl.H256Value=pl.H256Type=void 0;var GN=pr(),dh=class t extends GN.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};pl.H256Type=dh;dh.ClassName="H256Type";var Wg=class t extends GN.PrimitiveValue{constructor(e){super(new dh),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};pl.H256Value=Wg;Wg.ClassName="H256Value"});var Yg=L(da=>{"use strict";h();var rX=da&&da.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(da,"__esModule",{value:!0});da.ManagedDecimalValue=da.ManagedDecimalType=void 0;var zN=rX((qt(),qe(jt))),jN=pr(),ph=class t extends jN.Type{constructor(e){super("ManagedDecimal",void 0,void 0,e)}getClassName(){return t.ClassName}getMetadata(){return this.metadata}isVariable(){return this.metadata=="usize"}};da.ManagedDecimalType=ph;ph.ClassName="ManagedDecimalType";var $g=class t extends jN.TypedValue{constructor(e,r,n=!1){super(new ph(n?"usize":r)),this.value=new zN.default(e),this.scale=r,this.variable=n}getClassName(){return t.ClassName}getScale(){return this.scale}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}equals(e){return this.getPrecision()!=e.getPrecision()?!1:new zN.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}};da.ManagedDecimalValue=$g;$g.ClassName="ManagedDecimalValue"});var Xg=L(ha=>{"use strict";h();var nX=ha&&ha.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ha,"__esModule",{value:!0});ha.ManagedDecimalSignedValue=ha.ManagedDecimalSignedType=void 0;var QN=nX((qt(),qe(jt))),KN=pr(),gh=class t extends KN.Type{constructor(e){super("ManagedDecimalSigned",void 0,void 0,e)}getClassName(){return t.ClassName}getMetadata(){return this.metadata}isVariable(){return this.metadata=="usize"}};ha.ManagedDecimalSignedType=gh;gh.ClassName="ManagedDecimalSignedType";var Jg=class t extends KN.TypedValue{constructor(e,r,n=!1){super(new gh(n?"usize":r)),this.value=new QN.default(e),this.scale=r,this.variable=n}getClassName(){return t.ClassName}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}getScale(){return this.scale}equals(e){return this.getPrecision()!=e.getPrecision()?!1:new QN.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}};ha.ManagedDecimalSignedValue=Jg;Jg.ClassName="ManagedDecimalSignedValue"});var em=L(gl=>{"use strict";h();Object.defineProperty(gl,"__esModule",{value:!0});gl.NothingValue=gl.NothingType=void 0;var WN=pr(),mh=class t extends WN.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};gl.NothingType=mh;mh.ClassName="NothingType";var Zg=class t extends WN.PrimitiveValue{constructor(){super(new mh)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};gl.NothingValue=Zg;Zg.ClassName="NothingValue"});var Ch=L(Ee=>{"use strict";h();var iX=Ee&&Ee.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sX=Ee&&Ee.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oX=Ee&&Ee.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iX(e,t,r);return sX(e,t),e},aX=Ee&&Ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.BigIntValue=Ee.BigUIntValue=Ee.I64Value=Ee.U64Value=Ee.I32Value=Ee.U32Value=Ee.I16Value=Ee.U16Value=Ee.I8Value=Ee.U8Value=Ee.NumericalValue=Ee.BigIntType=Ee.BigUIntType=Ee.I64Type=Ee.U64Type=Ee.I32Type=Ee.U32Type=Ee.I16Type=Ee.U16Type=Ee.I8Type=Ee.U8Type=Ee.NumericalType=void 0;var cX=aX((qt(),qe(jt))),$N=oX(Ve()),YN=pr(),Pn=class t extends YN.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ee.NumericalType=Pn;Pn.ClassName="NumericalType";var yh=class t extends Pn{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ee.U8Type=yh;yh.ClassName="U8Type";var vh=class t extends Pn{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ee.I8Type=vh;vh.ClassName="I8Type";var bh=class t extends Pn{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ee.U16Type=bh;bh.ClassName="U16Type";var wh=class t extends Pn{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ee.I16Type=wh;wh.ClassName="I16Type";var Ah=class t extends Pn{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ee.U32Type=Ah;Ah.ClassName="U32Type";var Eh=class t extends Pn{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ee.I32Type=Eh;Eh.ClassName="I32Type";var Sh=class t extends Pn{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ee.U64Type=Sh;Sh.ClassName="U64Type";var _h=class t extends Pn{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ee.I64Type=_h;_h.ClassName="I64Type";var Th=class t extends Pn{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ee.BigUIntType=Th;Th.ClassName="BigUIntType";var Ih=class t extends Pn{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ee.BigIntType=Ih;Ih.ClassName="BigIntType";var Rn=class t extends YN.PrimitiveValue{constructor(e,r){if(super(e),typeof r=="bigint"&&(r=r.toString()),this.value=new cX.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new $N.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new $N.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ee.NumericalValue=Rn;Rn.ClassName="NumericalValue";var tm=class t extends Rn{constructor(e){super(new yh,e)}getClassName(){return t.ClassName}};Ee.U8Value=tm;tm.ClassName="U8Value";var rm=class t extends Rn{constructor(e){super(new vh,e)}getClassName(){return t.ClassName}};Ee.I8Value=rm;rm.ClassName="I8Value";var nm=class t extends Rn{constructor(e){super(new bh,e)}getClassName(){return t.ClassName}};Ee.U16Value=nm;nm.ClassName="U16Value";var im=class t extends Rn{constructor(e){super(new wh,e)}getClassName(){return t.ClassName}};Ee.I16Value=im;im.ClassName="I16Value";var sm=class t extends Rn{constructor(e){super(new Ah,e)}getClassName(){return t.ClassName}};Ee.U32Value=sm;sm.ClassName="U32Value";var om=class t extends Rn{constructor(e){super(new Eh,e)}getClassName(){return t.ClassName}};Ee.I32Value=om;om.ClassName="I32Value";var am=class t extends Rn{constructor(e){super(new Sh,e)}getClassName(){return t.ClassName}};Ee.U64Value=am;am.ClassName="U64Value";var cm=class t extends Rn{constructor(e){super(new _h,e)}getClassName(){return t.ClassName}};Ee.I64Value=cm;cm.ClassName="I64Value";var um=class t extends Rn{constructor(e){super(new Th,e)}getClassName(){return t.ClassName}};Ee.BigUIntValue=um;um.ClassName="BigUIntValue";var lm=class t extends Rn{constructor(e){super(new Ih,e)}getClassName(){return t.ClassName}};Ee.BigIntValue=lm;lm.ClassName="BigIntValue"});var dm=L(ml=>{"use strict";h();Object.defineProperty(ml,"__esModule",{value:!0});ml.StringValue=ml.StringType=void 0;var JN=pr(),xh=class t extends JN.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};ml.StringType=xh;xh.ClassName="StringType";var fm=class t extends JN.PrimitiveValue{constructor(e){super(new xh),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=b.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};ml.StringValue=fm;fm.ClassName="StringValue"});var vl=L(yl=>{"use strict";h();Object.defineProperty(yl,"__esModule",{value:!0});yl.TokenIdentifierValue=yl.TokenIdentifierType=void 0;var XN=pr(),uX="EGLD",Nh=class t extends XN.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};yl.TokenIdentifierType=Nh;Nh.ClassName="TokenIdentifierType";var hm=class t extends XN.PrimitiveValue{constructor(e){super(new Nh),this.value=e}static egld(){return new t(uX)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};yl.TokenIdentifierValue=hm;hm.ClassName="TokenIdentifierValue"});var gm=L(di=>{"use strict";h();var lX=di&&di.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fX=di&&di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dX=di&&di.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lX(e,t,r);return fX(e,t),e};Object.defineProperty(di,"__esModule",{value:!0});di.Tuple=di.TupleType=void 0;var hX=dX(Ve()),ZN=rl(),eO=sl(),Oh=class t extends eO.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new ZN.FieldDefinition(tO(i),"anonymous tuple field",n))}};di.TupleType=Oh;Oh.ClassName="TupleType";function tO(t){return`field${t}`}var pm=class t extends eO.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new hX.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Oh(...r),i=e.map((s,o)=>new ZN.Field(s,tO(o)));return new t(n,i)}};di.Tuple=pm;pm.ClassName="Tuple"});var vm=L(pa=>{"use strict";h();Object.defineProperty(pa,"__esModule",{value:!0});pa.VariadicValue=pa.CountedVariadicType=pa.VariadicType=void 0;var bl=pr(),Dc=class t extends bl.Type{constructor(e,r=!1){super("Variadic",[e],bl.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};pa.VariadicType=Dc;Dc.ClassName="VariadicType";var mm=class extends bl.Type{constructor(e){super("Variadic",[e],bl.TypeCardinality.variable())}getClassName(){return Dc.ClassName}};pa.CountedVariadicType=mm;mm.ClassName="VariadicType";var ym=class t extends bl.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Dc(new bl.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Dc(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();var pX=xs&&xs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gX=xs&&xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mX=xs&&xs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pX(e,t,r);return gX(e,t),e};Object.defineProperty(xs,"__esModule",{value:!0});xs.TypeMapper=void 0;var rO=mX(Ve()),yX=al(),mE=Lg(),vX=oh(),bX=fa(),wX=ch(),bm=Vg(),yE=th(),AX=rl(),nO=fh(),Cs=Kg(),EX=hh(),SX=Yg(),_X=Xg(),iO=em(),hi=Ch(),TX=dm(),sO=sl(),oO=vl(),ga=gm(),wm=vm(),vE=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new nO.OptionType(r[0])],["List",(...r)=>new nO.ListType(r[0])],["VarArgs",(...r)=>new wm.VariadicType(r[0])],["MultiResultVec",(...r)=>new wm.VariadicType(r[0])],["variadic",(...r)=>new wm.VariadicType(r[0])],["counted-variadic",(...r)=>new wm.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new mE.OptionalType(r[0])],["optional",(...r)=>new mE.OptionalType(r[0])],["OptionalResult",(...r)=>new mE.OptionalType(r[0])],["multi",(...r)=>new bm.CompositeType(...r)],["MultiArg",(...r)=>new bm.CompositeType(...r)],["MultiResult",(...r)=>new bm.CompositeType(...r)],["multi",(...r)=>new bm.CompositeType(...r)],["tuple",(...r)=>new ga.TupleType(...r)],["tuple2",(...r)=>new ga.TupleType(...r)],["tuple3",(...r)=>new ga.TupleType(...r)],["tuple4",(...r)=>new ga.TupleType(...r)],["tuple5",(...r)=>new ga.TupleType(...r)],["tuple6",(...r)=>new ga.TupleType(...r)],["tuple7",(...r)=>new ga.TupleType(...r)],["tuple8",(...r)=>new ga.TupleType(...r)],["array2",(...r)=>new Cs.ArrayVecType(2,r[0])],["array8",(...r)=>new Cs.ArrayVecType(8,r[0])],["array16",(...r)=>new Cs.ArrayVecType(16,r[0])],["array20",(...r)=>new Cs.ArrayVecType(20,r[0])],["array32",(...r)=>new Cs.ArrayVecType(32,r[0])],["array46",(...r)=>new Cs.ArrayVecType(46,r[0])],["array48",(...r)=>new Cs.ArrayVecType(48,r[0])],["array64",(...r)=>new Cs.ArrayVecType(64,r[0])],["array128",(...r)=>new Cs.ArrayVecType(128,r[0])],["array256",(...r)=>new Cs.ArrayVecType(256,r[0])],["ManagedDecimal",(...r)=>new SX.ManagedDecimalType(r)],["ManagedDecimalSigned",(...r)=>new _X.ManagedDecimalSignedType(r)]]),this.closedTypesMap=new Map([["u8",new hi.U8Type],["u16",new hi.U16Type],["u32",new hi.U32Type],["u64",new hi.U64Type],["U64",new hi.U64Type],["BigUint",new hi.BigUIntType],["i8",new hi.I8Type],["i16",new hi.I16Type],["i32",new hi.I32Type],["i64",new hi.I64Type],["Bigint",new hi.BigIntType],["BigInt",new hi.BigIntType],["bool",new vX.BooleanType],["bytes",new bX.BytesType],["Address",new yX.AddressType],["H256",new EX.H256Type],["utf-8 string",new TX.StringType],["TokenIdentifier",new oO.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new oO.TokenIdentifierType],["CodeMetadata",new wX.CodeMetadataType],["nothing",new iO.NothingType],["AsyncCall",new iO.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)r.getName()==="ManagedDecimal"||r.getName()==="ManagedDecimalSigned"?this.learnedTypesMap.set(`${r.getName()}_${r.getMetadata()}`,r):this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new rO.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=e.hasMetadata(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let s=this.closedTypesMap.get(e.getName());return s||(e.hasExactClass(yE.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(sO.StructType.ClassName)?this.mapStructType(e):r||n?this.mapGenericType(e):null)}learnType(e){if(e.getName()==="ManagedDecimal"||e.getName()==="ManagedDecimalSigned"){let r=`${e.getName()}_${e.getMetadata()}`;this.learnedTypesMap.delete(r),this.learnedTypesMap.set(r,e)}else{let r=e.getName();this.learnedTypesMap.delete(r),this.learnedTypesMap.set(r,e)}}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new sO.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new yE.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new yE.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new AX.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new rO.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return e.hasMetadata()?i(e.getMetadata()):i(...n)}};xs.TypeMapper=vE});var lO=L(Ns=>{"use strict";h();var IX=Ns&&Ns.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CX=Ns&&Ns.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xX=Ns&&Ns.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IX(e,t,r);return CX(e,t),e};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.AbiRegistry=void 0;var aO=xX(Ve()),Ph=fi(),wl=sE(),cO=th(),AE=BN(),uO=sl(),NX=bE(),OX="?",EE=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.upgradeConstructorDefinition=e.upgradeConstructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||OX,n=e.constructor||{},i=e.upgradeConstructor||{},s=e.endpoints||[],o=e.types||{},c=e.events||[],a=wl.EndpointDefinition.fromJSON({name:"constructor",...n}),u=wl.EndpointDefinition.fromJSON({name:"upgradeConstructor",...i}),f=s.map(R=>wl.EndpointDefinition.fromJSON(R)),p=[];for(let R in o){let D=o[R];if(D.type=="struct")p.push(uO.StructType.fromJSON({name:R,fields:D.fields}));else if(D.type=="enum"||D.type=="explicit-enum")p.push(cO.EnumType.fromJSON({name:R,variants:D.variants}));else throw new aO.ErrTypingSystem(`Cannot handle custom type: ${R}`)}let S=c.map(R=>AE.EventDefinition.fromJSON(R));return new t({name:r,constructorDefinition:a,upgradeConstructorDefinition:u,endpoints:f,customTypes:p,events:S}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Ph.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(uO.StructType.ClassName));return Ph.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(cO.EnumType.ClassName));return Ph.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Ph.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Ph.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new NX.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new aO.ErrTypingSystem("Did not re-map all custom types");let n=wE(this.constructorDefinition,e),i=this.upgradeConstructorDefinition?wE(this.upgradeConstructorDefinition,e):void 0,s=[];for(let a of this.endpoints)s.push(wE(a,e));let o=this.events.map(a=>PX(a,e));return new t({name:this.name,constructorDefinition:n,upgradeConstructorDefinition:i,endpoints:s,customTypes:r,events:o})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(c=>c.getName()==e.getName())>=0)return;for(let c of e.getNamesOfDependencies()){let a=r.find(u=>u.getName()==c);a&&this.mapCustomTypeDepthFirst(a,r,n,i)}let o=n.mapType(e);i.push(o)}};Ns.AbiRegistry=EE;function wE(t,e){let r=t.input.map(i=>new wl.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new wl.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new wl.EndpointDefinition(t.name,r,n,t.modifiers)}function PX(t,e){let r=t.inputs.map(n=>new AE.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new AE.EventDefinition(t.identifier,r)}});var dO=L(Al=>{"use strict";h();Object.defineProperty(Al,"__esModule",{value:!0});Al.createListOfTokenIdentifiers=Al.createListOfAddresses=void 0;var RX=al(),fO=fh(),MX=vl();function DX(t){let e=t.map(n=>new RX.AddressValue(n));return fO.List.fromItems(e)}Al.createListOfAddresses=DX;function BX(t){let e=t.map(n=>new MX.TokenIdentifierValue(n));return fO.List.fromItems(e)}Al.createListOfTokenIdentifiers=BX});var NO=L(ln=>{"use strict";h();var LX=ln&&ln.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FX=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qX=ln&&ln.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LX(e,t,r);return FX(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.onPrimitiveTypeSelect=ln.onPrimitiveValueSelect=ln.onTypedValueSelect=ln.onTypeSelect=void 0;var Em=qX(Ve()),hO=al(),pO=oh(),gO=fa(),mO=ch(),yO=th(),Am=fh(),vO=hh(),bO=Ch(),wO=em(),AO=sl(),EO=vl(),SO=gm(),_O=pr(),TO=Kg(),IO=dm(),CO=Yg(),xO=Xg();function UX(t,e){if(t.hasExactClass(Am.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Am.ListType.ClassName))return e.onList();if(t.hasExactClass(TO.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(_O.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(AO.StructType.ClassName))return e.onStruct();if(t.hasExactClass(SO.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(yO.EnumType.ClassName))return e.onEnum();if(t.hasExactClass(CO.ManagedDecimalType.ClassName))return e.onManagedDecimal();if(t.hasExactClass(xO.ManagedDecimalSignedType.ClassName))return e.onManagedDecimalSigned();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`type isn't known: ${t}`)}ln.onTypeSelect=UX;function kX(t,e){if(t.hasClassOrSuperclass(_O.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Am.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Am.List.ClassName))return e.onList();if(t.hasExactClass(TO.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(AO.Struct.ClassName))return e.onStruct();if(t.hasExactClass(SO.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(yO.EnumValue.ClassName))return e.onEnum();if(t.hasExactClass(CO.ManagedDecimalValue.ClassName))return e.onManagedDecimal();if(t.hasExactClass(xO.ManagedDecimalSignedValue.ClassName))return e.onManagedDecimalSigned();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`value isn't typed: ${t}`)}ln.onTypedValueSelect=kX;function VX(t,e){if(t.hasExactClass(pO.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(bO.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(hO.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(gO.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(IO.StringValue.ClassName))return e.onString();if(t.hasExactClass(vO.H256Value.ClassName))return e.onH256();if(t.hasExactClass(EO.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(mO.CodeMetadataValue.ClassName))return e.onCodeMetadata();if(t.hasExactClass(wO.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}ln.onPrimitiveValueSelect=VX;function HX(t,e){if(t.hasExactClass(pO.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(bO.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(hO.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(gO.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(IO.StringType.ClassName))return e.onString();if(t.hasExactClass(vO.H256Type.ClassName))return e.onH256();if(t.hasExactClass(EO.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(mO.CodeMetadataType.ClassName))return e.onCodeMetadata();if(t.hasExactClass(wO.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`type isn't a known primitive: ${t}`)}ln.onPrimitiveTypeSelect=HX});var dr=L(st=>{"use strict";h();var GX=st&&st.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jt=st&&st.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GX(e,t,r)};Object.defineProperty(st,"__esModule",{value:!0});Jt(lO(),st);Jt(al(),st);Jt(Lg(),st);Jt(oh(),st);Jt(fa(),st);Jt(ch(),st);Jt(Vg(),st);Jt(sE(),st);Jt(th(),st);Jt(dO(),st);Jt(rl(),st);Jt(fh(),st);Jt(Kg(),st);Jt(hh(),st);Jt(NO(),st);Jt(em(),st);Jt(Ch(),st);Jt(dm(),st);Jt(sl(),st);Jt(vl(),st);Jt(gm(),st);Jt(Zd(),st);Jt(bE(),st);Jt(pr(),st);Jt(vm(),st);Jt(Yg(),st);Jt(Xg(),st)});var PO=L(Os=>{"use strict";h();var zX=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jX=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QX=Os&&Os.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zX(e,t,r);return jX(e,t),e};Object.defineProperty(Os,"__esModule",{value:!0});Os.OptionValueBinaryCodec=void 0;var OO=QX(Ve()),Sm=dr(),SE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Sm.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new OO.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Sm.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Sm.OptionValue(r);if(e[0]!=1)throw new OO.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Sm.OptionValue(r,n)}encodeNested(e){return e.isSet()?b.Buffer.concat([b.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):b.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?b.Buffer.concat([b.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):b.Buffer.from([])}};Os.OptionValueBinaryCodec=SE});var RO=L(_m=>{"use strict";h();Object.defineProperty(_m,"__esModule",{value:!0});_m.AddressBinaryCodec=void 0;var KX=Nt(),WX=dr(),_E=class{decodeNested(e){let r=e.slice(0,32),n=new KX.Address(r);return[new WX.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};_m.AddressBinaryCodec=_E});var DO=L(Ps=>{"use strict";h();var $X=Ps&&Ps.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YX=Ps&&Ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JX=Ps&&Ps.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$X(e,t,r);return YX(e,t),e};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.BooleanBinaryCodec=void 0;var XX=JX(Ve()),MO=dr(),Rh=class t{decodeNested(e){let r=e.readUInt8(0);return[new MO.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new XX.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new MO.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?b.Buffer.from([t.TRUE]):b.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?b.Buffer.from([t.TRUE]):b.Buffer.from([])}};Ps.BooleanBinaryCodec=Rh;Rh.TRUE=1;Rh.FALSE=0});var El=L(Tm=>{"use strict";h();Object.defineProperty(Tm,"__esModule",{value:!0});Tm.SizeOfU32=void 0;Tm.SizeOfU32=4});var LO=L(Sl=>{"use strict";h();var ZX=Sl&&Sl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.NumericalBinaryCodec=void 0;var Mh=ZX((qt(),qe(jt))),TE=dr(),BO=El(),Er=na(),IE=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=BO.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),c=i+n;return[o,c]}decodeTopLevel(e,r){let n=Er.cloneBuffer(e);if(e.length==0)return new TE.NumericalValue(r,new Mh.default(0));if(!r.withSign||Er.isMsbZero(n)){let u=Er.bufferToBigInt(n);return new TE.NumericalValue(r,u)}Er.flipBufferBitsInPlace(n);let a=Er.bufferToBigInt(n).multipliedBy(new Mh.default(-1)).minus(new Mh.default(1));return new TE.NumericalValue(r,a)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=b.Buffer.alloc(BO.SizeOfU32);return n.writeUInt32BE(r.length),b.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return b.Buffer.alloc(r,0);if(!e.withSign){let o=Er.bigIntToBuffer(e.value),c=b.Buffer.alloc(r-o.length,0);return b.Buffer.concat([c,o])}if(e.value.isPositive()){let o=Er.bigIntToBuffer(e.value);Er.isMsbOne(o)&&(o=Er.prependByteToBuffer(o,0));let c=b.Buffer.alloc(r-o.length,0);return b.Buffer.concat([c,o])}let n=e.value.plus(new Mh.default(1)),i=Er.bigIntToBuffer(n);Er.flipBufferBitsInPlace(i),Er.isMsbZero(i)&&(i=Er.prependByteToBuffer(i,255));let s=b.Buffer.alloc(r-i.length,255);return b.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?b.Buffer.alloc(0):r?this.encodePrimitive(e):Er.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=Er.bigIntToBuffer(e.value);return Er.isMsbOne(i)&&(i=Er.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Mh.default(1)),n=Er.bigIntToBuffer(r);return Er.flipBufferBitsInPlace(n),Er.isMsbZero(n)&&(n=Er.prependByteToBuffer(n,255)),n}};Sl.NumericalBinaryCodec=IE});var FO=L(Im=>{"use strict";h();Object.defineProperty(Im,"__esModule",{value:!0});Im.H256BinaryCodec=void 0;var eZ=hh(),CE=class{decodeNested(e){let r=e.slice(0,32);return[new eZ.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Im.H256BinaryCodec=CE});var Nm=L(xm=>{"use strict";h();Object.defineProperty(xm,"__esModule",{value:!0});xm.BytesBinaryCodec=void 0;var qO=fa(),Cm=El(),xE=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(Cm.SizeOfU32,Cm.SizeOfU32+r);return[new qO.BytesValue(n),Cm.SizeOfU32+r]}decodeTopLevel(e){return new qO.BytesValue(e)}encodeNested(e){let r=b.Buffer.alloc(Cm.SizeOfU32);return r.writeUInt32BE(e.getLength()),b.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};xm.BytesBinaryCodec=xE});var kO=L(Om=>{"use strict";h();Object.defineProperty(Om,"__esModule",{value:!0});Om.TokenIdentifierCodec=void 0;var tZ=fa(),UO=vl(),rZ=Nm(),NE=class{constructor(){this.bytesCodec=new rZ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new UO.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new UO.TokenIdentifierValue(r.toString())}encodeNested(e){let r=tZ.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return b.Buffer.from(e.valueOf())}};Om.TokenIdentifierCodec=NE});var Rm=L(Pm=>{"use strict";h();Object.defineProperty(Pm,"__esModule",{value:!0});Pm.CodeMetadata=void 0;var _l=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBytes(e){return t.fromBuffer(b.Buffer.from(e))}static fromBuffer(e){if(e.length{"use strict";h();Object.defineProperty(Mm,"__esModule",{value:!0});Mm.CodeMetadataCodec=void 0;var VO=Rm(),HO=ch(),OE=class{decodeNested(e){let r=VO.CodeMetadata.fromBuffer(e);return[new HO.CodeMetadataValue(r),length]}decodeTopLevel(e){let r=VO.CodeMetadata.fromBuffer(e);return new HO.CodeMetadataValue(r)}encodeNested(e){return e.valueOf().toBuffer()}encodeTopLevel(e){return e.valueOf().toBuffer()}};Mm.CodeMetadataCodec=OE});var jO=L(Dm=>{"use strict";h();Object.defineProperty(Dm,"__esModule",{value:!0});Dm.NothingCodec=void 0;var zO=dr(),PE=class{decodeNested(){return[new zO.NothingValue,0]}decodeTopLevel(){return new zO.NothingValue}encodeNested(){return b.Buffer.from([])}encodeTopLevel(){return b.Buffer.from([])}};Dm.NothingCodec=PE});var KO=L(Bm=>{"use strict";h();Object.defineProperty(Bm,"__esModule",{value:!0});Bm.StringBinaryCodec=void 0;var QO=dr(),nZ=fa(),iZ=Nm(),RE=class{constructor(){this.bytesBinaryCodec=new iZ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new QO.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new QO.StringValue(e.toString())}encodeNested(e){let r=nZ.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return b.Buffer.from(e.valueOf())}};Bm.StringBinaryCodec=RE});var WO=L(Fm=>{"use strict";h();Object.defineProperty(Fm,"__esModule",{value:!0});Fm.PrimitiveBinaryCodec=void 0;var Lm=dr(),sZ=RO(),oZ=DO(),aZ=LO(),cZ=FO(),uZ=Nm(),lZ=kO(),fZ=GO(),dZ=jO(),hZ=KO(),ME=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new oZ.BooleanBinaryCodec,this.numericalCodec=new aZ.NumericalBinaryCodec,this.addressCodec=new sZ.AddressBinaryCodec,this.h256Codec=new cZ.H256BinaryCodec,this.bytesCodec=new uZ.BytesBinaryCodec,this.stringCodec=new hZ.StringBinaryCodec,this.tokenIdentifierCodec=new lZ.TokenIdentifierCodec,this.codeMetadataCodec=new fZ.CodeMetadataCodec,this.nothingCodec=new dZ.NothingCodec}decodeNested(e,r){return Lm.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return Lm.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return Lm.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),onCodeMetadata:()=>this.codeMetadataCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return Lm.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),onCodeMetadata:()=>this.codeMetadataCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};Fm.PrimitiveBinaryCodec=ME});var JO=L(qm=>{"use strict";h();Object.defineProperty(qm,"__esModule",{value:!0});qm.ListBinaryCodec=void 0;var $O=dr(),YO=El(),DE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,c=YO.SizeOfU32;e=o.slice(c);for(let a=0;a0;){let[c,a]=this.binaryCodec.decodeNested(e,n);i.push(c),o+=a,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new $O.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=b.Buffer.alloc(YO.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return b.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return b.Buffer.concat(r)}};qm.ListBinaryCodec=DE});var LE=L(Um=>{"use strict";h();Object.defineProperty(Um,"__esModule",{value:!0});Um.FieldsBinaryCodec=void 0;var pZ=dr(),BE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,c]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(c),i+=c;let a=new pZ.Field(o,s.name);n.push(a)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return b.Buffer.concat(r)}};Um.FieldsBinaryCodec=BE});var qE=L(km=>{"use strict";h();Object.defineProperty(km,"__esModule",{value:!0});km.StructBinaryCodec=void 0;var gZ=dr(),mZ=LE(),FE=class{constructor(e){this.fieldsCodec=new mZ.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new gZ.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};km.StructBinaryCodec=FE});var XO=L(Hm=>{"use strict";h();Object.defineProperty(Hm,"__esModule",{value:!0});Hm.EnumBinaryCodec=void 0;var Vm=dr(),yZ=LE(),UE=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new yZ.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[c,a]=this.fieldsCodec.decodeNested(e,o);return[new Vm.EnumValue(r,s,c),i+a]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Vm.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Vm.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return b.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Vm.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return b.Buffer.concat([o,i])}};Hm.EnumBinaryCodec=UE});var ZO=L(Gm=>{"use strict";h();Object.defineProperty(Gm,"__esModule",{value:!0});Gm.TupleBinaryCodec=void 0;var vZ=qE(),kE=class{constructor(e){this.structCodec=new vZ.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Gm.TupleBinaryCodec=kE});var eP=L(zm=>{"use strict";h();Object.defineProperty(zm,"__esModule",{value:!0});zm.ArrayVecBinaryCodec=void 0;var bZ=dr(),VE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let c=0;c{"use strict";h();var wZ=Il&&Il.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Il,"__esModule",{value:!0});Il.ManagedDecimalCodec=void 0;var AZ=wZ((qt(),qe(jt))),Tl=dr(),EZ=na(),SZ=El(),HE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=e.readUInt32BE(0),i=e.slice(0,n);return[this.decodeTopLevel(i,r),n]}decodeTopLevel(e,r){if(e.length===0)return new Tl.ManagedDecimalValue(new AZ.default(0),0);if(r.isVariable()){let o=e.length-SZ.SizeOfU32,[c]=this.binaryCodec.decodeNested(e.slice(0,o),new Tl.BigUIntType),a=e.readUInt32BE(o);return new Tl.ManagedDecimalValue(c.valueOf().shiftedBy(-a),a)}let n=EZ.bufferToBigInt(e),i=r.getMetadata(),s=i!=="usize"?parseInt(i.toString()):0;return new Tl.ManagedDecimalValue(n.shiftedBy(-s),s)}encodeNested(e){let r=[],n=new Tl.BigUIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(r.push(b.Buffer.from(this.binaryCodec.encodeNested(n))),r.push(b.Buffer.from(this.binaryCodec.encodeNested(new Tl.U32Value(e.getScale()))))):r.push(this.binaryCodec.encodeTopLevel(n)),b.Buffer.concat(r)}encodeTopLevel(e){return this.encodeNested(e)}};Il.ManagedDecimalCodec=HE});var rP=L(xl=>{"use strict";h();var _Z=xl&&xl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xl,"__esModule",{value:!0});xl.ManagedDecimalSignedCodec=void 0;var TZ=_Z((qt(),qe(jt))),Cl=dr(),IZ=na(),CZ=El(),GE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=e.readUInt32BE(0),i=e.slice(0,n);return[this.decodeTopLevel(i,r),n]}decodeTopLevel(e,r){if(e.length===0)return new Cl.ManagedDecimalSignedValue(new TZ.default(0),0);if(r.isVariable()){let o=e.length-CZ.SizeOfU32,[c]=this.binaryCodec.decodeNested(e.slice(0,o),new Cl.BigIntType),a=e.readUInt32BE(o);return new Cl.ManagedDecimalSignedValue(c.valueOf().shiftedBy(-a),a)}let n=IZ.bufferToBigInt(e),i=r.getMetadata(),s=i!=="usize"?parseInt(i.toString()):0;return new Cl.ManagedDecimalSignedValue(n.shiftedBy(-s),s)}encodeNested(e){let r=[],n=new Cl.BigIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(r.push(b.Buffer.from(this.binaryCodec.encodeNested(n))),r.push(b.Buffer.from(this.binaryCodec.encodeNested(new Cl.U32Value(e.getScale()))))):r.push(b.Buffer.from(this.binaryCodec.encodeTopLevel(n))),b.Buffer.concat(r)}encodeTopLevel(e){return this.encodeNested(e)}};xl.ManagedDecimalSignedCodec=GE});var jE=L(pi=>{"use strict";h();var xZ=pi&&pi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NZ=pi&&pi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OZ=pi&&pi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xZ(e,t,r);return NZ(e,t),e};Object.defineProperty(pi,"__esModule",{value:!0});pi.BinaryCodecConstraints=pi.BinaryCodec=void 0;var nP=OZ(Ve()),jm=dr(),iP=fi(),PZ=PO(),RZ=WO(),MZ=JO(),DZ=qE(),BZ=XO(),LZ=ZO(),FZ=eP(),qZ=tP(),UZ=rP(),zE=class{constructor(e=null){this.constraints=e||new Qm,this.optionCodec=new PZ.OptionValueBinaryCodec(this),this.listCodec=new MZ.ListBinaryCodec(this),this.arrayCodec=new FZ.ArrayVecBinaryCodec(this),this.primitiveCodec=new RZ.PrimitiveBinaryCodec(this),this.structCodec=new DZ.StructBinaryCodec(this),this.tupleCodec=new LZ.TupleBinaryCodec(this),this.enumCodec=new BZ.EnumBinaryCodec(this),this.managedDecimalCodec=new qZ.ManagedDecimalCodec(this),this.managedDecimalSignedCodec=new UZ.ManagedDecimalSignedCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),jm.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r),onManagedDecimal:()=>this.managedDecimalCodec.decodeTopLevel(e,r),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=jm.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r),onManagedDecimal:()=>this.managedDecimalCodec.decodeNested(e,r),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return iP.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),jm.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),onManagedDecimal:()=>this.managedDecimalCodec.encodeNested(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeNested(e)})}encodeTopLevel(e){return iP.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),jm.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),onManagedDecimal:()=>this.managedDecimalCodec.encodeTopLevel(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeTopLevel(e)})}};pi.BinaryCodec=zE;var Qm=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new nP.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new nP.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};pi.BinaryCodecConstraints=Qm});var sP=L(gi=>{"use strict";h();var kZ=gi&&gi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gi,"__esModule",{value:!0});gi.decodeBigNumber=gi.decodeString=gi.decodeBool=gi.decodeUnsignedNumber=void 0;var VZ=kZ((qt(),qe(jt))),Km=dr(),HZ=jE(),Wm=new HZ.BinaryCodec;function GZ(t){let e=Wm.decodeTopLevel(t,new Km.BigUIntType);return Number(e.valueOf())}gi.decodeUnsignedNumber=GZ;function zZ(t){return!!Wm.decodeTopLevel(t,new Km.BooleanType).valueOf()}gi.decodeBool=zZ;function jZ(t){let e=Wm.decodeTopLevel(t,new Km.BytesType);return String(e.valueOf())}gi.decodeString=jZ;function QZ(t){let e=Wm.decodeTopLevel(t,new Km.BigUIntType);return new VZ.default(e.valueOf())}gi.decodeBigNumber=QZ});var QE=L(ma=>{"use strict";h();var KZ=ma&&ma.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oP=ma&&ma.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KZ(e,t,r)};Object.defineProperty(ma,"__esModule",{value:!0});oP(jE(),ma);oP(sP(),ma)});var Nl=L($m=>{"use strict";h();Object.defineProperty($m,"__esModule",{value:!0});$m.ArgSerializer=void 0;var aP=xr(),WZ=QE(),cP=dr(),KE=Lg(),WE=Vg(),$E=vm(),$Z={codec:new WZ.BinaryCodec},YE=class{constructor(e){e={...$Z,...e},this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(aP.ARGUMENTS_SEPARATOR).map(r=>b.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let p=0;p=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(aP.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(KE.OptionalValue.ClassName)){let a=o;a.isSet()&&i(a.getTypedValue());return}if(o.hasExactClass($E.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(WE.CompositeValue.ClassName)){let a=o;for(let u of a.getItems())i(u);return}let c=r.codec.encodeTopLevel(o);n.push(c)}function s(o){if(o.getType().isCounted){let a=new cP.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(a))}for(let a of o.getItems())i(a)}return n}};$m.ArgSerializer=YE});var JE=L((n6e,uP)=>{h();Co.notEqual=JZ;Co.notOk=XZ;Co.equal=YZ;Co.ok=Co;uP.exports=Co;function YZ(t,e,r){Co(t==e,r)}function JZ(t,e,r){Co(t!=e,r)}function XZ(t,e){Co(!t,e)}function Co(t,e){if(!t)throw new Error(e||"AssertionError")}});var fP=L((s6e,lP)=>{h();lP.exports=XE;XE.supported=typeof WebAssembly<"u";function XE(t){if(!XE.supported)return null;var e=t&&t.imports,r=ZZ("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(a){i.exports.memory.grow(Math.ceil(Math.abs(a-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(a){if(i.exports)return a();if(n){n.then(a.bind(null,null)).catch(a);return}try{if(t&&t.async)throw new Error("async");c({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(c)}o(a)}function c(a){i.exports=a.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function ZZ(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(eee)):new(wo()).Buffer(t,"base64")}function eee(t){return t.charCodeAt(0)}});var vP=L((u6e,Ms)=>{h();var Rs=JE(),tr=fP()(),xo=64,Ym=[];Ms.exports=mi;var dP=Ms.exports.BYTES_MIN=16,hP=Ms.exports.BYTES_MAX=64,a6e=Ms.exports.BYTES=32,pP=Ms.exports.KEYBYTES_MIN=16,gP=Ms.exports.KEYBYTES_MAX=64,c6e=Ms.exports.KEYBYTES=32,mP=Ms.exports.SALTBYTES=16,yP=Ms.exports.PERSONALBYTES=16;function mi(t,e,r,n,i){if(!(this instanceof mi))return new mi(t,e,r,n,i);if(!(tr&&tr.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(Rs(t>=dP,"digestLength must be at least "+dP+", was given "+t),Rs(t<=hP,"digestLength must be at most "+hP+", was given "+t),e!=null&&Rs(e.length>=pP,"key must be at least "+pP+", was given "+e.length),e!=null&&Rs(e.length<=gP,"key must be at least "+gP+", was given "+e.length),r!=null&&Rs(r.length===mP,"salt must be exactly "+mP+", was given "+r.length),n!=null&&Rs(n.length===yP,"personal must be exactly "+yP+", was given "+n.length)),Ym.length||(Ym.push(xo),xo+=216),this.digestLength=t,this.finalized=!1,this.pointer=Ym.pop(),tr.memory.fill(0,0,64),tr.memory[0]=this.digestLength,tr.memory[1]=e?e.length:0,tr.memory[2]=1,tr.memory[3]=1,r&&tr.memory.set(r,32),n&&tr.memory.set(n,48),this.pointer+216>tr.memory.length&&tr.realloc(this.pointer+216),tr.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),tr.memory.fill(0,xo,xo+e.length),tr.memory[this.pointer+200]=128)}mi.prototype.update=function(t){return Rs(this.finalized===!1,"Hash instance finalized"),Rs(t,"input must be TypedArray or Buffer"),xo+t.length>tr.memory.length&&tr.realloc(xo+t.length),tr.memory.set(t,xo),tr.exports.blake2b_update(this.pointer,xo,xo+t.length),this};mi.prototype.digest=function(t){if(Rs(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Ym.push(this.pointer),tr.exports.blake2b_final(this.pointer),!t||t==="binary")return tr.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return ree(tr.memory,this.pointer+128,this.digestLength);Rs(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{h();var ba=JE(),Bh=vP();function Jm(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function bP(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function IP(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function ya(t,e,r,n,i,s){var o=Dh[i],c=Dh[i+1],a=Dh[s],u=Dh[s+1];Jm(ze,t,e),bP(ze,t,o,c);var f=ze[n]^ze[t],p=ze[n+1]^ze[t+1];ze[n]=p,ze[n+1]=f,Jm(ze,r,n),f=ze[e]^ze[r],p=ze[e+1]^ze[r+1],ze[e]=f>>>24^p<<8,ze[e+1]=p>>>24^f<<8,Jm(ze,t,e),bP(ze,t,a,u),f=ze[n]^ze[t],p=ze[n+1]^ze[t+1],ze[n]=f>>>16^p<<16,ze[n+1]=p>>>16^f<<16,Jm(ze,r,n),f=ze[e]^ze[r],p=ze[e+1]^ze[r+1],ze[e]=p>>>31^f<<1,ze[e+1]=f>>>31^p<<1}var CP=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),iee=[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],fn=new Uint8Array(iee.map(function(t){return t*2})),ze=new Uint32Array(32),Dh=new Uint32Array(32);function xP(t,e){var r=0;for(r=0;r<16;r++)ze[r]=t.h[r],ze[r+16]=CP[r];for(ze[24]=ze[24]^t.t,ze[25]=ze[25]^t.t/4294967296,e&&(ze[28]=~ze[28],ze[29]=~ze[29]),r=0;r<32;r++)Dh[r]=IP(t.b,4*r);for(r=0;r<12;r++)ya(0,8,16,24,fn[r*16+0],fn[r*16+1]),ya(2,10,18,26,fn[r*16+2],fn[r*16+3]),ya(4,12,20,28,fn[r*16+4],fn[r*16+5]),ya(6,14,22,30,fn[r*16+6],fn[r*16+7]),ya(0,10,20,30,fn[r*16+8],fn[r*16+9]),ya(2,12,22,24,fn[r*16+10],fn[r*16+11]),ya(4,14,16,26,fn[r*16+12],fn[r*16+13]),ya(6,8,18,28,fn[r*16+14],fn[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^ze[r]^ze[r+16]}var va=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 Ol(t,e,r,n){va.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,va[0]=t,e&&(va[1]=e.length),va[2]=1,va[3]=1,r&&va.set(r,32),n&&va.set(n,48);for(var i=0;i<16;i++)this.h[i]=CP[i]^IP(va,i*4);e&&(NP(this,e),this.c=128)}Ol.prototype.update=function(t){return ba(t!=null,"input must be Uint8Array or Buffer"),NP(this,t),this};Ol.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return ba(e.length>=this.outlen,"out must have at least outlen bytes of space"),see(this,e),t==="hex"?oee(e):e};Ol.prototype.final=Ol.prototype.digest;Ol.ready=function(t){Bh.ready(function(){t()})};function NP(t,e){for(var r=0;r>2]>>8*(r&3);return e}function oee(t){for(var e="",r=0;r=wP,"outlen must be at least "+wP+", was given "+e),ba(e<=AP,"outlen must be at most "+AP+", was given "+e),r!=null&&ba(r.length>=EP,"key must be at least "+EP+", was given "+r.length),r!=null&&ba(r.length<=SP,"key must be at most "+SP+", was given "+r.length),n!=null&&ba(n.length===_P,"salt must be exactly "+_P+", was given "+n.length),i!=null&&ba(i.length===TP,"personal must be exactly "+TP+", was given "+i.length)),new OP(e,r,n,i)};Mn.exports.ready=function(t){Bh.ready(function(){t()})};Mn.exports.WASM_SUPPORTED=Bh.SUPPORTED;Mn.exports.WASM_LOADED=!1;var wP=Mn.exports.BYTES_MIN=16,AP=Mn.exports.BYTES_MAX=64,f6e=Mn.exports.BYTES=32,EP=Mn.exports.KEYBYTES_MIN=16,SP=Mn.exports.KEYBYTES_MAX=64,d6e=Mn.exports.KEYBYTES=32,_P=Mn.exports.SALTBYTES=16,TP=Mn.exports.PERSONALBYTES=16;Bh.ready(function(t){t||(Mn.exports.WASM_LOADED=!0,OP=Bh)})});var PP=L(Xm=>{"use strict";h();Object.defineProperty(Xm,"__esModule",{value:!0});Xm.Code=void 0;var cee=ZE(),uee=32,eS=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return b.Buffer.from(this.hex,"hex")}computeHash(){let e=cee(uee).update(this.valueOf()).digest();return b.Buffer.from(e)}};Xm.Code=eS});var rS=L(Ds=>{"use strict";h();var lee=Ds&&Ds.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fee=Ds&&Ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dee=Ds&&Ds.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lee(e,t,r);return fee(e,t),e};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.ContractFunction=void 0;var hee=dee(Ve()),tS=class t{constructor(e){if(this.name=e,e==null)throw new hee.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Ds.ContractFunction=tS});var iS=L(Zm=>{"use strict";h();Object.defineProperty(Zm,"__esModule",{value:!0});Zm.Compatibility=void 0;var pee=Nt(),nS=class{static guardAddressIsSetAndNonZero(e,r,n){!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==pee.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`)}};Zm.Compatibility=nS});var No=L(e1=>{"use strict";h();Object.defineProperty(e1,"__esModule",{value:!0});e1.TransactionPayload=void 0;var sS=class t{constructor(e){this.data=b.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=b.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>b.Buffer.from(e,"hex"))}length(){return b.Buffer.from(this.data).length}};e1.TransactionPayload=sS});var Pl=L(t1=>{"use strict";h();Object.defineProperty(t1,"__esModule",{value:!0});t1.TransactionBuilder=void 0;var gee=xr(),mee=Dn(),yee=No(),oS=class{constructor(e){this.config=e.config,this.sender=e.sender,this.receiver=e.receiver,this.dataParts=e.dataParts,this.providedGasLimit=e.gasLimit,this.addDataMovementGas=e.addDataMovementGas,this.amount=e.amount}computeGasLimit(e){return this.addDataMovementGas?this.config.minGasLimit+this.config.gasLimitPerByte*BigInt(e.length())+this.providedGasLimit:this.providedGasLimit}buildTransactionPayload(){let e=this.dataParts.join(gee.ARGUMENTS_SEPARATOR);return new yee.TransactionPayload(e)}build(){let e=this.buildTransactionPayload(),r=this.computeGasLimit(e);return new mee.Transaction({sender:this.sender.bech32(),receiver:this.receiver.bech32(),gasLimit:r,value:this.amount||0n,data:e.valueOf(),chainID:this.config.chainID})}};t1.TransactionBuilder=oS});var RP=L(r1=>{"use strict";h();Object.defineProperty(r1,"__esModule",{value:!0});r1.DelegationTransactionsFactory=void 0;var vee=Nt(),bee=xr(),wee=Ve(),Wn=yi(),Bn=Pl(),aS=class{constructor(e){this.config=e.config,this.argSerializer=new Wn.ArgSerializer,this.delegationManagerAddress=vee.Address.fromHex(bee.DELEGATION_MANAGER_SC_ADDRESS_HEX,this.config.addressHrp)}createTransactionForNewDelegationContract(e){let r=["createNewDelegationContract",...this.argSerializer.valuesToStrings([new Wn.BigUIntValue(e.totalDelegationCap),new Wn.BigUIntValue(e.serviceFee)])],n=this.config.gasLimitCreateDelegationContract+this.config.additionalGasLimitForDelegationOperations;return new Bn.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.delegationManagerAddress,dataParts:r,gasLimit:n,addDataMovementGas:!0,amount:e.amount}).build()}createTransactionForAddingNodes(e){if(e.publicKeys.length!==e.signedMessages.length)throw new wee.Err("The number of public keys should match the number of signed messages");let r=e.signedMessages.map(o=>new Wn.BytesValue(b.Buffer.from(o))),n=this.argSerializer.valuesToStrings(r),i=e.publicKeys.length,s=["addNodes"];for(let o=0;o{h();var MP=(qt(),qe(jt)),DP=BP.exports;(function(){"use strict";function t(u){return u<10?"0"+u:u}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,i,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o;function c(u){return r.lastIndex=0,r.test(u)?'"'+u.replace(r,function(f){var p=s[f];return typeof p=="string"?p:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+u+'"'}function a(u,f){var p,S,I,N,R=n,D,U=f[u],k=U!=null&&(U instanceof MP||MP.isBigNumber(U));switch(U&&typeof U=="object"&&typeof U.toJSON=="function"&&(U=U.toJSON(u)),typeof o=="function"&&(U=o.call(f,u,U)),typeof U){case"string":return k?U:c(U);case"number":return isFinite(U)?String(U):"null";case"boolean":case"null":case"bigint":return String(U);case"object":if(!U)return"null";if(n+=i,D=[],Object.prototype.toString.apply(U)==="[object Array]"){for(N=U.length,p=0;p{h();var Xp=null,JK=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,XK=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,ZK=function(t){"use strict";var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(t!=null){if(t.strict===!0&&(e.strict=!0),t.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=t.alwaysParseAsBig===!0?t.alwaysParseAsBig:!1,e.useNativeBigInt=t.useNativeBigInt===!0?t.useNativeBigInt:!1,typeof t.constructorAction<"u")if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve")e.constructorAction=t.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`);if(typeof t.protoAction<"u")if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve")e.protoAction=t.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}var r,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` -`,r:"\r",t:" "},s,o=function(N){throw{name:"SyntaxError",message:N,at:r,text:s}},u=function(N){return N&&N!==n&&o("Expected '"+N+"' instead of '"+n+"'"),n=s.charAt(r),r+=1,n},a=function(){var N,P="";for(n==="-"&&(P="-",u("-"));n>="0"&&n<="9";)P+=n,u();if(n===".")for(P+=".";u()&&n>="0"&&n<="9";)P+=n;if(n==="e"||n==="E")for(P+=n,u(),(n==="-"||n==="+")&&(P+=n,u());n>="0"&&n<="9";)P+=n,u();if(N=+P,!isFinite(N))o("Bad number");else return Xp==null&&(Xp=(nr(),xe(hr))),P.length>15?e.storeAsString?P:e.useNativeBigInt?BigInt(P):new Xp(P):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(N):new Xp(N):N},c=function(){var N,P,V="",U;if(n==='"')for(var Q=r;u();){if(n==='"')return r-1>Q&&(V+=s.substring(Q,r-1)),u(),V;if(n==="\\"){if(r-1>Q&&(V+=s.substring(Q,r-1)),u(),n==="u"){for(U=0,P=0;P<4&&(N=parseInt(u(),16),!!isFinite(N));P+=1)U=U*16+N;V+=String.fromCharCode(U)}else if(typeof i[n]=="string")V+=i[n];else break;Q=r}}o("Bad string")},f=function(){for(;n&&n<=" ";)u()},d=function(){switch(n){case"t":return u("t"),u("r"),u("u"),u("e"),!0;case"f":return u("f"),u("a"),u("l"),u("s"),u("e"),!1;case"n":return u("n"),u("u"),u("l"),u("l"),null}o("Unexpected '"+n+"'")},w,A=function(){var N=[];if(n==="["){if(u("["),f(),n==="]")return u("]"),N;for(;n;){if(N.push(w()),f(),n==="]")return u("]"),N;u(","),f()}}o("Bad array")},_=function(){var N,P=Object.create(null);if(n==="{"){if(u("{"),f(),n==="}")return u("}"),P;for(;n;){if(N=c(),f(),u(":"),e.strict===!0&&Object.hasOwnProperty.call(P,N)&&o('Duplicate key "'+N+'"'),JK.test(N)===!0?e.protoAction==="error"?o("Object contains forbidden prototype property"):e.protoAction==="ignore"?w():P[N]=w():XK.test(N)===!0?e.constructorAction==="error"?o("Object contains forbidden constructor property"):e.constructorAction==="ignore"?w():P[N]=w():P[N]=w(),f(),n==="}")return u("}"),P;u(","),f()}}o("Bad object")};return w=function(){switch(f(),n){case"{":return _();case"[":return A();case'"':return c();case"-":return a();default:return n>="0"&&n<="9"?a():d()}},function(N,P){var V;return s=N+"",r=0,n=" ",V=w(),f(),n&&o("Syntax error"),typeof P=="function"?function U(Q,L){var k,H,q=Q[L];return q&&typeof q=="object"&&Object.keys(q).forEach(function(v){H=U(q,v),H!==void 0?q[v]=H:delete q[v]}),P.call(Q,L,q)}({"":V},""):V}};CO.exports=ZK});var mE=D((b1e,Zp)=>{h();var xO=TO().stringify,OO=NO();Zp.exports=function(t){return{parse:OO(t),stringify:xO}};Zp.exports.parse=OO();Zp.exports.stringify=xO});var PO=D(gc=>{"use strict";h();var eW=gc&&gc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gc,"__esModule",{value:!0});gc.RelayedTransactionsFactory=void 0;var tW=eW((nr(),xe(hr))),e0=ke(),t0=Ie(),zf=Vn(),DO=en(),rW=mE(),yE=class{constructor(e){this.config=e.config}createRelayedV1Transaction(e){if(!e.innerTransaction.gasLimit)throw new t0.ErrInvalidInnerTransaction("The gas limit is not set for the inner transaction");if(!e.innerTransaction.signature.length)throw new t0.ErrInvalidInnerTransaction("The inner transaction is not signed");let r=this.prepareInnerTransactionForRelayedV1(e.innerTransaction),n=`relayedTx@${p.Buffer.from(r).toString("hex")}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=this.config.minGasLimit+i+e.innerTransaction.gasLimit;return new DO.Transaction({chainID:this.config.chainID,sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,gasLimit:s,data:p.Buffer.from(n)})}createRelayedV2Transaction(e){if(e.innerTransaction.gasLimit)throw new t0.ErrInvalidInnerTransaction("The gas limit should not be set for the inner transaction");if(!e.innerTransaction.signature.length)throw new t0.ErrInvalidInnerTransaction("The inner transaction is not signed");let{argumentsString:r}=new zf.ArgSerializer().valuesToString([new zf.AddressValue(e0.Address.fromBech32(e.innerTransaction.receiver)),new zf.U64Value(new tW.default(e.innerTransaction.nonce.toString())),new zf.BytesValue(p.Buffer.from(e.innerTransaction.data)),new zf.BytesValue(p.Buffer.from(e.innerTransaction.signature))]),n=`relayedTxV2@${r}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=e.innerTransactionGasLimit+this.config.minGasLimit+i;return new DO.Transaction({sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,value:0n,gasLimit:s,chainID:this.config.chainID,data:p.Buffer.from(n),version:e.innerTransaction.version,options:e.innerTransaction.options})}prepareInnerTransactionForRelayedV1(e){let r={nonce:e.nonce,sender:e0.Address.fromBech32(e.sender).pubkey().toString("base64"),receiver:e0.Address.fromBech32(e.receiver).pubkey().toString("base64"),value:e.value,gasPrice:e.gasPrice,gasLimit:e.gasLimit,data:p.Buffer.from(e.data).toString("base64"),signature:p.Buffer.from(e.signature).toString("base64"),chainID:p.Buffer.from(e.chainID).toString("base64"),version:e.version,options:e.options.valueOf()==0?void 0:e.options,guardian:e.guardian?e0.Address.fromBech32(e.guardian).pubkey().toString("base64"):void 0,guardianSignature:e.guardianSignature.length?p.Buffer.from(e.guardianSignature).toString("base64"):void 0,sndUserName:e.senderUsername?p.Buffer.from(e.senderUsername).toString("base64"):void 0,rcvUserName:e.receiverUsername?p.Buffer.from(e.receiverUsername).toString("base64"):void 0};return rW.stringify(r)}};gc.RelayedTransactionsFactory=yE});var RO=D(r0=>{"use strict";h();Object.defineProperty(r0,"__esModule",{value:!0});r0.ArgumentErrorContext=void 0;var nW=Ie(),wE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new nW.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) -Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};r0.ArgumentErrorContext=wE});var n0=D(Fa=>{"use strict";h();var iW=Fa&&Fa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.NativeSerializer=void 0;var sW=iW((nr(),xe(hr))),oW=ke(),vE=Ie(),aW=Du(),uW=RO(),we=$t(),cW;(function(t){function e(L,k){L=L||[],r(L,k),n(k)&&(L=i(L,k));let H=k.input,q=[];for(let v=0;v0&&k[0].type.getCardinality().isComposite()&&(q=1/0,v=!0);for(let C of k){if(C.type.getCardinality().isSingular())break;H-=1}return{min:H,max:q,variadic:v}}t.getArgumentsCardinality=s;function o(L,k,H){if(L&&we.isTyped(L))return L;if(k instanceof we.OptionType)return u(L,k,H);if(k instanceof we.OptionalType)return a(L,k,H);if(k instanceof we.VariadicType)return c(L,k,H);if(k instanceof we.CompositeType)return d(L,k,H);if(k instanceof we.TupleType)return w(L,k,H);if(k instanceof we.StructType)return A(L,k,H);if(k instanceof we.ListType)return f(L,k,H);if(k instanceof we.PrimitiveType)return _(L,k,H);if(k instanceof we.EnumType)return N(L,k,H);H.throwError(`convertToTypedValue: unhandled type ${k}`)}function u(L,k,H){if(L==null)return we.OptionValue.newMissing();let q=o(L,k.getFirstTypeParameter(),H);return we.OptionValue.newProvided(q)}function a(L,k,H){if(L==null)return new we.OptionalValue(k);let q=o(L,k.getFirstTypeParameter(),H);return new we.OptionalValue(k,q)}function c(L,k,H){if(k.isCounted)throw new vE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');L==null&&(L=[]),L.map===void 0&&H.convertError(L,"Variadic");let q=L.map(function(v){return o(v,k.getFirstTypeParameter(),H)});return new we.VariadicValue(k,q)}function f(L,k,H){L.map===void 0&&H.convertError(L,"List");let q=L.map(function(v){return o(v,k.getFirstTypeParameter(),H)});return new we.List(k,q)}function d(L,k,H){let q=[],v=k.getTypeParameters();H.guardSameLength(L,v);for(let C=0;C{"use strict";h();Object.defineProperty(i0,"__esModule",{value:!0});i0.TokenTransfersDataBuilder=void 0;var lW=lc(),wi=$t(),fW=Ia(),AE=class{constructor(){this.tokenComputer=new fW.TokenComputer,this.argsSerializer=new lW.ArgSerializer}buildDataPartsForESDTTransfer(e){return["ESDTTransfer",...this.argsSerializer.valuesToStrings([new wi.TokenIdentifierValue(e.token.identifier),new wi.BigUIntValue(e.amount)])]}buildDataPartsForSingleESDTNFTTransfer(e,r){let n=e.token,i=this.tokenComputer.extractIdentifierFromExtendedIdentifier(n.identifier);return["ESDTNFTTransfer",...this.argsSerializer.valuesToStrings([new wi.TokenIdentifierValue(i),new wi.BigUIntValue(n.nonce),new wi.BigUIntValue(e.amount),new wi.AddressValue(r)])]}buildDataPartsForMultiESDTNFTTransfer(e,r){let n=[new wi.AddressValue(e),new wi.U32Value(r.length)];for(let s of r){let o=this.tokenComputer.extractIdentifierFromExtendedIdentifier(s.token.identifier);n.push(new wi.TokenIdentifierValue(o),new wi.BigUIntValue(s.token.nonce),new wi.BigUIntValue(s.amount))}return["MultiESDTNFTTransfer",...this.argsSerializer.valuesToStrings(n)]}};i0.TokenTransfersDataBuilder=AE});var SE=D(a0=>{"use strict";h();Object.defineProperty(a0,"__esModule",{value:!0});a0.SmartContractTransactionsFactory=void 0;var BO=ke(),MO=yr(),LO=Ie(),hW=so(),s0=Vn(),dW=n0(),gW=$t(),pW=Ia(),o0=Du(),mW=EE(),Qf=dc(),bE=class{constructor(e){this.config=e.config,this.abi=e.abi,this.tokenComputer=new pW.TokenComputer,this.dataArgsBuilder=new mW.TokenTransfersDataBuilder,this.contractDeployAddress=BO.Address.fromHex(MO.CONTRACT_DEPLOY_ADDRESS_HEX,this.config.addressHrp)}createTransactionForDeploy(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,u=e.arguments||[],a=new s0.CodeMetadata(n,i,s,o),c=[o0.byteArrayToHex(e.bytecode),o0.byteArrayToHex(MO.VM_TYPE_WASM_VM),a.toString()],f=this.abi?.constructorDefinition,d=this.argsToDataParts(u,f);return c.push(...d),new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.contractDeployAddress,dataParts:c,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}createTransactionForExecute(e){let r=e.arguments||[],n=e.tokenTransfers||[],i=e.nativeTransferAmount??0n,s=n.length;if(i&&s)throw new LO.ErrBadUsage("Can't send both native tokens and custom tokens(ESDT/NFT)");let o=e.contract,u=[];if(s===1){let f=n[0];this.tokenComputer.isFungible(f.token)?u=this.dataArgsBuilder.buildDataPartsForESDTTransfer(f):(u=this.dataArgsBuilder.buildDataPartsForSingleESDTNFTTransfer(f,o),o=e.sender)}else s>1&&(u=this.dataArgsBuilder.buildDataPartsForMultiESDTNFTTransfer(o,n),o=e.sender);u.push(u.length?o0.utf8ToHex(e.function):e.function);let a=this.abi?.getEndpoint(e.function),c=this.argsToDataParts(r,a);return u.push(...c),new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:o,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:i}).build()}createTransactionForUpgrade(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,u=e.arguments||[],a=new s0.CodeMetadata(n,i,s,o),c=["upgradeContract",o0.byteArrayToHex(e.bytecode),a.toString()],f=this.getEndpointForUpgrade(),d=this.argsToDataParts(u,f);return c.push(...d),new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:c,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}getEndpointForUpgrade(){if(this.abi){if(this.abi.upgradeConstructorDefinition)return this.abi.upgradeConstructorDefinition;try{return this.abi.getEndpoint("upgrade")}catch{return hW.Logger.warn("In the ABI, cannot find the 'upgrade' endpoint definition. Will use the constructor definition (fallback)."),this.abi.constructorDefinition}}}createTransactionForClaimingDeveloperRewards(e){let r=["ClaimDeveloperRewards"];return new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitClaimDeveloperRewards,addDataMovementGas:!1}).build()}createTransactionForChangingOwnerAddress(e){let r=["ChangeOwnerAddress",BO.Address.fromBech32(e.newOwner.bech32()).toHex()];return new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitChangeOwnerAddress,addDataMovementGas:!1}).build()}argsToDataParts(e,r){if(r){let n=dW.NativeSerializer.nativeToTypedValues(e,r);return new s0.ArgSerializer().valuesToStrings(n)}if(this.areArgsOfTypedValue(e))return new s0.ArgSerializer().valuesToStrings(e);throw new LO.Err("Can't convert args to TypedValues")}areArgsOfTypedValue(e){return e.every(r=>gW.isTyped(r))}};a0.SmartContractTransactionsFactory=bE});var FO=D(u0=>{"use strict";h();Object.defineProperty(u0,"__esModule",{value:!0});u0.TokenManagementTransactionsFactory=void 0;var yW=ke(),wW=yr(),vW=so(),Z=Vn(),Jt=dc(),IE=class{constructor(e){this.config=e.config,this.argSerializer=new Z.ArgSerializer,this.trueAsString="true",this.falseAsString="false",this.esdtContractAddress=yW.Address.fromHex(wW.ESDT_CONTRACT_ADDRESS_HEX,this.config.addressHrp)}createTransactionForIssuingFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.BigUIntValue(e.initialSupply),new Z.BigUIntValue(e.numDecimals),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issue",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canTransferNFTCreateRole"),new Z.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueSemiFungible",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canTransferNFTCreateRole"),new Z.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueNonFungible",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.BigUIntValue(e.numDecimals),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canTransferNFTCreateRole"),new Z.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["registerMetaESDT",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringAndSettingRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.StringValue(e.tokenType),new Z.BigUIntValue(e.numDecimals)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForSettingBurnRoleGlobally(e){let r=["setBurnRoleGlobally",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForUnsettingBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnFungibleToken(e){let r=[new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)];e.addRoleLocalMint&&r.push(new Z.StringValue("ESDTRoleLocalMint")),e.addRoleLocalBurn&&r.push(new Z.StringValue("ESDTRoleLocalBurn")),e.addRoleESDTTransferRole&&r.push(new Z.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnSemiFungibleToken(e){let r=[new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new Z.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new Z.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTAddQuantity&&r.push(new Z.StringValue("ESDTRoleNFTAddQuantity")),e.addRoleESDTTransferRole&&r.push(new Z.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnMetaESDT(e){return this.createTransactionForSettingSpecialRoleOnSemiFungibleToken(e)}createTransactionForSettingSpecialRoleOnNonFungibleToken(e){let r=[new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new Z.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new Z.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTUpdateAttributes&&r.push(new Z.StringValue("ESDTRoleNFTUpdateAttributes")),e.addRoleNFTAddURI&&r.push(new Z.StringValue("ESDTRoleNFTAddURI")),e.addRoleESDTTransferRole&&r.push(new Z.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForCreatingNFT(e){let r=["ESDTNFTCreate",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.initialQuantity),new Z.StringValue(e.name),new Z.BigUIntValue(e.royalties),new Z.StringValue(e.hash),new Z.BytesValue(p.Buffer.from(e.attributes)),...e.uris.map(s=>new Z.StringValue(s))])],n=e.name+e.hash+e.attributes+e.uris.join(""),i=this.config.gasLimitStorePerByte+BigInt(n.length);return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftCreate+i,addDataMovementGas:!0}).build()}createTransactionForPausing(e){let r=["pause",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForUnpausing(e){let r=["unPause",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForFreezing(e){let r=["freeze",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForUnfreezing(e){let r=["UnFreeze",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForWiping(e){let r=["wipe",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitWiping,addDataMovementGas:!0}).build()}createTransactionForLocalMint(e){let r=["ESDTLocalMint",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.supplyToMint)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalMint,addDataMovementGas:!0}).build()}createTransactionForLocalBurning(e){let r=["ESDTLocalBurn",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.supplyToBurn)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalBurn,addDataMovementGas:!0}).build()}createTransactionForUpdatingAttributes(e){let r=["ESDTNFTUpdateAttributes",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.tokenNonce),new Z.BytesValue(p.Buffer.from(e.attributes))])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftUpdateAttributes,addDataMovementGas:!0}).build()}createTransactionForAddingQuantity(e){let r=["ESDTNFTAddQuantity",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.tokenNonce),new Z.BigUIntValue(e.quantityToAdd)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftAddQuantity,addDataMovementGas:!0}).build()}createTransactionForBurningQuantity(e){let r=["ESDTNFTBurn",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.tokenNonce),new Z.BigUIntValue(e.quantityToBurn)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftBurn,addDataMovementGas:!0}).build()}notifyAboutUnsettingBurnRoleGlobally(){vW.Logger.info(` +`+R+"}":"{"+D.join(",")+"}",n=R,I}}typeof DP.stringify!="function"&&(DP.stringify=function(u,f,p){var S;if(n="",i="",typeof p=="number")for(S=0;S{h();var n1=null,Aee=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,Eee=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,See=function(t){"use strict";var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(t!=null){if(t.strict===!0&&(e.strict=!0),t.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=t.alwaysParseAsBig===!0?t.alwaysParseAsBig:!1,e.useNativeBigInt=t.useNativeBigInt===!0?t.useNativeBigInt:!1,typeof t.constructorAction<"u")if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve")e.constructorAction=t.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`);if(typeof t.protoAction<"u")if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve")e.protoAction=t.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}var r,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` +`,r:"\r",t:" "},s,o=function(R){throw{name:"SyntaxError",message:R,at:r,text:s}},c=function(R){return R&&R!==n&&o("Expected '"+R+"' instead of '"+n+"'"),n=s.charAt(r),r+=1,n},a=function(){var R,D="";for(n==="-"&&(D="-",c("-"));n>="0"&&n<="9";)D+=n,c();if(n===".")for(D+=".";c()&&n>="0"&&n<="9";)D+=n;if(n==="e"||n==="E")for(D+=n,c(),(n==="-"||n==="+")&&(D+=n,c());n>="0"&&n<="9";)D+=n,c();if(R=+D,!isFinite(R))o("Bad number");else return n1==null&&(n1=(qt(),qe(jt))),D.length>15?e.storeAsString?D:e.useNativeBigInt?BigInt(D):new n1(D):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(R):new n1(R):R},u=function(){var R,D,U="",k;if(n==='"')for(var z=r;c();){if(n==='"')return r-1>z&&(U+=s.substring(z,r-1)),c(),U;if(n==="\\"){if(r-1>z&&(U+=s.substring(z,r-1)),c(),n==="u"){for(k=0,D=0;D<4&&(R=parseInt(c(),16),!!isFinite(R));D+=1)k=k*16+R;U+=String.fromCharCode(k)}else if(typeof i[n]=="string")U+=i[n];else break;z=r}}o("Bad string")},f=function(){for(;n&&n<=" ";)c()},p=function(){switch(n){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}o("Unexpected '"+n+"'")},S,I=function(){var R=[];if(n==="["){if(c("["),f(),n==="]")return c("]"),R;for(;n;){if(R.push(S()),f(),n==="]")return c("]"),R;c(","),f()}}o("Bad array")},N=function(){var R,D=Object.create(null);if(n==="{"){if(c("{"),f(),n==="}")return c("}"),D;for(;n;){if(R=u(),f(),c(":"),e.strict===!0&&Object.hasOwnProperty.call(D,R)&&o('Duplicate key "'+R+'"'),Aee.test(R)===!0?e.protoAction==="error"?o("Object contains forbidden prototype property"):e.protoAction==="ignore"?S():D[R]=S():Eee.test(R)===!0?e.constructorAction==="error"?o("Object contains forbidden constructor property"):e.constructorAction==="ignore"?S():D[R]=S():D[R]=S(),f(),n==="}")return c("}"),D;c(","),f()}}o("Bad object")};return S=function(){switch(f(),n){case"{":return N();case"[":return I();case'"':return u();case"-":return a();default:return n>="0"&&n<="9"?a():p()}},function(R,D){var U;return s=R+"",r=0,n=" ",U=S(),f(),n&&o("Syntax error"),typeof D=="function"?function k(z,H){var F,V,q=z[H];return q&&typeof q=="object"&&Object.keys(q).forEach(function(C){V=k(q,C),V!==void 0?q[C]=V:delete q[C]}),D.call(z,H,q)}({"":U},""):U}};FP.exports=See});var s1=L((P6e,i1)=>{h();var UP=LP().stringify,kP=qP();i1.exports=function(t){return{parse:kP(t),stringify:UP}};i1.exports.parse=kP();i1.exports.stringify=UP});var VP=L(Rl=>{"use strict";h();var _ee=Rl&&Rl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rl,"__esModule",{value:!0});Rl.RelayedTransactionsFactory=void 0;var Tee=_ee((qt(),qe(jt))),o1=Nt(),Bc=Ve(),Lh=yi(),cS=Dn(),Iee=s1(),uS=class{constructor(e){this.config=e.config}createRelayedV1Transaction(e){if(!e.innerTransaction.gasLimit)throw new Bc.ErrInvalidInnerTransaction("The gas limit is not set for the inner transaction");if(!e.innerTransaction.signature.length)throw new Bc.ErrInvalidInnerTransaction("The inner transaction is not signed");let r=this.prepareInnerTransactionForRelayedV1(e.innerTransaction),n=`relayedTx@${b.Buffer.from(r).toString("hex")}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=this.config.minGasLimit+i+e.innerTransaction.gasLimit;return new cS.Transaction({chainID:this.config.chainID,sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,gasLimit:s,data:b.Buffer.from(n)})}createRelayedV2Transaction(e){if(e.innerTransaction.gasLimit)throw new Bc.ErrInvalidInnerTransaction("The gas limit should not be set for the inner transaction");if(!e.innerTransaction.signature.length)throw new Bc.ErrInvalidInnerTransaction("The inner transaction is not signed");let{argumentsString:r}=new Lh.ArgSerializer().valuesToString([new Lh.AddressValue(o1.Address.fromBech32(e.innerTransaction.receiver)),new Lh.U64Value(new Tee.default(e.innerTransaction.nonce.toString())),new Lh.BytesValue(b.Buffer.from(e.innerTransaction.data)),new Lh.BytesValue(b.Buffer.from(e.innerTransaction.signature))]),n=`relayedTxV2@${r}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=e.innerTransactionGasLimit+this.config.minGasLimit+i;return new cS.Transaction({sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,value:0n,gasLimit:s,chainID:this.config.chainID,data:b.Buffer.from(n),version:e.innerTransaction.version,options:e.innerTransaction.options})}createRelayedV3Transaction(e){if(!e.innerTransactions.length)throw new Bc.ErrInvalidInnerTransaction("No inner transctions provided");let r=0n;for(let s of e.innerTransactions){if(!s.signature.length)throw new Bc.ErrInvalidInnerTransaction("Inner transaction is not signed");if(s.relayer!==e.relayerAddress.bech32())throw new Bc.ErrInvalidInnerTransaction("The inner transaction has an incorrect relayer address");r+=s.gasLimit}let i=this.config.minGasLimit*BigInt(e.innerTransactions.length)+r;return new cS.Transaction({sender:e.relayerAddress.bech32(),receiver:e.relayerAddress.bech32(),chainID:this.config.chainID,gasLimit:i,innerTransactions:e.innerTransactions})}prepareInnerTransactionForRelayedV1(e){let r={nonce:e.nonce,sender:o1.Address.newFromBech32(e.sender).getPublicKey().toString("base64"),receiver:o1.Address.newFromBech32(e.receiver).getPublicKey().toString("base64"),value:e.value,gasPrice:e.gasPrice,gasLimit:e.gasLimit,data:b.Buffer.from(e.data).toString("base64"),signature:b.Buffer.from(e.signature).toString("base64"),chainID:b.Buffer.from(e.chainID).toString("base64"),version:e.version,options:e.options.valueOf()==0?void 0:e.options,guardian:e.guardian?o1.Address.newFromBech32(e.guardian).getPublicKey().toString("base64"):void 0,guardianSignature:e.guardianSignature.length?b.Buffer.from(e.guardianSignature).toString("base64"):void 0,sndUserName:e.senderUsername?b.Buffer.from(e.senderUsername).toString("base64"):void 0,rcvUserName:e.receiverUsername?b.Buffer.from(e.receiverUsername).toString("base64"):void 0};return Iee.stringify(r)}};Rl.RelayedTransactionsFactory=uS});var HP=L(a1=>{"use strict";h();Object.defineProperty(a1,"__esModule",{value:!0});a1.ArgumentErrorContext=void 0;var Cee=Ve(),lS=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new Cee.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) +Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};a1.ArgumentErrorContext=lS});var c1=L(Lc=>{"use strict";h();var xee=Lc&&Lc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lc,"__esModule",{value:!0});Lc.NativeSerializer=void 0;var Nee=xee((qt(),qe(jt))),Oee=Nt(),fS=Ve(),Pee=zu(),Ree=HP(),ve=dr(),Mee;(function(t){function e(F,V){F=F||[],r(F,V),n(V)&&(F=i(F,V));let q=V.input,C=[];for(let B=0;B0&&V[0].type.getCardinality().isComposite()&&(C=1/0,B=!0);for(let x of V){if(x.type.getCardinality().isSingular())break;q-=1}return{min:q,max:C,variadic:B}}t.getArgumentsCardinality=s;function o(F,V,q){if(F&&ve.isTyped(F))return F;if(V instanceof ve.OptionType)return c(F,V,q);if(V instanceof ve.OptionalType)return a(F,V,q);if(V instanceof ve.VariadicType)return u(F,V,q);if(V instanceof ve.CompositeType)return p(F,V,q);if(V instanceof ve.TupleType)return S(F,V,q);if(V instanceof ve.StructType)return I(F,V,q);if(V instanceof ve.ListType)return f(F,V,q);if(V instanceof ve.PrimitiveType)return N(F,V,q);if(V instanceof ve.EnumType)return R(F,V,q);if(V instanceof ve.ManagedDecimalType)return D(F,V,q);q.throwError(`convertToTypedValue: unhandled type ${V}`)}function c(F,V,q){if(F==null)return ve.OptionValue.newMissing();let C=o(F,V.getFirstTypeParameter(),q);return ve.OptionValue.newProvided(C)}function a(F,V,q){if(F==null)return new ve.OptionalValue(V);let C=o(F,V.getFirstTypeParameter(),q);return new ve.OptionalValue(V,C)}function u(F,V,q){if(V.isCounted)throw new fS.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');F==null&&(F=[]),F.map===void 0&&q.convertError(F,"Variadic");let C=F.map(function(B){return o(B,V.getFirstTypeParameter(),q)});return new ve.VariadicValue(V,C)}function f(F,V,q){F.map===void 0&&q.convertError(F,"List");let C=F.map(function(B){return o(B,V.getFirstTypeParameter(),q)});return new ve.List(V,C)}function p(F,V,q){let C=[],B=V.getTypeParameters();q.guardSameLength(F,B);for(let x=0;x{"use strict";h();Object.defineProperty(u1,"__esModule",{value:!0});u1.TokenTransfersDataBuilder=void 0;var Dee=Nl(),Yi=dr(),Bee=Sc(),dS=class{constructor(){this.tokenComputer=new Bee.TokenComputer,this.argsSerializer=new Dee.ArgSerializer}buildDataPartsForESDTTransfer(e){return["ESDTTransfer",...this.argsSerializer.valuesToStrings([new Yi.TokenIdentifierValue(e.token.identifier),new Yi.BigUIntValue(e.amount)])]}buildDataPartsForSingleESDTNFTTransfer(e,r){let n=e.token,i=this.tokenComputer.extractIdentifierFromExtendedIdentifier(n.identifier);return["ESDTNFTTransfer",...this.argsSerializer.valuesToStrings([new Yi.TokenIdentifierValue(i),new Yi.BigUIntValue(n.nonce),new Yi.BigUIntValue(e.amount),new Yi.AddressValue(r)])]}buildDataPartsForMultiESDTNFTTransfer(e,r){let n=[new Yi.AddressValue(e),new Yi.U32Value(r.length)];for(let s of r){let o=this.tokenComputer.extractIdentifierFromExtendedIdentifier(s.token.identifier);n.push(new Yi.TokenIdentifierValue(o),new Yi.BigUIntValue(s.token.nonce),new Yi.BigUIntValue(s.amount))}return["MultiESDTNFTTransfer",...this.argsSerializer.valuesToStrings(n)]}};u1.TokenTransfersDataBuilder=dS});var gS=L(d1=>{"use strict";h();Object.defineProperty(d1,"__esModule",{value:!0});d1.SmartContractTransactionsFactory=void 0;var GP=Nt(),zP=xr(),Lee=Ve(),Fee=ra(),l1=yi(),qee=c1(),Uee=dr(),jP=Sc(),f1=zu(),kee=hS(),Fh=Pl(),pS=class{constructor(e){this.config=e.config,this.abi=e.abi,this.tokenComputer=new jP.TokenComputer,this.dataArgsBuilder=new kee.TokenTransfersDataBuilder,this.contractDeployAddress=GP.Address.fromHex(zP.CONTRACT_DEPLOY_ADDRESS_HEX,this.config.addressHrp)}createTransactionForDeploy(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,c=e.arguments||[],a=new l1.CodeMetadata(n,i,s,o),u=[f1.byteArrayToHex(e.bytecode),f1.byteArrayToHex(zP.VM_TYPE_WASM_VM),a.toString()],f=this.abi?.constructorDefinition,p=this.argsToDataParts(c,f);return u.push(...p),new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.contractDeployAddress,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}createTransactionForExecute(e){let r=e.arguments||[],n=e.tokenTransfers?[...e.tokenTransfers]:[],i=e.nativeTransferAmount??0n,s=n.length;i&&s&&(n.push(jP.TokenTransfer.newFromEgldAmount(i)),i=0n,s++);let o=e.contract,c=[];if(s===1){let f=n[0];this.tokenComputer.isFungible(f.token)?c=this.dataArgsBuilder.buildDataPartsForESDTTransfer(f):(c=this.dataArgsBuilder.buildDataPartsForSingleESDTNFTTransfer(f,o),o=e.sender)}else s>1&&(c=this.dataArgsBuilder.buildDataPartsForMultiESDTNFTTransfer(o,n),o=e.sender);c.push(c.length?f1.utf8ToHex(e.function):e.function);let a=this.abi?.getEndpoint(e.function),u=this.argsToDataParts(r,a);return c.push(...u),new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:o,dataParts:c,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:i}).build()}createTransactionForUpgrade(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,c=e.arguments||[],a=new l1.CodeMetadata(n,i,s,o),u=["upgradeContract",f1.byteArrayToHex(e.bytecode),a.toString()],f=this.getEndpointForUpgrade(),p=this.argsToDataParts(c,f);return u.push(...p),new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}getEndpointForUpgrade(){if(this.abi){if(this.abi.upgradeConstructorDefinition)return this.abi.upgradeConstructorDefinition;try{return this.abi.getEndpoint("upgrade")}catch{return Fee.Logger.warn("In the ABI, cannot find the 'upgrade' endpoint definition. Will use the constructor definition (fallback)."),this.abi.constructorDefinition}}}createTransactionForClaimingDeveloperRewards(e){let r=["ClaimDeveloperRewards"];return new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitClaimDeveloperRewards,addDataMovementGas:!1}).build()}createTransactionForChangingOwnerAddress(e){let r=["ChangeOwnerAddress",GP.Address.fromBech32(e.newOwner.bech32()).toHex()];return new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitChangeOwnerAddress,addDataMovementGas:!1}).build()}argsToDataParts(e,r){if(r){let n=qee.NativeSerializer.nativeToTypedValues(e,r);return new l1.ArgSerializer().valuesToStrings(n)}if(this.areArgsOfTypedValue(e))return new l1.ArgSerializer().valuesToStrings(e);throw new Lee.Err("Can't convert args to TypedValues")}areArgsOfTypedValue(e){return e.every(r=>Uee.isTyped(r))}};d1.SmartContractTransactionsFactory=pS});var QP=L(h1=>{"use strict";h();Object.defineProperty(h1,"__esModule",{value:!0});h1.TokenManagementTransactionsFactory=void 0;var Vee=Nt(),Hee=xr(),Gee=Ve(),zee=ra(),J=yi(),Ut=Pl(),mS=class{constructor(e){this.config=e.config,this.argSerializer=new J.ArgSerializer,this.trueAsString="true",this.falseAsString="false",this.esdtContractAddress=Vee.Address.fromHex(Hee.ESDT_CONTRACT_ADDRESS_HEX,this.config.addressHrp)}createTransactionForIssuingFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.BigUIntValue(e.initialSupply),new J.BigUIntValue(e.numDecimals),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issue",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canTransferNFTCreateRole"),new J.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueSemiFungible",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canTransferNFTCreateRole"),new J.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueNonFungible",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.BigUIntValue(e.numDecimals),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canTransferNFTCreateRole"),new J.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["registerMetaESDT",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringAndSettingRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue(e.tokenType),new J.BigUIntValue(e.numDecimals)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForSettingBurnRoleGlobally(e){let r=["setBurnRoleGlobally",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForUnsettingBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnFungibleToken(e){let r=[new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)];e.addRoleLocalMint&&r.push(new J.StringValue("ESDTRoleLocalMint")),e.addRoleLocalBurn&&r.push(new J.StringValue("ESDTRoleLocalBurn")),e.addRoleESDTTransferRole&&r.push(new J.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnSemiFungibleToken(e){let r=[new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new J.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new J.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTAddQuantity&&r.push(new J.StringValue("ESDTRoleNFTAddQuantity")),e.addRoleESDTTransferRole&&r.push(new J.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&r.push(new J.StringValue("ESDTRoleModifyCreator"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnMetaESDT(e){return this.createTransactionForSettingSpecialRoleOnSemiFungibleToken(e)}createTransactionForSettingSpecialRoleOnNonFungibleToken(e){let r=[new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new J.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new J.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTUpdateAttributes&&r.push(new J.StringValue("ESDTRoleNFTUpdateAttributes")),e.addRoleNFTAddURI&&r.push(new J.StringValue("ESDTRoleNFTAddURI")),e.addRoleESDTTransferRole&&r.push(new J.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&r.push(new J.StringValue("ESDTRoleModifyCreator")),e.addRoleNFTRecreate&&r.push(new J.StringValue("ESDTRoleNFTRecreate")),e.addRoleESDTSetNewURI&&r.push(new J.StringValue("ESDTRoleSetNewURI")),e.addRoleESDTModifyRoyalties&&r.push(new J.StringValue("ESDTRoleModifyRoyalties"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForCreatingNFT(e){let r=["ESDTNFTCreate",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.initialQuantity),new J.StringValue(e.name),new J.BigUIntValue(e.royalties),new J.StringValue(e.hash),new J.BytesValue(b.Buffer.from(e.attributes)),...e.uris.map(s=>new J.StringValue(s))])],n=e.name+e.hash+e.attributes+e.uris.join(""),i=this.config.gasLimitStorePerByte+BigInt(n.length);return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftCreate+i,addDataMovementGas:!0}).build()}createTransactionForPausing(e){let r=["pause",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForUnpausing(e){let r=["unPause",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForFreezing(e){let r=["freeze",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForUnfreezing(e){let r=["UnFreeze",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForWiping(e){let r=["wipe",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitWiping,addDataMovementGas:!0}).build()}createTransactionForLocalMint(e){let r=["ESDTLocalMint",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.supplyToMint)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalMint,addDataMovementGas:!0}).build()}createTransactionForLocalBurning(e){let r=["ESDTLocalBurn",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.supplyToBurn)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalBurn,addDataMovementGas:!0}).build()}createTransactionForUpdatingAttributes(e){let r=["ESDTNFTUpdateAttributes",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BytesValue(b.Buffer.from(e.attributes))])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftUpdateAttributes,addDataMovementGas:!0}).build()}createTransactionForAddingQuantity(e){let r=["ESDTNFTAddQuantity",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BigUIntValue(e.quantityToAdd)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftAddQuantity,addDataMovementGas:!0}).build()}createTransactionForBurningQuantity(e){let r=["ESDTNFTBurn",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BigUIntValue(e.quantityToBurn)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftBurn,addDataMovementGas:!0}).build()}createTransactionForModifyingRoyalties(e){let r=["ESDTModifyRoyalties",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BigUIntValue(e.newRoyalties)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtModifyRoyalties,addDataMovementGas:!0}).build()}createTransactionForSettingNewUris(e){if(!e.newUris.length)throw new Gee.ErrBadUsage("No URIs provided");let r=["ESDTSetNewURIs",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),...e.newUris.map(n=>new J.StringValue(n))])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitSetNewUris,addDataMovementGas:!0}).build()}createTransactionForModifyingCreator(e){let r=["ESDTModifyCreator",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtModifyCreator,addDataMovementGas:!0}).build()}createTransactionForUpdatingMetadata(e){let r=["ESDTMetaDataUpdate",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),...e.newTokenName?[new J.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new J.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new J.StringValue(e.newHash)]:[],...e.newAttributes?[new J.BytesValue(b.Buffer.from(e.newAttributes))]:[],...e.newUris?e.newUris.map(n=>new J.StringValue(n)):[]])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtMetadataUpdate,addDataMovementGas:!0}).build()}createTransactionForMetadataRecreate(e){let r=["ESDTMetaDataRecreate",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),...e.newTokenName?[new J.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new J.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new J.StringValue(e.newHash)]:[],...e.newAttributes?[new J.BytesValue(b.Buffer.from(e.newAttributes))]:[],...e.newUris?e.newUris.map(n=>new J.StringValue(n)):[]])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitNftMetadataRecreate,addDataMovementGas:!0}).build()}createTransactionForChangingTokenToDynamic(e){let r=["changeToDynamic",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitNftChangeToDynamic,addDataMovementGas:!0}).build()}createTransactionForUpdatingTokenId(e){let r=["updateTokenID",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitUpdateTokenId,addDataMovementGas:!0}).build()}createTransactionForRegisteringDynamicToken(e){let r=["registerDynamic",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue(e.tokenType)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringDynamicAndSettingRoles(e){let r=["registerAndSetAllRolesDynamic",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue(e.tokenType)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}notifyAboutUnsettingBurnRoleGlobally(){zee.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}boolToString(e){return e?this.trueAsString:this.falseAsString}};u0.TokenManagementTransactionsFactory=IE});var TE=D(c0=>{"use strict";h();Object.defineProperty(c0,"__esModule",{value:!0});c0.TransactionsFactoryConfig=void 0;var AW=Wd(),_E=class{constructor(e){this.chainID=e.chainID,this.addressHrp=AW.LibraryConfig.DefaultAddressHrp,this.minGasLimit=50000n,this.gasLimitPerByte=1500n,this.gasLimitIssue=60000000n,this.gasLimitToggleBurnRoleGlobally=60000000n,this.gasLimitEsdtLocalMint=300000n,this.gasLimitEsdtLocalBurn=300000n,this.gasLimitSetSpecialRole=60000000n,this.gasLimitPausing=60000000n,this.gasLimitFreezing=60000000n,this.gasLimitWiping=60000000n,this.gasLimitEsdtNftCreate=3000000n,this.gasLimitEsdtNftUpdateAttributes=1000000n,this.gasLimitEsdtNftAddQuantity=1000000n,this.gasLimitEsdtNftBurn=1000000n,this.gasLimitStorePerByte=10000n,this.issueCost=50000000000000000n,this.gasLimitStake=5000000n,this.gasLimitUnstake=5000000n,this.gasLimitUnbond=5000000n,this.gasLimitCreateDelegationContract=50000000n,this.gasLimitDelegationOperations=1000000n,this.additionalGasLimitPerValidatorNode=6000000n,this.additionalGasLimitForDelegationOperations=10000000n,this.gasLimitSaveKeyValue=100000n,this.gasLimitPersistPerByte=1000n,this.gasLimitSetGuardian=250000n,this.gasLimitGuardAccount=250000n,this.gasLimitUnguardAccount=250000n,this.gasLimitESDTTransfer=200000n,this.gasLimitESDTNFTTransfer=200000n,this.gasLimitMultiESDTNFTTransfer=200000n,this.gasLimitClaimDeveloperRewards=6000000n,this.gasLimitChangeOwnerAddress=6000000n}};c0.TransactionsFactoryConfig=_E});var VO=D(l0=>{"use strict";h();Object.defineProperty(l0,"__esModule",{value:!0});l0.TransferTransactionsFactory=void 0;var Eo=Ie(),rn=Vn(),EW=Ia(),Kf=en(),CE=Bs(),bW=EE(),UO=dc(),SW=1e5,qO=8e5,NE=class{constructor(e){this.isGasEstimator(e)?this.gasEstimator=e:(this.config=e.config,this.tokenComputer=new EW.TokenComputer,this.tokenTransfersDataBuilder=new bW.TokenTransfersDataBuilder)}isGasEstimator(e){return typeof e=="object"&&typeof e.forEGLDTransfer=="function"&&typeof e.forESDTTransfer=="function"&&typeof e.forESDTNFTTransfer=="function"&&typeof e.forMultiESDTNFTTransfer=="function"}isGasEstimatorDefined(){return this.gasEstimator!==void 0}ensureMembersAreDefined(){if(this.config===void 0)throw new Eo.Err("'config' is not defined");if(this.tokenTransfersDataBuilder===void 0)throw new Eo.Err("`dataArgsBuilder is not defined`");if(this.tokenComputer===void 0)throw new Eo.Err("`tokenComputer is not defined`")}createTransactionForNativeTokenTransfer(e){this.ensureMembersAreDefined();let r=e.data||new Uint8Array;return new Kf.Transaction({sender:e.sender.bech32(),receiver:e.receiver.bech32(),chainID:this.config.chainID,gasLimit:this.computeGasForMoveBalance(this.config,r),data:r,value:e.nativeAmount})}createTransactionForESDTTokenTransfer(e){this.ensureMembersAreDefined();let r=e.tokenTransfers.length;if(r===0)throw new Eo.ErrBadUsage("No token transfer has been provided");if(r===1)return this.createSingleESDTTransferTransaction(e);let n=this.tokenTransfersDataBuilder.buildDataPartsForMultiESDTNFTTransfer(e.receiver,e.tokenTransfers),i=this.config.gasLimitMultiESDTNFTTransfer*BigInt(r)+BigInt(qO);return new UO.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:n,gasLimit:i,addDataMovementGas:!0}).build()}createEGLDTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create an EGLD transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForNativeTokenTransfer` method.");let r=e.data?.length()||0,n=this.gasEstimator.forEGLDTransfer(r);return new Kf.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||n,data:e.data,chainID:e.chainID})}createESDTTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create an ESDT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new rn.ArgSerializer().valuesToString([rn.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new rn.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new CE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Kf.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create an ESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new rn.ArgSerializer().valuesToString([rn.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new rn.U64Value(e.tokenTransfer.nonce),new rn.BigUIntValue(e.tokenTransfer.valueOf()),new rn.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new CE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Kf.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create a MultiESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let r=[new rn.AddressValue(e.destination),new rn.U16Value(e.tokenTransfers.length)];for(let a of e.tokenTransfers)r.push(rn.BytesValue.fromUTF8(a.tokenIdentifier),new rn.U64Value(a.nonce),new rn.BigUIntValue(a.valueOf()));let{argumentsString:n}=new rn.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new CE.TransactionPayload(i),o=s.length()||0,u=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Kf.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||u,data:s,chainID:e.chainID})}createSingleESDTTransferTransaction(e){this.ensureMembersAreDefined();let r=[],n=e.tokenTransfers[0],i=0n,s=e.receiver;return this.tokenComputer.isFungible(n.token)?(r=this.tokenTransfersDataBuilder.buildDataPartsForESDTTransfer(n),i=this.config.gasLimitESDTTransfer+BigInt(SW)):(r=this.tokenTransfersDataBuilder.buildDataPartsForSingleESDTNFTTransfer(n,s),i=this.config.gasLimitESDTNFTTransfer+BigInt(qO),s=e.sender),new UO.TransactionBuilder({config:this.config,sender:e.sender,receiver:s,dataParts:r,gasLimit:i,addDataMovementGas:!0}).build()}computeGasForMoveBalance(e,r){return e.minGasLimit+e.gasLimitPerByte*BigInt(r.length)}};l0.TransferTransactionsFactory=NE});var kO=D(h0=>{"use strict";h();Object.defineProperty(h0,"__esModule",{value:!0});h0.AccountTransactionsFactory=void 0;var IW=ke(),f0=dc(),xE=class{constructor(e){this.config=e.config}createTransactionForSavingKeyValue(e){let r="SaveKeyValue",n=this.computeDataPartsForSavingKeyValue(e.keyValuePairs),i=[r,...n],s=this.computeExtraGasForSavingKeyValue(e.keyValuePairs);return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:i,gasLimit:s,addDataMovementGas:!0}).build()}computeExtraGasForSavingKeyValue(e){let r=0n;return e.forEach((n,i)=>{r+=this.config.gasLimitPersistPerByte*BigInt(i.length+n.length)+this.config.gasLimitStorePerByte*BigInt(n.length)}),r+this.config.gasLimitSaveKeyValue}computeDataPartsForSavingKeyValue(e){let r=[];return e.forEach((n,i)=>{r.push(p.Buffer.from(i).toString("hex"),p.Buffer.from(n).toString("hex"))}),r}createTransactionForSettingGuardian(e){let r=["SetGuardian",IW.Address.fromBech32(e.guardianAddress.bech32()).toHex(),p.Buffer.from(e.serviceID).toString("hex")];return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitSetGuardian,addDataMovementGas:!0}).build()}createTransactionForGuardingAccount(e){let r=["GuardAccount"];return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitGuardAccount,addDataMovementGas:!0}).build()}createTransactionForUnguardingAccount(e){let r=["UnGuardAccount"];return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitUnguardAccount,addDataMovementGas:!0}).build()}};h0.AccountTransactionsFactory=xE});var d0=D(dn=>{"use strict";h();var _W=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ua=dn&&dn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_W(e,t,r)};Object.defineProperty(dn,"__esModule",{value:!0});Ua(bO(),dn);Ua(PO(),dn);Ua(SE(),dn);Ua(FO(),dn);Ua(TE(),dn);Ua(VO(),dn);Ua(kO(),dn)});var PE=D(kn=>{"use strict";h();var TW=kn&&kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CW=kn&&kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NW=kn&&kn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TW(e,t,r);return CW(e,t),e},xW=kn&&kn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kn,"__esModule",{value:!0});kn.InteractionChecker=void 0;var OE=NW(Ie()),OW=xW((nr(),xe(hr))),DE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new OW.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new OE.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new OE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let u=0;u{"use strict";h();Object.defineProperty(g0,"__esModule",{value:!0});g0.Query=void 0;var DW=ke(),PW=lc(),RE=class{constructor(e){this.caller=e.caller||DW.Address.empty(),this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new PW.ArgSerializer().valuesToStrings(this.args)}};g0.Query=RE});var LE=D(p0=>{"use strict";h();Object.defineProperty(p0,"__esModule",{value:!0});p0.Interaction=void 0;var HO=ke(),RW=hE(),BW=yr(),BE=Ia(),GO=d0(),MW=PE(),LW=Wf(),ME=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=HO.Address.empty(),this.sender=HO.Address.empty(),this.version=BW.TRANSACTION_VERSION_DEFAULT,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=[]}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){RW.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=new GO.TransactionsFactoryConfig({chainID:this.chainID.valueOf()}),n=new GO.SmartContractTransactionsFactory({config:e}).createTransactionForExecute({sender:this.sender,contract:this.contract.getAddress(),function:this.function.valueOf(),gasLimit:BigInt(this.gasLimit.valueOf()),arguments:this.args,nativeTransferAmount:BigInt(this.value.toString()),tokenTransfers:this.tokenTransfers});return n.chainID=this.chainID.valueOf(),n.nonce=BigInt(this.nonce.valueOf()),n.version=this.version,this.gasPrice&&(n.gasPrice=BigInt(this.gasPrice.valueOf())),n}buildQuery(){return new LW.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.tokenTransfers=[e].map(r=>new BE.TokenTransfer(r)),this}withSingleESDTNFTTransfer(e){return this.tokenTransfers=[e].map(r=>new BE.TokenTransfer(r)),this}withMultiESDTNFTTransfer(e){return this.tokenTransfers=e.map(r=>new BE.TokenTransfer(r)),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withVersion(e){return this.version=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new MW.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};p0.Interaction=ME});var FE=D(jO=>{"use strict";h();Object.defineProperty(jO,"__esModule",{value:!0})});var WO=D(mc=>{"use strict";h();Object.defineProperty(mc,"__esModule",{value:!0});mc.bech32m=mc.bech32=void 0;var m0="qpzry9x8gf2tvdw0s3jn54khce6mua7l",QO={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function zO(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=pc(e)^n>>5}e=pc(e);for(let r=0;r=r;)s-=r,u.push(i>>s&o);if(n)s>0&&u.push(i<=e)return"Excess padding";if(i<a)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=zO(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");c=pc(c)^w,f+=m0.charAt(w)}for(let d=0;d<6;++d)c=pc(c);c^=e;for(let d=0;d<6;++d){let w=c>>(5-d)*5&31;f+=m0.charAt(w)}return f}function n(o,u){if(u=u||90,o.length<8)return o+" too short";if(o.length>u)return"Exceeds length limit";let a=o.toLowerCase(),c=o.toUpperCase();if(o!==a&&o!==c)return"Mixed-case string "+o;o=a;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),w=o.slice(f+1);if(w.length<6)return"Data too short";let A=zO(d);if(typeof A=="string")return A;let _=[];for(let N=0;N=w.length)&&_.push(V)}return A!==e?"Invalid checksum for "+o:{prefix:d,words:_}}function i(o,u){let a=n(o,u);if(typeof a=="object")return a}function s(o,u){let a=n(o,u);if(typeof a=="object")return a;throw new Error(a)}return{decodeUnsafe:i,decode:s,encode:r,toWords:FW,fromWordsUnsafe:UW,fromWords:qW}}mc.bech32=KO("bech32");mc.bech32m=KO("bech32m")});var YO=D(Hn=>{"use strict";h();Object.defineProperty(Hn,"__esModule",{value:!0});Hn.TokenTransferProperties=Hn.TransactionMetadataTransfer=Hn.TransactionMetadata=Hn.TransactionToDecode=Hn.TransactionDecoder=void 0;var $O=WO(),qE=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new qa;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new y0;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new qa;s.transfers||(s.transfers=[]);let o=2;for(let u=0;uo&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),u=new qa;return u.sender=e.sender,u.receiver=o,u.value=s,r.length>4&&(u.functionName=this.hexToString(r[4]),u.functionArgs=r.slice(5)),u.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],u}base64Encode(e){return p.Buffer.from(e).toString("base64")}base64Decode(e){return p.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new qa;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=p.Buffer.from(e,"hex"),n=$O.bech32.toWords(r);return $O.bech32.encode("erd",n)}isAddressValid(e){return p.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return p.Buffer.from(e,"base64").toString("hex")}hexToString(e){return p.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};Hn.TransactionDecoder=qE;var y0=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Hn.TransactionToDecode=y0;var qa=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Hn.TransactionMetadata=qa;var VE=class{constructor(){this.value=BigInt(0)}};Hn.TransactionMetadataTransfer=VE;var kE=class{};Hn.TokenTransferProperties=kE});var HE=D(w0=>{"use strict";h();Object.defineProperty(w0,"__esModule",{value:!0});w0.ReturnCode=void 0;var yt=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};w0.ReturnCode=yt;yt.None=new yt("");yt.Ok=new yt("ok");yt.FunctionNotFound=new yt("function not found");yt.FunctionWrongSignature=new yt("wrong signature for function");yt.ContractNotFound=new yt("contract not found");yt.UserError=new yt("user error");yt.OutOfGas=new yt("out of gas");yt.AccountCollision=new yt("account collision");yt.OutOfFunds=new yt("out of funds");yt.CallStackOverFlow=new yt("call stack overflow");yt.ContractInvalid=new yt("contract invalid");yt.ExecutionFailed=new yt("execution failed");yt.Unknown=new yt("unknown")});var ZO=D(v0=>{"use strict";h();Object.defineProperty(v0,"__esModule",{value:!0});v0.ResultsParser=void 0;var VW=YO(),JO=ke(),XO=Ie(),bo=so(),kW=lc(),yc=HE(),wc;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(wc||(wc={}));var GE;(function(t){t.TooMuchGas="@too much gas provided for processing"})(GE||(GE={}));var HW={argsSerializer:new kW.ArgSerializer},jE=class{constructor(e){e={...HW,...e},this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new yc.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new yc.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e);return this.parseOutcomeFromUntypedBundle(n,r)}parseOutcomeFromUntypedBundle(e,r){let n=this.argsSerializer.buffersToValues(e.values,r.output);return{returnCode:e.returnCode,returnMessage:e.returnMessage,values:n,firstValue:n[0],secondValue:n[1],thirdValue:n[2],lastValue:n[n.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return bo.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return bo.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return bo.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return bo.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return bo.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return bo.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return bo.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return bo.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new XO.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new VW.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:yc.ReturnCode.None,returnMessage:yc.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:yc.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(wc.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),o=r.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(wc.OnWriteLog,u=>u.findFirstOrNoneTopic(a=>a.toString().startsWith(GE.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),o=r.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new JO.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(wc.OnWriteLog,a=>a.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),u=s.toString();return{returnCode:s,returnMessage:u,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new JO.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(wc.OnWriteLog,o=>{let u=o.address.bech32()==e.sender.bech32(),a=o.topics[0]?.hex()==n.hex();return u&&a});if(s){let{returnCode:o,returnDataParts:u}=this.sliceDataFieldInParts(s.data),a=o.toString();return{returnCode:o,returnMessage:a,values:u}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||p.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new XO.ErrCannotParseContractResults("no return code");return{returnCode:yc.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){let n=e.topics.map(o=>p.Buffer.from(o.valueOf())).slice(1),i=e.dataPayload?.valueOf()||p.Buffer.from([]),s=e.additionalData?.map(o=>p.Buffer.from(o.valueOf()))||[];return s.length===0&&i.length&&s.push(p.Buffer.from(i)),this.doParseEvent({topics:n,dataItems:s,eventDefinition:r})}doParseEvent(e){let r={},n=e.eventDefinition.inputs.filter(u=>u.indexed),i=this.argsSerializer.buffersToValues(e.topics,n);for(let u=0;u!u.indexed),o=this.argsSerializer.buffersToValues(e.dataItems,s);for(let u=0;u{"use strict";h();Object.defineProperty(E0,"__esModule",{value:!0});E0.SmartContract=void 0;var A0=ke(),zE=hE(),QE=yr(),GW=Ie(),KE=SE(),WE=TE(),jW=Bn(),eD=uE(),tD=lE(),rD=LE(),zW=n0(),QW=Wf(),$E=class{constructor(e={}){this.address=A0.Address.empty(),this.methodsExplicit={},this.methods={},this.address=e.address||A0.Address.empty(),this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new tD.ContractFunction(i);return new rD.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new tD.ContractFunction(i),u=zW.NativeSerializer.nativeToTypedValues(s||[],n);return new rD.Interaction(e,o,u||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return jW.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:u,chainID:a}){zE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()");let c=new WE.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new KE.SmartContractTransactionsFactory({config:c,abi:this.abi}),d=p.Buffer.from(r.toString(),"hex"),w=this.getMetadataPropertiesAsObject(n),A=f.createTransactionForDeploy({sender:e,bytecode:d,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:w.upgradeable,isReadable:w.readable,isPayable:w.payable,isPayableBySmartContract:w.payableBySc});return A.setChainID(a),A.setValue(s??0),A.setGasPrice(u??QE.TRANSACTION_MIN_GAS_PRICE),A}getMetadataPropertiesAsObject(e){let r;return e?r=eD.CodeMetadata.fromBytes(p.Buffer.from(e.toString(),"hex")):r=new eD.CodeMetadata,r.toJSON()}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:u,chainID:a}){zE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress();let c=new WE.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new KE.SmartContractTransactionsFactory({config:c,abi:this.abi}),d=Uint8Array.from(p.Buffer.from(r.toString(),"hex")),w=this.getMetadataPropertiesAsObject(n),A=f.createTransactionForUpgrade({sender:e,contract:this.getAddress(),bytecode:d,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:w.upgradeable,isReadable:w.readable,isPayable:w.payable,isPayableBySmartContract:w.payableBySc});return A.setChainID(a),A.setValue(s??0),A.setGasPrice(u??QE.TRANSACTION_MIN_GAS_PRICE),A}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:u,caller:a}){zE.Compatibility.guardAddressIsSetAndNonZero(a,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress();let c=new WE.TransactionsFactoryConfig({chainID:u.valueOf()}),f=new KE.SmartContractTransactionsFactory({config:c,abi:this.abi});r=r||[],n=n||0;let d=f.createTransactionForExecute({sender:a,contract:s||this.getAddress(),function:e.toString(),gasLimit:BigInt(i.valueOf()),arguments:r});return d.setChainID(u),d.setValue(n),d.setGasPrice(o??QE.TRANSACTION_MIN_GAS_PRICE),d}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new QW.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new GW.ErrContractHasNoAddress}static computeAddress(e,r){let n=A0.Address.fromBech32(e.bech32());return new A0.AddressComputer().computeContractAddress(n,BigInt(r.valueOf()))}};E0.SmartContract=$E});var iD=D(So=>{"use strict";h();Object.defineProperty(So,"__esModule",{value:!0});So.ContractCallPayloadBuilder=So.ContractUpgradePayloadBuilder=So.ContractDeployPayloadBuilder=void 0;var KW=yr(),ZE=Bs(),eb=Bn(),WW=lc(),YE=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(){eb.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${KW.WasmVirtualMachine}@${r}`;return n=tb(n,this.arguments),new ZE.TransactionPayload(n)}};So.ContractDeployPayloadBuilder=YE;var JE=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(){eb.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=tb(n,this.arguments),new ZE.TransactionPayload(n)}};So.ContractUpgradePayloadBuilder=JE;var XE=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(){eb.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=tb(e,this.arguments),new ZE.TransactionPayload(e)}};So.ContractCallPayloadBuilder=XE;function tb(t,e){let{argumentsString:r,count:n}=new WW.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Vn=D(Xt=>{"use strict";h();var $W=Xt&&Xt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kr=Xt&&Xt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$W(e,t,r)};Object.defineProperty(Xt,"__esModule",{value:!0});kr(lc(),Xt);kr(EO(),Xt);kr(ZA(),Xt);kr(uE(),Xt);kr(lE(),Xt);kr(LE(),Xt);kr(PE(),Xt);kr(FE(),Xt);kr(n0(),Xt);kr(Wf(),Xt);kr(ZO(),Xt);kr(HE(),Xt);kr(nD(),Xt);kr(iD(),Xt);kr($t(),Xt)});var vc=D(ar=>{"use strict";h();Object.defineProperty(ar,"__esModule",{value:!0});ar.gatherAllEvents=ar.findEventsByFirstTopic=ar.findEventsByIdentifier=ar.findEventsByPredicate=ar.SmartContractCallOutcome=ar.TransactionOutcome=ar.SmartContractResult=ar.TransactionLogs=ar.TransactionEvent=void 0;var rb=class{constructor(e){this.address="",this.identifier="",this.topics=[],this.dataItems=[],Object.assign(this,e)}};ar.TransactionEvent=rb;var $f=class{constructor(e){this.address="",this.events=[],Object.assign(this,e)}};ar.TransactionLogs=$f;var nb=class{constructor(e){this.sender="",this.receiver="",this.data=new Uint8Array,this.logs=new $f({}),Object.assign(this,e)}};ar.SmartContractResult=nb;var ib=class{constructor(e){this.directSmartContractCallOutcome=new b0({}),this.smartContractResults=[],this.logs=new $f({}),Object.assign(this,e)}};ar.TransactionOutcome=ib;var b0=class{constructor(e){this.function="",this.returnDataParts=[],this.returnMessage="",this.returnCode="",Object.assign(this,e)}};ar.SmartContractCallOutcome=b0;function sb(t,e){return sD(t).filter(e)}ar.findEventsByPredicate=sb;function YW(t,e){return sb(t,r=>r.identifier==e)}ar.findEventsByIdentifier=YW;function JW(t,e){return sb(t,r=>r.topics[0]?.toString()==e)}ar.findEventsByFirstTopic=JW;function sD(t){let e=[];e.push(...t.logs.events);for(let r of t.smartContractResults)e.push(...r.logs.events);return e}ar.gatherAllEvents=sD});var ab=D(S0=>{"use strict";h();Object.defineProperty(S0,"__esModule",{value:!0});S0.TransactionsConverter=void 0;var XW=Vn(),ZW=en(),Ac=vc(),ob=class{transactionToPlainObject(e){return{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:this.toBase64OrUndefined(e.senderUsername),receiverUsername:this.toBase64OrUndefined(e.receiverUsername),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:this.toBase64OrUndefined(e.data),chainID:e.chainID.valueOf(),version:e.version,options:e.options==0?void 0:e.options,guardian:e.guardian?e.guardian:void 0,signature:this.toHexOrUndefined(e.signature),guardianSignature:this.toHexOrUndefined(e.guardianSignature)}}toBase64OrUndefined(e){return e&&e.length?p.Buffer.from(e).toString("base64"):void 0}toHexOrUndefined(e){return e&&e.length?p.Buffer.from(e).toString("hex"):void 0}plainObjectToTransaction(e){return new ZW.Transaction({nonce:BigInt(e.nonce),value:BigInt(e.value||""),receiver:e.receiver,receiverUsername:this.bufferFromBase64(e.receiverUsername).toString(),sender:e.sender,senderUsername:this.bufferFromBase64(e.senderUsername).toString(),guardian:e.guardian,gasPrice:BigInt(e.gasPrice),gasLimit:BigInt(e.gasLimit),data:this.bufferFromBase64(e.data),chainID:String(e.chainID),version:Number(e.version),options:Number(e.options),signature:this.bufferFromHex(e.signature),guardianSignature:this.bufferFromHex(e.guardianSignature)})}bufferFromBase64(e){return p.Buffer.from(e||"","base64")}bufferFromHex(e){return p.Buffer.from(e||"","hex")}transactionOnNetworkToOutcome(e){let n=new XW.ResultsParser().parseUntypedOutcome(e),i=new Ac.SmartContractCallOutcome({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.values}),s=e.contractResults.items.map(u=>this.smartContractResultOnNetworkToSmartContractResult(u)),o=new Ac.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(u=>this.eventOnNetworkToEvent(u))});return new Ac.TransactionOutcome({logs:o,smartContractResults:s,directSmartContractCallOutcome:i})}smartContractResultOnNetworkToSmartContractResult(e){return new Ac.SmartContractResult({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:p.Buffer.from(e.data),logs:new Ac.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(r=>this.eventOnNetworkToEvent(r))})})}eventOnNetworkToEvent(e){let r=e.dataPayload?.valueOf()||p.Buffer.from(e.data||""),n=e.additionalData?.map(i=>p.Buffer.from(i.valueOf()))||[];return n.length===0&&r.length&&n.push(p.Buffer.from(r)),new Ac.TransactionEvent({address:e.address.bech32(),identifier:e.identifier,topics:e.topics.map(i=>p.Buffer.from(i.hex(),"hex")),dataItems:n})}};S0.TransactionsConverter=ob});var oD=D(Xi=>{"use strict";h();var e$=Xi&&Xi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t$=Xi&&Xi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r$=Xi&&Xi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e$(e,t,r);return t$(e,t),e};Object.defineProperty(Xi,"__esModule",{value:!0});Xi.Hash=void 0;var n$=r$(Ie()),ub=class t{constructor(e){if(!e)this.hash=p.Buffer.from([]);else if(e instanceof p.Buffer)this.hash=e;else if(typeof e=="string")this.hash=p.Buffer.from(e,"hex");else throw new n$.ErrBadType("hash","buffer | string",e)}static empty(){return new t(p.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};Xi.Hash=ub});var Yf=D(Gn=>{"use strict";h();var i$=Gn&&Gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s$=Gn&&Gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o$=Gn&&Gn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i$(e,t,r);return s$(e,t),e};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.interpretSignatureAsBuffer=Gn.Signature=void 0;var aD=o$(Ie()),uD=64,cb=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof p.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new aD.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return p.Buffer.from(e,"hex").length==uD}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=uD)throw new aD.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Gn.Signature=cb;function a$(t){if(ArrayBuffer.isView(t))return p.Buffer.from(t);if(t.hex!=null)return p.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Gn.interpretSignatureAsBuffer=a$});var lD=D((Awe,cD)=>{"use strict";h();cD.exports=u$;function u$(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";h();var I0=dD;I0.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Ec=new Array(64),hD=new Array(123);for(vi=0;vi<64;)hD[Ec[vi]=vi<26?vi+65:vi<52?vi+71:vi<62?vi-4:vi-59|43]=vi++;var vi;I0.encode=function(e,r,n){for(var i=null,s=[],o=0,u=0,a;r>2],a=(c&3)<<4,u=1;break;case 1:s[o++]=Ec[a|c>>4],a=(c&15)<<2,u=2;break;case 2:s[o++]=Ec[a|c>>6],s[o++]=Ec[c&63],u=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return u&&(s[o++]=Ec[a],s[o++]=61,u===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var fD="invalid encoding";I0.decode=function(e,r,n){for(var i=n,s=0,o,u=0;u1)break;if((a=hD[a])===void 0)throw Error(fD);switch(s){case 0:o=a,s=1;break;case 1:r[n++]=o<<2|(a&48)>>4,o=a,s=2;break;case 2:r[n++]=(o&15)<<4|(a&60)>>2,o=a,s=3;break;case 3:r[n++]=(o&3)<<6|a,s=0;break}}if(s===1)throw Error(fD);return n-i};I0.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var mD=D((Iwe,pD)=>{"use strict";h();pD.exports=_0;function _0(){this._listeners={}}_0.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};_0.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";h();bD.exports=yD(yD);function yD(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(a,c,f){e[0]=a,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(a,c,f){e[0]=a,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(a,c){return r[0]=a[c],r[1]=a[c+1],r[2]=a[c+2],r[3]=a[c+3],e[0]}function u(a,c){return r[3]=a[c],r[2]=a[c+1],r[1]=a[c+2],r[0]=a[c+3],e[0]}t.readFloatLE=n?o:u,t.readFloatBE=n?u:o}():function(){function e(n,i,s,o){var u=i<0?1:0;if(u&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((u<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((u<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var a=Math.floor(Math.log(i)/Math.LN2),c=Math.round(i*Math.pow(2,-a)*8388608)&8388607;n((u<<31|a+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,wD),t.writeFloatBE=e.bind(null,vD);function r(n,i,s){var o=n(i,s),u=(o>>31)*2+1,a=o>>>23&255,c=o&8388607;return a===255?c?NaN:u*(1/0):a===0?u*1401298464324817e-60*c:u*Math.pow(2,a-150)*(c+8388608)}t.readFloatLE=r.bind(null,AD),t.readFloatBE=r.bind(null,ED)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(a,c,f){e[0]=a,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(a,c,f){e[0]=a,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(a,c){return r[0]=a[c],r[1]=a[c+1],r[2]=a[c+2],r[3]=a[c+3],r[4]=a[c+4],r[5]=a[c+5],r[6]=a[c+6],r[7]=a[c+7],e[0]}function u(a,c){return r[7]=a[c],r[6]=a[c+1],r[5]=a[c+2],r[4]=a[c+3],r[3]=a[c+4],r[2]=a[c+5],r[1]=a[c+6],r[0]=a[c+7],e[0]}t.readDoubleLE=n?o:u,t.readDoubleBE=n?u:o}():function(){function e(n,i,s,o,u,a){var c=o<0?1:0;if(c&&(o=-o),o===0)n(0,u,a+i),n(1/o>0?0:2147483648,u,a+s);else if(isNaN(o))n(0,u,a+i),n(2146959360,u,a+s);else if(o>17976931348623157e292)n(0,u,a+i),n((c<<31|2146435072)>>>0,u,a+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,u,a+i),n((c<<31|f/4294967296)>>>0,u,a+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,u,a+i),n((c<<31|d+1023<<20|f*1048576&1048575)>>>0,u,a+s)}}}t.writeDoubleLE=e.bind(null,wD,0,4),t.writeDoubleBE=e.bind(null,vD,4,0);function r(n,i,s,o,u){var a=n(o,u+i),c=n(o,u+s),f=(c>>31)*2+1,d=c>>>20&2047,w=4294967296*(c&1048575)+a;return d===2047?w?NaN:f*(1/0):d===0?f*5e-324*w:f*Math.pow(2,d-1075)*(w+4503599627370496)}t.readDoubleLE=r.bind(null,AD,0,4),t.readDoubleBE=r.bind(null,ED,4,0)}(),t}function wD(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function vD(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function AD(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function ED(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var ID=D((exports,module)=>{"use strict";h();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var TD=D(_D=>{"use strict";h();var lb=_D;lb.length=function(e){for(var r=0,n=0,i=0;i191&&a<224?o[u++]=(a&31)<<6|e[r++]&63:a>239&&a<365?(a=((a&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[u++]=55296+(a>>10),o[u++]=56320+(a&1023)):o[u++]=(a&15)<<12|(e[r++]&63)<<6|e[r++]&63,u>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),u=0);return s?(u&&s.push(String.fromCharCode.apply(String,o.slice(0,u))),s.join("")):String.fromCharCode.apply(String,o.slice(0,u))};lb.write=function(e,r,n){for(var i=n,s,o,u=0;u>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(u+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++u,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var ND=D((Dwe,CD)=>{"use strict";h();CD.exports=c$;function c$(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(a){if(a<1||a>i)return t(a);o+a>n&&(s=t(n),o=0);var c=e.call(s,o,o+=a);return o&7&&(o=(o|7)+1),c}}});var OD=D((Rwe,xD)=>{"use strict";h();xD.exports=wr;var Jf=_o();function wr(t,e){this.lo=t>>>0,this.hi=e>>>0}var Va=wr.zero=new wr(0,0);Va.toNumber=function(){return 0};Va.zzEncode=Va.zzDecode=function(){return this};Va.length=function(){return 1};var l$=wr.zeroHash="\0\0\0\0\0\0\0\0";wr.fromNumber=function(e){if(e===0)return Va;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new wr(n,i)};wr.from=function(e){if(typeof e=="number")return wr.fromNumber(e);if(Jf.isString(e))if(Jf.Long)e=Jf.Long.fromString(e);else return wr.fromNumber(parseInt(e,10));return e.low||e.high?new wr(e.low>>>0,e.high>>>0):Va};wr.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};wr.prototype.toLong=function(e){return Jf.Long?new Jf.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Io=String.prototype.charCodeAt;wr.fromHash=function(e){return e===l$?Va:new wr((Io.call(e,0)|Io.call(e,1)<<8|Io.call(e,2)<<16|Io.call(e,3)<<24)>>>0,(Io.call(e,4)|Io.call(e,5)<<8|Io.call(e,6)<<16|Io.call(e,7)<<24)>>>0)};wr.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)};wr.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};wr.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};wr.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var _o=D(fb=>{"use strict";h();var ve=fb;ve.asPromise=lD();ve.base64=gD();ve.EventEmitter=mD();ve.float=SD();ve.inquire=ID();ve.utf8=TD();ve.pool=ND();ve.LongBits=OD();ve.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);ve.global=ve.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||fb;ve.emptyArray=Object.freeze?Object.freeze([]):[];ve.emptyObject=Object.freeze?Object.freeze({}):{};ve.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};ve.isString=function(e){return typeof e=="string"||e instanceof String};ve.isObject=function(e){return e&&typeof e=="object"};ve.isset=ve.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};ve.Buffer=function(){try{var t=ve.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();ve._Buffer_from=null;ve._Buffer_allocUnsafe=null;ve.newBuffer=function(e){return typeof e=="number"?ve.Buffer?ve._Buffer_allocUnsafe(e):new ve.Array(e):ve.Buffer?ve._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};ve.Array=typeof Uint8Array<"u"?Uint8Array:Array;ve.Long=ve.global.dcodeIO&&ve.global.dcodeIO.Long||ve.global.Long||ve.inquire("long");ve.key2Re=/^true|false|0|1$/;ve.key32Re=/^-?(?:0|[1-9][0-9]*)$/;ve.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;ve.longToHash=function(e){return e?ve.LongBits.from(e).toHash():ve.LongBits.zeroHash};ve.longFromHash=function(e,r){var n=ve.LongBits.fromHash(e);return ve.Long?ve.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function DD(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};ve.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";h();LD.exports=Ue;var jn=_o(),hb,T0=jn.LongBits,RD=jn.base64,BD=jn.utf8;function Xf(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function gb(){}function f$(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ue(){this.len=0,this.head=new Xf(gb,0,0),this.tail=this.head,this.states=null}var MD=function(){return jn.Buffer?function(){return(Ue.create=function(){return new hb})()}:function(){return new Ue}};Ue.create=MD();Ue.alloc=function(e){return new jn.Array(e)};jn.Array!==Array&&(Ue.alloc=jn.pool(Ue.alloc,jn.Array.prototype.subarray));Ue.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Xf(e,r,n),this.len+=r,this};function pb(t,e,r){e[r]=t&255}function h$(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function mb(t,e){this.len=t,this.next=void 0,this.val=e}mb.prototype=Object.create(Xf.prototype);mb.prototype.fn=h$;Ue.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new mb((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ue.prototype.int32=function(e){return e<0?this._push(yb,10,T0.fromNumber(e)):this.uint32(e)};Ue.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function yb(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Ue.prototype.uint64=function(e){var r=T0.from(e);return this._push(yb,r.length(),r)};Ue.prototype.int64=Ue.prototype.uint64;Ue.prototype.sint64=function(e){var r=T0.from(e).zzEncode();return this._push(yb,r.length(),r)};Ue.prototype.bool=function(e){return this._push(pb,1,e?1:0)};function db(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ue.prototype.fixed32=function(e){return this._push(db,4,e>>>0)};Ue.prototype.sfixed32=Ue.prototype.fixed32;Ue.prototype.fixed64=function(e){var r=T0.from(e);return this._push(db,4,r.lo)._push(db,4,r.hi)};Ue.prototype.sfixed64=Ue.prototype.fixed64;Ue.prototype.float=function(e){return this._push(jn.float.writeFloatLE,4,e)};Ue.prototype.double=function(e){return this._push(jn.float.writeDoubleLE,8,e)};var d$=jn.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(pb,1,0);if(jn.isString(e)){var n=Ue.alloc(r=RD.length(e));RD.decode(e,n,0),e=n}return this.uint32(r)._push(d$,r,e)};Ue.prototype.string=function(e){var r=BD.length(e);return r?this.uint32(r)._push(BD.write,r,e):this._push(pb,1,0)};Ue.prototype.fork=function(){return this.states=new f$(this),this.head=this.tail=new Xf(gb,0,0),this.len=0,this};Ue.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 Xf(gb,0,0),this.len=0),this};Ue.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Ue.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Ue._configure=function(t){hb=t,Ue.create=MD(),hb._configure()}});var qD=D((qwe,UD)=>{"use strict";h();UD.exports=Zi;var FD=wb();(Zi.prototype=Object.create(FD.prototype)).constructor=Zi;var To=_o();function Zi(){FD.call(this)}Zi._configure=function(){Zi.alloc=To._Buffer_allocUnsafe,Zi.writeBytesBuffer=To.Buffer&&To.Buffer.prototype instanceof Uint8Array&&To.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(Zi.writeBytesBuffer,r,e),this};function g$(t,e,r){t.length<40?To.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Zi.prototype.string=function(e){var r=To.Buffer.byteLength(e);return this.uint32(r),r&&this._push(g$,r,e),this};Zi._configure()});var Eb=D((kwe,jD)=>{"use strict";h();jD.exports=Zt;var Ai=_o(),Ab,HD=Ai.LongBits,p$=Ai.utf8;function Ei(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Zt(t){this.buf=t,this.pos=0,this.len=t.length}var VD=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Zt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Zt(e);throw Error("illegal buffer")},GD=function(){return Ai.Buffer?function(r){return(Zt.create=function(i){return Ai.Buffer.isBuffer(i)?new Ab(i):VD(i)})(r)}:VD};Zt.create=GD();Zt.prototype._slice=Ai.Array.prototype.subarray||Ai.Array.prototype.slice;Zt.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,Ei(this,10);return e}}();Zt.prototype.int32=function(){return this.uint32()|0};Zt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function vb(){var t=new HD(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ei(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Ei(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Zt.prototype.bool=function(){return this.uint32()!==0};function C0(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Zt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ei(this,4);return C0(this.buf,this.pos+=4)};Zt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ei(this,4);return C0(this.buf,this.pos+=4)|0};function kD(){if(this.pos+8>this.len)throw Ei(this,8);return new HD(C0(this.buf,this.pos+=4),C0(this.buf,this.pos+=4))}Zt.prototype.float=function(){if(this.pos+4>this.len)throw Ei(this,4);var e=Ai.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Zt.prototype.double=function(){if(this.pos+8>this.len)throw Ei(this,4);var e=Ai.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Zt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Ei(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=Ai.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};Zt.prototype.string=function(){var e=this.bytes();return p$.read(e,0,e.length)};Zt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ei(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ei(this);while(this.buf[this.pos++]&128);return this};Zt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Zt._configure=function(t){Ab=t,Zt.create=GD(),Ab._configure();var e=Ai.Long?"toLong":"toNumber";Ai.merge(Zt.prototype,{int64:function(){return vb.call(this)[e](!1)},uint64:function(){return vb.call(this)[e](!0)},sint64:function(){return vb.call(this).zzDecode()[e](!1)},fixed64:function(){return kD.call(this)[e](!0)},sfixed64:function(){return kD.call(this)[e](!1)}})}});var WD=D((Gwe,KD)=>{"use strict";h();KD.exports=ka;var QD=Eb();(ka.prototype=Object.create(QD.prototype)).constructor=ka;var zD=_o();function ka(t){QD.call(this,t)}ka._configure=function(){zD.Buffer&&(ka.prototype._slice=zD.Buffer.prototype.slice)};ka.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))};ka._configure()});var YD=D((zwe,$D)=>{"use strict";h();$D.exports=Zf;var bb=_o();(Zf.prototype=Object.create(bb.EventEmitter.prototype)).constructor=Zf;function Zf(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");bb.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Zf.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return bb.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,c){if(a)return o.emit("error",a,e),s(a);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(u){o.emit("error",u,e),setTimeout(function(){s(u)},0);return}};Zf.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var XD=D(JD=>{"use strict";h();var m$=JD;m$.Service=YD()});var eP=D(($we,ZD)=>{"use strict";h();ZD.exports={}});var nP=D(rP=>{"use strict";h();var nn=rP;nn.build="minimal";nn.Writer=wb();nn.BufferWriter=qD();nn.Reader=Eb();nn.BufferReader=WD();nn.util=_o();nn.rpc=XD();nn.roots=eP();nn.configure=tP;function tP(){nn.util._configure(),nn.Writer._configure(nn.BufferWriter),nn.Reader._configure(nn.BufferReader)}tP()});var sP=D((Zwe,iP)=>{"use strict";h();iP.exports=nP()});var aP=D((oP,eh)=>{"use strict";h();(function(t,e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof Pd=="function"&&typeof eh=="object"&&eh&&eh.exports&&(eh.exports=e(sP()))})(oP,function(t){"use strict";var e=t.Reader,r=t.Writer,n=t.util,i=t.roots.default||(t.roots.default={});return i.proto=function(){var s={};return s.Transaction=function(){function o(u){if(u)for(var a=Object.keys(u),c=0;c>>3){case 1:{d.Nonce=a.uint64();break}case 2:{d.Value=a.bytes();break}case 3:{d.RcvAddr=a.bytes();break}case 4:{d.RcvUserName=a.bytes();break}case 5:{d.SndAddr=a.bytes();break}case 6:{d.SndUserName=a.bytes();break}case 7:{d.GasPrice=a.uint64();break}case 8:{d.GasLimit=a.uint64();break}case 9:{d.Data=a.bytes();break}case 10:{d.ChainID=a.bytes();break}case 11:{d.Version=a.uint32();break}case 12:{d.Signature=a.bytes();break}case 13:{d.Options=a.uint32();break}case 14:{d.GuardianAddr=a.bytes();break}case 15:{d.GuardianSignature=a.bytes();break}default:a.skipType(w&7);break}}return d},o.decodeDelimited=function(a){return a instanceof e||(a=new e(a)),this.decode(a,a.uint32())},o.verify=function(a){return typeof a!="object"||a===null?"object expected":a.Nonce!=null&&a.hasOwnProperty("Nonce")&&!n.isInteger(a.Nonce)&&!(a.Nonce&&n.isInteger(a.Nonce.low)&&n.isInteger(a.Nonce.high))?"Nonce: integer|Long expected":a.Value!=null&&a.hasOwnProperty("Value")&&!(a.Value&&typeof a.Value.length=="number"||n.isString(a.Value))?"Value: buffer expected":a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&!(a.RcvAddr&&typeof a.RcvAddr.length=="number"||n.isString(a.RcvAddr))?"RcvAddr: buffer expected":a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&!(a.RcvUserName&&typeof a.RcvUserName.length=="number"||n.isString(a.RcvUserName))?"RcvUserName: buffer expected":a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&!(a.SndAddr&&typeof a.SndAddr.length=="number"||n.isString(a.SndAddr))?"SndAddr: buffer expected":a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&!(a.SndUserName&&typeof a.SndUserName.length=="number"||n.isString(a.SndUserName))?"SndUserName: buffer expected":a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&!n.isInteger(a.GasPrice)&&!(a.GasPrice&&n.isInteger(a.GasPrice.low)&&n.isInteger(a.GasPrice.high))?"GasPrice: integer|Long expected":a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&!n.isInteger(a.GasLimit)&&!(a.GasLimit&&n.isInteger(a.GasLimit.low)&&n.isInteger(a.GasLimit.high))?"GasLimit: integer|Long expected":a.Data!=null&&a.hasOwnProperty("Data")&&!(a.Data&&typeof a.Data.length=="number"||n.isString(a.Data))?"Data: buffer expected":a.ChainID!=null&&a.hasOwnProperty("ChainID")&&!(a.ChainID&&typeof a.ChainID.length=="number"||n.isString(a.ChainID))?"ChainID: buffer expected":a.Version!=null&&a.hasOwnProperty("Version")&&!n.isInteger(a.Version)?"Version: integer expected":a.Signature!=null&&a.hasOwnProperty("Signature")&&!(a.Signature&&typeof a.Signature.length=="number"||n.isString(a.Signature))?"Signature: buffer expected":a.Options!=null&&a.hasOwnProperty("Options")&&!n.isInteger(a.Options)?"Options: integer expected":a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&!(a.GuardianAddr&&typeof a.GuardianAddr.length=="number"||n.isString(a.GuardianAddr))?"GuardianAddr: buffer expected":a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&!(a.GuardianSignature&&typeof a.GuardianSignature.length=="number"||n.isString(a.GuardianSignature))?"GuardianSignature: buffer expected":null},o.fromObject=function(a){if(a instanceof i.proto.Transaction)return a;var c=new i.proto.Transaction;return a.Nonce!=null&&(n.Long?(c.Nonce=n.Long.fromValue(a.Nonce)).unsigned=!0:typeof a.Nonce=="string"?c.Nonce=parseInt(a.Nonce,10):typeof a.Nonce=="number"?c.Nonce=a.Nonce:typeof a.Nonce=="object"&&(c.Nonce=new n.LongBits(a.Nonce.low>>>0,a.Nonce.high>>>0).toNumber(!0))),a.Value!=null&&(typeof a.Value=="string"?n.base64.decode(a.Value,c.Value=n.newBuffer(n.base64.length(a.Value)),0):a.Value.length>=0&&(c.Value=a.Value)),a.RcvAddr!=null&&(typeof a.RcvAddr=="string"?n.base64.decode(a.RcvAddr,c.RcvAddr=n.newBuffer(n.base64.length(a.RcvAddr)),0):a.RcvAddr.length>=0&&(c.RcvAddr=a.RcvAddr)),a.RcvUserName!=null&&(typeof a.RcvUserName=="string"?n.base64.decode(a.RcvUserName,c.RcvUserName=n.newBuffer(n.base64.length(a.RcvUserName)),0):a.RcvUserName.length>=0&&(c.RcvUserName=a.RcvUserName)),a.SndAddr!=null&&(typeof a.SndAddr=="string"?n.base64.decode(a.SndAddr,c.SndAddr=n.newBuffer(n.base64.length(a.SndAddr)),0):a.SndAddr.length>=0&&(c.SndAddr=a.SndAddr)),a.SndUserName!=null&&(typeof a.SndUserName=="string"?n.base64.decode(a.SndUserName,c.SndUserName=n.newBuffer(n.base64.length(a.SndUserName)),0):a.SndUserName.length>=0&&(c.SndUserName=a.SndUserName)),a.GasPrice!=null&&(n.Long?(c.GasPrice=n.Long.fromValue(a.GasPrice)).unsigned=!0:typeof a.GasPrice=="string"?c.GasPrice=parseInt(a.GasPrice,10):typeof a.GasPrice=="number"?c.GasPrice=a.GasPrice:typeof a.GasPrice=="object"&&(c.GasPrice=new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0))),a.GasLimit!=null&&(n.Long?(c.GasLimit=n.Long.fromValue(a.GasLimit)).unsigned=!0:typeof a.GasLimit=="string"?c.GasLimit=parseInt(a.GasLimit,10):typeof a.GasLimit=="number"?c.GasLimit=a.GasLimit:typeof a.GasLimit=="object"&&(c.GasLimit=new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0))),a.Data!=null&&(typeof a.Data=="string"?n.base64.decode(a.Data,c.Data=n.newBuffer(n.base64.length(a.Data)),0):a.Data.length>=0&&(c.Data=a.Data)),a.ChainID!=null&&(typeof a.ChainID=="string"?n.base64.decode(a.ChainID,c.ChainID=n.newBuffer(n.base64.length(a.ChainID)),0):a.ChainID.length>=0&&(c.ChainID=a.ChainID)),a.Version!=null&&(c.Version=a.Version>>>0),a.Signature!=null&&(typeof a.Signature=="string"?n.base64.decode(a.Signature,c.Signature=n.newBuffer(n.base64.length(a.Signature)),0):a.Signature.length>=0&&(c.Signature=a.Signature)),a.Options!=null&&(c.Options=a.Options>>>0),a.GuardianAddr!=null&&(typeof a.GuardianAddr=="string"?n.base64.decode(a.GuardianAddr,c.GuardianAddr=n.newBuffer(n.base64.length(a.GuardianAddr)),0):a.GuardianAddr.length>=0&&(c.GuardianAddr=a.GuardianAddr)),a.GuardianSignature!=null&&(typeof a.GuardianSignature=="string"?n.base64.decode(a.GuardianSignature,c.GuardianSignature=n.newBuffer(n.base64.length(a.GuardianSignature)),0):a.GuardianSignature.length>=0&&(c.GuardianSignature=a.GuardianSignature)),c},o.toObject=function(a,c){c||(c={});var f={};if(c.defaults){if(n.Long){var d=new n.Long(0,0,!0);f.Nonce=c.longs===String?d.toString():c.longs===Number?d.toNumber():d}else f.Nonce=c.longs===String?"0":0;if(c.bytes===String?f.Value="":(f.Value=[],c.bytes!==Array&&(f.Value=n.newBuffer(f.Value))),c.bytes===String?f.RcvAddr="":(f.RcvAddr=[],c.bytes!==Array&&(f.RcvAddr=n.newBuffer(f.RcvAddr))),c.bytes===String?f.RcvUserName="":(f.RcvUserName=[],c.bytes!==Array&&(f.RcvUserName=n.newBuffer(f.RcvUserName))),c.bytes===String?f.SndAddr="":(f.SndAddr=[],c.bytes!==Array&&(f.SndAddr=n.newBuffer(f.SndAddr))),c.bytes===String?f.SndUserName="":(f.SndUserName=[],c.bytes!==Array&&(f.SndUserName=n.newBuffer(f.SndUserName))),n.Long){var d=new n.Long(0,0,!0);f.GasPrice=c.longs===String?d.toString():c.longs===Number?d.toNumber():d}else f.GasPrice=c.longs===String?"0":0;if(n.Long){var d=new n.Long(0,0,!0);f.GasLimit=c.longs===String?d.toString():c.longs===Number?d.toNumber():d}else f.GasLimit=c.longs===String?"0":0;c.bytes===String?f.Data="":(f.Data=[],c.bytes!==Array&&(f.Data=n.newBuffer(f.Data))),c.bytes===String?f.ChainID="":(f.ChainID=[],c.bytes!==Array&&(f.ChainID=n.newBuffer(f.ChainID))),f.Version=0,c.bytes===String?f.Signature="":(f.Signature=[],c.bytes!==Array&&(f.Signature=n.newBuffer(f.Signature))),f.Options=0,c.bytes===String?f.GuardianAddr="":(f.GuardianAddr=[],c.bytes!==Array&&(f.GuardianAddr=n.newBuffer(f.GuardianAddr))),c.bytes===String?f.GuardianSignature="":(f.GuardianSignature=[],c.bytes!==Array&&(f.GuardianSignature=n.newBuffer(f.GuardianSignature)))}return a.Nonce!=null&&a.hasOwnProperty("Nonce")&&(typeof a.Nonce=="number"?f.Nonce=c.longs===String?String(a.Nonce):a.Nonce:f.Nonce=c.longs===String?n.Long.prototype.toString.call(a.Nonce):c.longs===Number?new n.LongBits(a.Nonce.low>>>0,a.Nonce.high>>>0).toNumber(!0):a.Nonce),a.Value!=null&&a.hasOwnProperty("Value")&&(f.Value=c.bytes===String?n.base64.encode(a.Value,0,a.Value.length):c.bytes===Array?Array.prototype.slice.call(a.Value):a.Value),a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&(f.RcvAddr=c.bytes===String?n.base64.encode(a.RcvAddr,0,a.RcvAddr.length):c.bytes===Array?Array.prototype.slice.call(a.RcvAddr):a.RcvAddr),a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&(f.RcvUserName=c.bytes===String?n.base64.encode(a.RcvUserName,0,a.RcvUserName.length):c.bytes===Array?Array.prototype.slice.call(a.RcvUserName):a.RcvUserName),a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&(f.SndAddr=c.bytes===String?n.base64.encode(a.SndAddr,0,a.SndAddr.length):c.bytes===Array?Array.prototype.slice.call(a.SndAddr):a.SndAddr),a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&(f.SndUserName=c.bytes===String?n.base64.encode(a.SndUserName,0,a.SndUserName.length):c.bytes===Array?Array.prototype.slice.call(a.SndUserName):a.SndUserName),a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&(typeof a.GasPrice=="number"?f.GasPrice=c.longs===String?String(a.GasPrice):a.GasPrice:f.GasPrice=c.longs===String?n.Long.prototype.toString.call(a.GasPrice):c.longs===Number?new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0):a.GasPrice),a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&(typeof a.GasLimit=="number"?f.GasLimit=c.longs===String?String(a.GasLimit):a.GasLimit:f.GasLimit=c.longs===String?n.Long.prototype.toString.call(a.GasLimit):c.longs===Number?new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0):a.GasLimit),a.Data!=null&&a.hasOwnProperty("Data")&&(f.Data=c.bytes===String?n.base64.encode(a.Data,0,a.Data.length):c.bytes===Array?Array.prototype.slice.call(a.Data):a.Data),a.ChainID!=null&&a.hasOwnProperty("ChainID")&&(f.ChainID=c.bytes===String?n.base64.encode(a.ChainID,0,a.ChainID.length):c.bytes===Array?Array.prototype.slice.call(a.ChainID):a.ChainID),a.Version!=null&&a.hasOwnProperty("Version")&&(f.Version=a.Version),a.Signature!=null&&a.hasOwnProperty("Signature")&&(f.Signature=c.bytes===String?n.base64.encode(a.Signature,0,a.Signature.length):c.bytes===Array?Array.prototype.slice.call(a.Signature):a.Signature),a.Options!=null&&a.hasOwnProperty("Options")&&(f.Options=a.Options),a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&(f.GuardianAddr=c.bytes===String?n.base64.encode(a.GuardianAddr,0,a.GuardianAddr.length):c.bytes===Array?Array.prototype.slice.call(a.GuardianAddr):a.GuardianAddr),a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&(f.GuardianSignature=c.bytes===String?n.base64.encode(a.GuardianSignature,0,a.GuardianSignature.length):c.bytes===Array?Array.prototype.slice.call(a.GuardianSignature):a.GuardianSignature),f},o.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},o.getTypeUrl=function(a){return a===void 0&&(a="type.googleapis.com"),a+"/proto.Transaction"},o}(),s}(),i})});var uP=D(zn=>{"use strict";h();var y$=zn&&zn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w$=zn&&zn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v$=zn&&zn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y$(e,t,r);return w$(e,t),e},A$=zn&&zn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zn,"__esModule",{value:!0});zn.ProtoSerializer=void 0;var E$=A$((nr(),xe(hr))),Sb=ke(),b$=yr(),S$=v$(Ie()),I$=Pu(),Ib=class{serializeTransaction(e){let r=aP().proto,n=new Sb.Address(e.getReceiver().bech32()).pubkey(),i=new Sb.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:e.getReceiverUsername()?p.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?p.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:p.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==b$.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let a=e.getGuardian();s.GuardianAddr=new Sb.Address(a.bech32()).pubkey(),s.GuardianSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return p.Buffer.from(o)}serializeTransactionValue(e){let r=new E$.default(e.toString());if(r.isZero())return p.Buffer.from([0,0]);let n=I$.bigIntToBuffer(r);return n=p.Buffer.concat([p.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new S$.ErrUnsupportedOperation("deserializeTransaction")}};zn.ProtoSerializer=Ib});var cP=D(Ha=>{"use strict";h();var _$=Ha&&Ha.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T$=Ha&&Ha.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_$(e,t,r)};Object.defineProperty(Ha,"__esModule",{value:!0});T$(uP(),Ha)});var N0=D(Kn=>{"use strict";h();var C$=Kn&&Kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N$=Kn&&Kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x$=Kn&&Kn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C$(e,t,r);return N$(e,t),e},O$=Kn&&Kn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.TransactionComputer=void 0;var lP=O$((nr(),xe(hr))),Qn=yr(),_b=x$(Ie()),D$=cP(),P$=en(),R$=oE(),B$=af(),M$=32,Tb=class{constructor(){}computeTransactionFee(e,r){let n=BigInt(r.MinGasLimit+e.data.length*r.GasPerDataByte);if(n>e.gasLimit)throw new _b.ErrNotEnoughGas(parseInt(e.gasLimit.toString(),10));let i=e.gasPrice,s=n*i;if(n===e.gasLimit)return s;let o=e.gasLimit-n,u=BigInt(new lP.default(i.toString()).multipliedBy(new lP.default(r.GasPriceModifier)).toFixed(0)),a=o*u;return s+a}computeBytesForSigning(e){this.ensureValidTransactionFields(e);let r=this.toPlainObjectForSigning(e),n=JSON.stringify(r);return new Uint8Array(p.Buffer.from(n))}computeBytesForVerifying(e){return this.hasOptionsSetForHashSigning(e)?this.computeHashForSigning(e):this.computeBytesForSigning(e)}computeHashForSigning(e){let r=this.toPlainObjectForSigning(e),n=p.Buffer.from(JSON.stringify(r));return B$("keccak256").update(n).digest()}computeTransactionHash(e){let n=new D$.ProtoSerializer().serializeTransaction(new P$.Transaction(e)),i=R$(M$).update(n).digest("hex");return p.Buffer.from(i,"hex")}hasOptionsSetForGuardedTransaction(e){return(e.options&Qn.TRANSACTION_OPTIONS_TX_GUARDED)==Qn.TRANSACTION_OPTIONS_TX_GUARDED}hasOptionsSetForHashSigning(e){return(e.options&Qn.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Qn.TRANSACTION_OPTIONS_TX_HASH_SIGN}applyGuardian(e,r){e.version= ${Qn.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS}`)}};Kn.TransactionComputer=Tb});var en=D(bc=>{"use strict";h();Object.defineProperty(bc,"__esModule",{value:!0});bc.TransactionHash=bc.Transaction=void 0;var fP=(nr(),xe(hr)),Cb=ke(),Nb=yr(),hP=ab(),L$=oD(),dP=Jl(),gP=Yf(),F$=Bs(),xb=N0(),Ob=class{constructor(e){this.nonce=BigInt(e.nonce?.valueOf()||0n),this.value=e.value?BigInt(new fP.BigNumber(e.value.toString()).toFixed(0)):0n,this.sender=this.addressAsBech32(e.sender),this.receiver=this.addressAsBech32(e.receiver),this.senderUsername=e.senderUsername||"",this.receiverUsername=e.receiverUsername||"",this.gasPrice=BigInt(e.gasPrice?.valueOf()||Nb.TRANSACTION_MIN_GAS_PRICE),this.gasLimit=BigInt(e.gasLimit.valueOf()),this.data=e.data?.valueOf()||new Uint8Array,this.chainID=e.chainID.valueOf(),this.version=Number(e.version?.valueOf()||Nb.TRANSACTION_VERSION_DEFAULT),this.options=Number(e.options?.valueOf()||Nb.TRANSACTION_OPTIONS_DEFAULT),this.guardian=e.guardian?this.addressAsBech32(e.guardian):"",this.signature=e.signature||p.Buffer.from([]),this.guardianSignature=e.guardianSignature||p.Buffer.from([])}addressAsBech32(e){return typeof e=="string"?e:e.bech32()}getNonce(){return Number(this.nonce)}setNonce(e){this.nonce=BigInt(e.valueOf())}getValue(){return this.value}setValue(e){this.value=BigInt(e.toString())}getSender(){return Cb.Address.fromBech32(this.sender)}setSender(e){this.sender=typeof e=="string"?e:e.bech32()}getReceiver(){return Cb.Address.fromBech32(this.receiver)}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return new Cb.Address(this.guardian)}getGasPrice(){return Number(this.gasPrice)}setGasPrice(e){this.gasPrice=BigInt(e.valueOf())}getGasLimit(){return Number(this.gasLimit)}setGasLimit(e){this.gasLimit=BigInt(e.valueOf())}getData(){return new F$.TransactionPayload(p.Buffer.from(this.data))}getChainID(){return this.chainID}setChainID(e){this.chainID=e.valueOf()}getVersion(){return new dP.TransactionVersion(this.version)}setVersion(e){this.version=e.valueOf()}getOptions(){return new dP.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=e.valueOf()}getSignature(){return p.Buffer.from(this.signature)}getGuardianSignature(){return p.Buffer.from(this.guardianSignature)}setGuardian(e){this.guardian=typeof e=="string"?e:e.bech32()}getHash(){return x0.compute(this)}serializeForSigning(){let r=new xb.TransactionComputer().computeBytesForSigning(this);return p.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){return new hP.TransactionsConverter().transactionToPlainObject(this)}static fromPlainObject(e){return new hP.TransactionsConverter().plainObjectToTransaction(e)}applySignature(e){this.signature=gP.interpretSignatureAsBuffer(e)}applyGuardianSignature(e){this.guardianSignature=gP.interpretSignatureAsBuffer(e)}toSendable(){return this.toPlainObject()}computeFee(e){let n=new xb.TransactionComputer().computeTransactionFee(this,e);return new fP.BigNumber(n.toString())}};bc.Transaction=Ob;var x0=class t extends L$.Hash{constructor(e){super(e)}static compute(e){let n=new xb.TransactionComputer().computeTransactionHash(e);return new t(p.Buffer.from(n).toString("hex"))}};bc.TransactionHash=x0});var mP=D(O0=>{"use strict";h();Object.defineProperty(O0,"__esModule",{value:!0});O0.TokenOperationsFactory=void 0;var Db=yr(),U$=so(),pP=Jl(),q$=en(),V$=Bs(),ae=Yd(),Pb=class{constructor(e){this.config=e,this.trueAsHex=ae.utf8ToHex("true"),this.falseAsHex=ae.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.bigIntToHex(e.initialSupply),ae.bigIntToHex(e.numDecimals),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){U$.Logger.info(` +Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}boolToString(e){return e?this.trueAsString:this.falseAsString}};h1.TokenManagementTransactionsFactory=mS});var vS=L(p1=>{"use strict";h();Object.defineProperty(p1,"__esModule",{value:!0});p1.TransactionsFactoryConfig=void 0;var jee=Wp(),yS=class{constructor(e){this.chainID=e.chainID,this.addressHrp=jee.LibraryConfig.DefaultAddressHrp,this.minGasLimit=50000n,this.gasLimitPerByte=1500n,this.gasLimitIssue=60000000n,this.gasLimitToggleBurnRoleGlobally=60000000n,this.gasLimitEsdtLocalMint=300000n,this.gasLimitEsdtLocalBurn=300000n,this.gasLimitSetSpecialRole=60000000n,this.gasLimitPausing=60000000n,this.gasLimitFreezing=60000000n,this.gasLimitWiping=60000000n,this.gasLimitEsdtNftCreate=3000000n,this.gasLimitEsdtNftUpdateAttributes=1000000n,this.gasLimitEsdtNftAddQuantity=1000000n,this.gasLimitEsdtNftBurn=1000000n,this.gasLimitStorePerByte=10000n,this.issueCost=50000000000000000n,this.gasLimitEsdtModifyRoyalties=60000000n,this.gasLimitEsdtModifyCreator=60000000n,this.gasLimitEsdtMetadataUpdate=60000000n,this.gasLimitSetNewUris=60000000n,this.gasLimitNftMetadataRecreate=60000000n,this.gasLimitNftChangeToDynamic=60000000n,this.gasLimitUpdateTokenId=60000000n,this.gasLimitRegisterDynamic=60000000n,this.gasLimitStake=5000000n,this.gasLimitUnstake=5000000n,this.gasLimitUnbond=5000000n,this.gasLimitCreateDelegationContract=50000000n,this.gasLimitDelegationOperations=1000000n,this.additionalGasLimitPerValidatorNode=6000000n,this.additionalGasLimitForDelegationOperations=10000000n,this.gasLimitSaveKeyValue=100000n,this.gasLimitPersistPerByte=1000n,this.gasLimitSetGuardian=250000n,this.gasLimitGuardAccount=250000n,this.gasLimitUnguardAccount=250000n,this.gasLimitESDTTransfer=200000n,this.gasLimitESDTNFTTransfer=200000n,this.gasLimitMultiESDTNFTTransfer=200000n,this.gasLimitClaimDeveloperRewards=6000000n,this.gasLimitChangeOwnerAddress=6000000n}};p1.TransactionsFactoryConfig=yS});var YP=L(g1=>{"use strict";h();Object.defineProperty(g1,"__esModule",{value:!0});g1.TransferTransactionsFactory=void 0;var Fc=Ve(),Ln=yi(),KP=Sc(),qh=Dn(),bS=No(),Qee=hS(),WP=Pl(),Kee=1e5,$P=8e5,wS=class{constructor(e){this.isGasEstimator(e)?this.gasEstimator=e:(this.config=e.config,this.tokenComputer=new KP.TokenComputer,this.tokenTransfersDataBuilder=new Qee.TokenTransfersDataBuilder)}isGasEstimator(e){return typeof e=="object"&&typeof e.forEGLDTransfer=="function"&&typeof e.forESDTTransfer=="function"&&typeof e.forESDTNFTTransfer=="function"&&typeof e.forMultiESDTNFTTransfer=="function"}isGasEstimatorDefined(){return this.gasEstimator!==void 0}ensureConfigIsDefined(){if(this.config===void 0)throw new Fc.Err("'config' is not defined")}createTransactionForNativeTokenTransfer(e){this.ensureConfigIsDefined();let r=e.data||new Uint8Array;return new qh.Transaction({sender:e.sender.bech32(),receiver:e.receiver.bech32(),chainID:this.config.chainID,gasLimit:this.computeGasForMoveBalance(this.config,r),data:r,value:e.nativeAmount})}createTransactionForESDTTokenTransfer(e){this.ensureConfigIsDefined();let r=e.tokenTransfers.length;if(r===0)throw new Fc.ErrBadUsage("No token transfer has been provided");if(r===1)return this.createSingleESDTTransferTransaction(e);let n=this.tokenTransfersDataBuilder.buildDataPartsForMultiESDTNFTTransfer(e.receiver,e.tokenTransfers),i=this.config.gasLimitMultiESDTNFTTransfer*BigInt(r)+BigInt($P);return new WP.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:n,gasLimit:i,addDataMovementGas:!0}).build()}createTransactionForTransfer(e){let r=e.nativeAmount??0n,n=e.tokenTransfers?[...e.tokenTransfers]:[],i=n.length;if(i&&e.data?.length)throw new Fc.ErrBadUsage("Can't set data field when sending esdt tokens");if(r&&i===0||e.data)return this.createTransactionForNativeTokenTransfer({sender:e.sender,receiver:e.receiver,nativeAmount:r,data:e.data});let s=r?KP.TokenTransfer.newFromEgldAmount(r):void 0;return s&&n.push(s),this.createTransactionForESDTTokenTransfer({sender:e.sender,receiver:e.receiver,tokenTransfers:n})}createEGLDTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create an EGLD transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForNativeTokenTransfer` method.");let r=e.data?.length()||0,n=this.gasEstimator.forEGLDTransfer(r);return new qh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||n,data:e.data,chainID:e.chainID})}createESDTTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create an ESDT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new Ln.ArgSerializer().valuesToString([Ln.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Ln.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new bS.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new qh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create an ESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new Ln.ArgSerializer().valuesToString([Ln.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Ln.U64Value(e.tokenTransfer.nonce),new Ln.BigUIntValue(e.tokenTransfer.valueOf()),new Ln.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new bS.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new qh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create a MultiESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let r=[new Ln.AddressValue(e.destination),new Ln.U16Value(e.tokenTransfers.length)];for(let a of e.tokenTransfers)r.push(Ln.BytesValue.fromUTF8(a.tokenIdentifier),new Ln.U64Value(a.nonce),new Ln.BigUIntValue(a.valueOf()));let{argumentsString:n}=new Ln.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new bS.TransactionPayload(i),o=s.length()||0,c=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new qh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||c,data:s,chainID:e.chainID})}createSingleESDTTransferTransaction(e){this.ensureConfigIsDefined();let r=[],n=e.tokenTransfers[0],i=0n,s=e.receiver;return this.tokenComputer.isFungible(n.token)?(r=this.tokenTransfersDataBuilder.buildDataPartsForESDTTransfer(n),i=this.config.gasLimitESDTTransfer+BigInt(Kee)):(r=this.tokenTransfersDataBuilder.buildDataPartsForSingleESDTNFTTransfer(n,s),i=this.config.gasLimitESDTNFTTransfer+BigInt($P),s=e.sender),new WP.TransactionBuilder({config:this.config,sender:e.sender,receiver:s,dataParts:r,gasLimit:i,addDataMovementGas:!0}).build()}computeGasForMoveBalance(e,r){return e.minGasLimit+e.gasLimitPerByte*BigInt(r.length)}};g1.TransferTransactionsFactory=wS});var JP=L(y1=>{"use strict";h();Object.defineProperty(y1,"__esModule",{value:!0});y1.AccountTransactionsFactory=void 0;var Wee=Nt(),m1=Pl(),AS=class{constructor(e){this.config=e.config}createTransactionForSavingKeyValue(e){let r="SaveKeyValue",n=this.computeDataPartsForSavingKeyValue(e.keyValuePairs),i=[r,...n],s=this.computeExtraGasForSavingKeyValue(e.keyValuePairs);return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:i,gasLimit:s,addDataMovementGas:!0}).build()}computeExtraGasForSavingKeyValue(e){let r=0n;return e.forEach((n,i)=>{r+=this.config.gasLimitPersistPerByte*BigInt(i.length+n.length)+this.config.gasLimitStorePerByte*BigInt(n.length)}),r+this.config.gasLimitSaveKeyValue}computeDataPartsForSavingKeyValue(e){let r=[];return e.forEach((n,i)=>{r.push(b.Buffer.from(i).toString("hex"),b.Buffer.from(n).toString("hex"))}),r}createTransactionForSettingGuardian(e){let r=["SetGuardian",Wee.Address.fromBech32(e.guardianAddress.bech32()).toHex(),b.Buffer.from(e.serviceID).toString("hex")];return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitSetGuardian,addDataMovementGas:!0}).build()}createTransactionForGuardingAccount(e){let r=["GuardAccount"];return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitGuardAccount,addDataMovementGas:!0}).build()}createTransactionForUnguardingAccount(e){let r=["UnGuardAccount"];return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitUnguardAccount,addDataMovementGas:!0}).build()}};y1.AccountTransactionsFactory=AS});var v1=L($n=>{"use strict";h();var $ee=$n&&$n.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qc=$n&&$n.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$ee(e,t,r)};Object.defineProperty($n,"__esModule",{value:!0});qc(RP(),$n);qc(VP(),$n);qc(gS(),$n);qc(QP(),$n);qc(vS(),$n);qc(YP(),$n);qc(JP(),$n)});var _S=L(vi=>{"use strict";h();var Yee=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jee=vi&&vi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xee=vi&&vi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yee(e,t,r);return Jee(e,t),e},Zee=vi&&vi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vi,"__esModule",{value:!0});vi.InteractionChecker=void 0;var ES=Xee(Ve()),ete=Zee((qt(),qe(jt))),SS=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new ete.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new ES.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new ES.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let c=0;c{"use strict";h();Object.defineProperty(b1,"__esModule",{value:!0});b1.Query=void 0;var tte=Nt(),rte=Nl(),TS=class{constructor(e){this.caller=e.caller||tte.Address.empty(),this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new rte.ArgSerializer().valuesToStrings(this.args)}};b1.Query=TS});var xS=L(w1=>{"use strict";h();Object.defineProperty(w1,"__esModule",{value:!0});w1.Interaction=void 0;var XP=Nt(),nte=iS(),ite=xr(),IS=Sc(),ZP=v1(),ste=_S(),ote=Uh(),CS=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=XP.Address.empty(),this.sender=XP.Address.empty(),this.version=ite.TRANSACTION_VERSION_DEFAULT,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=[]}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){nte.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=new ZP.TransactionsFactoryConfig({chainID:this.chainID.valueOf()}),n=new ZP.SmartContractTransactionsFactory({config:e}).createTransactionForExecute({sender:this.sender,contract:this.contract.getAddress(),function:this.function.valueOf(),gasLimit:BigInt(this.gasLimit.valueOf()),arguments:this.args,nativeTransferAmount:BigInt(this.value.toString()),tokenTransfers:this.tokenTransfers});return n.chainID=this.chainID.valueOf(),n.nonce=BigInt(this.nonce.valueOf()),n.version=this.version,this.gasPrice&&(n.gasPrice=BigInt(this.gasPrice.valueOf())),n}buildQuery(){return new ote.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.tokenTransfers=[e].map(r=>new IS.TokenTransfer(r)),this}withSingleESDTNFTTransfer(e){return this.tokenTransfers=[e].map(r=>new IS.TokenTransfer(r)),this}withMultiESDTNFTTransfer(e){return this.tokenTransfers=e.map(r=>new IS.TokenTransfer(r)),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withVersion(e){return this.version=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new ste.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};w1.Interaction=CS});var NS=L(eR=>{"use strict";h();Object.defineProperty(eR,"__esModule",{value:!0})});var iR=L(Dl=>{"use strict";h();Object.defineProperty(Dl,"__esModule",{value:!0});Dl.bech32m=Dl.bech32=void 0;var A1="qpzry9x8gf2tvdw0s3jn54khce6mua7l",rR={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function tR(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Ml(e)^n>>5}e=Ml(e);for(let r=0;r=r;)s-=r,c.push(i>>s&o);if(n)s>0&&c.push(i<=e)return"Excess padding";if(i<a)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let u=tR(o);if(typeof u=="string")throw new Error(u);let f=o+"1";for(let p=0;p>5)throw new Error("Non 5-bit word");u=Ml(u)^S,f+=A1.charAt(S)}for(let p=0;p<6;++p)u=Ml(u);u^=e;for(let p=0;p<6;++p){let S=u>>(5-p)*5&31;f+=A1.charAt(S)}return f}function n(o,c){if(c=c||90,o.length<8)return o+" too short";if(o.length>c)return"Exceeds length limit";let a=o.toLowerCase(),u=o.toUpperCase();if(o!==a&&o!==u)return"Mixed-case string "+o;o=a;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let p=o.slice(0,f),S=o.slice(f+1);if(S.length<6)return"Data too short";let I=tR(p);if(typeof I=="string")return I;let N=[];for(let R=0;R=S.length)&&N.push(U)}return I!==e?"Invalid checksum for "+o:{prefix:p,words:N}}function i(o,c){let a=n(o,c);if(typeof a=="object")return a}function s(o,c){let a=n(o,c);if(typeof a=="object")return a;throw new Error(a)}return{decodeUnsafe:i,decode:s,encode:r,toWords:ate,fromWordsUnsafe:cte,fromWords:ute}}Dl.bech32=nR("bech32");Dl.bech32m=nR("bech32m")});var oR=L(bi=>{"use strict";h();Object.defineProperty(bi,"__esModule",{value:!0});bi.TokenTransferProperties=bi.TransactionMetadataTransfer=bi.TransactionMetadata=bi.TransactionToDecode=bi.TransactionDecoder=void 0;var sR=iR(),PS=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new Uc;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new E1;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new Uc;s.transfers||(s.transfers=[]);let o=2;for(let c=0;co&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),c=new Uc;return c.sender=e.sender,c.receiver=o,c.value=s,r.length>4&&(c.functionName=this.hexToString(r[4]),c.functionArgs=r.slice(5)),c.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],c}base64Encode(e){return b.Buffer.from(e).toString("base64")}base64Decode(e){return b.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new Uc;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=b.Buffer.from(e,"hex"),n=sR.bech32.toWords(r);return sR.bech32.encode("erd",n)}isAddressValid(e){return b.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return b.Buffer.from(e,"base64").toString("hex")}hexToString(e){return b.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};bi.TransactionDecoder=PS;var E1=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};bi.TransactionToDecode=E1;var Uc=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};bi.TransactionMetadata=Uc;var RS=class{constructor(){this.value=BigInt(0)}};bi.TransactionMetadataTransfer=RS;var MS=class{};bi.TokenTransferProperties=MS});var DS=L(S1=>{"use strict";h();Object.defineProperty(S1,"__esModule",{value:!0});S1.ReturnCode=void 0;var Qt=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};S1.ReturnCode=Qt;Qt.None=new Qt("");Qt.Ok=new Qt("ok");Qt.FunctionNotFound=new Qt("function not found");Qt.FunctionWrongSignature=new Qt("wrong signature for function");Qt.ContractNotFound=new Qt("contract not found");Qt.UserError=new Qt("user error");Qt.OutOfGas=new Qt("out of gas");Qt.AccountCollision=new Qt("account collision");Qt.OutOfFunds=new Qt("out of funds");Qt.CallStackOverFlow=new Qt("call stack overflow");Qt.ContractInvalid=new Qt("contract invalid");Qt.ExecutionFailed=new Qt("execution failed");Qt.Unknown=new Qt("unknown")});var uR=L(_1=>{"use strict";h();Object.defineProperty(_1,"__esModule",{value:!0});_1.ResultsParser=void 0;var lte=oR(),aR=Nt(),cR=Ve(),wa=ra(),fte=Nl(),Bl=DS(),kc;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(kc||(kc={}));var BS;(function(t){t.TooMuchGas="@too much gas provided for processing"})(BS||(BS={}));var dte={argsSerializer:new fte.ArgSerializer},LS=class{constructor(e){e={...dte,...e},this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Bl.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new Bl.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e);return this.parseOutcomeFromUntypedBundle(n,r)}parseOutcomeFromUntypedBundle(e,r){let n=this.argsSerializer.buffersToValues(e.values,r.output);return{returnCode:e.returnCode,returnMessage:e.returnMessage,values:n,firstValue:n[0],secondValue:n[1],thirdValue:n[2],lastValue:n[n.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return wa.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return wa.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return wa.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return wa.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return wa.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return wa.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return wa.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return wa.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new cR.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new lte.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:Bl.ReturnCode.None,returnMessage:Bl.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Bl.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(kc.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),o=r.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(kc.OnWriteLog,s=>s.findFirstOrNoneTopic(o=>o.toString().startsWith(BS.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data);return{returnCode:n,returnMessage:n.toString(),values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new aR.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(kc.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),c=s.toString();return{returnCode:s,returnMessage:c,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new aR.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(kc.OnWriteLog,o=>{let c=o.address.bech32()==e.sender.bech32(),a=o.topics[0]?.hex()==n.hex();return c&&a});if(s){let{returnCode:o,returnDataParts:c}=this.sliceDataFieldInParts(s.data),a=o.toString();return{returnCode:o,returnMessage:a,values:c}}}for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(kc.OnWriteLog,o=>o.address.bech32()==n.toBech32());if(s){let{returnCode:o,returnDataParts:c}=this.sliceDataFieldInParts(s.data),a=o.toString();return{returnCode:o,returnMessage:a,values:c}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||b.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new cR.ErrCannotParseContractResults("no return code");return{returnCode:Bl.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){let n=e.topics.map(o=>b.Buffer.from(o.valueOf())).slice(1),i=e.dataPayload?.valueOf()||b.Buffer.from([]),s=e.additionalData?.map(o=>b.Buffer.from(o.valueOf()))||[];return s.length===0&&i.length&&s.push(b.Buffer.from(i)),this.doParseEvent({topics:n,dataItems:s,eventDefinition:r})}doParseEvent(e){let r={},n=e.eventDefinition.inputs.filter(c=>c.indexed),i=this.argsSerializer.buffersToValues(e.topics,n);for(let c=0;c!c.indexed),o=this.argsSerializer.buffersToValues(e.dataItems,s);for(let c=0;c{"use strict";h();Object.defineProperty(I1,"__esModule",{value:!0});I1.SmartContract=void 0;var T1=Nt(),FS=iS(),qS=xr(),hte=Ve(),US=gS(),kS=vS(),pte=fi(),lR=Rm(),fR=rS(),dR=xS(),gte=c1(),mte=Uh(),VS=class{constructor(e={}){this.address=T1.Address.empty(),this.methodsExplicit={},this.methods={},this.address=e.address||T1.Address.empty(),this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new fR.ContractFunction(i);return new dR.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new fR.ContractFunction(i),c=gte.NativeSerializer.nativeToTypedValues(s||[],n);return new dR.Interaction(e,o,c||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return pte.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:c,chainID:a}){FS.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()");let u=new kS.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new US.SmartContractTransactionsFactory({config:u,abi:this.abi}),p=b.Buffer.from(r.toString(),"hex"),S=this.getMetadataPropertiesAsObject(n),I=f.createTransactionForDeploy({sender:e,bytecode:p,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:S.upgradeable,isReadable:S.readable,isPayable:S.payable,isPayableBySmartContract:S.payableBySc});return I.setChainID(a),I.setValue(s??0),I.setGasPrice(c??qS.TRANSACTION_MIN_GAS_PRICE),I}getMetadataPropertiesAsObject(e){let r;return e?r=lR.CodeMetadata.fromBytes(b.Buffer.from(e.toString(),"hex")):r=new lR.CodeMetadata,r.toJSON()}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:c,chainID:a}){FS.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress();let u=new kS.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new US.SmartContractTransactionsFactory({config:u,abi:this.abi}),p=Uint8Array.from(b.Buffer.from(r.toString(),"hex")),S=this.getMetadataPropertiesAsObject(n),I=f.createTransactionForUpgrade({sender:e,contract:this.getAddress(),bytecode:p,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:S.upgradeable,isReadable:S.readable,isPayable:S.payable,isPayableBySmartContract:S.payableBySc});return I.setChainID(a),I.setValue(s??0),I.setGasPrice(c??qS.TRANSACTION_MIN_GAS_PRICE),I}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:c,caller:a}){FS.Compatibility.guardAddressIsSetAndNonZero(a,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress();let u=new kS.TransactionsFactoryConfig({chainID:c.valueOf()}),f=new US.SmartContractTransactionsFactory({config:u,abi:this.abi});r=r||[],n=n||0;let p=f.createTransactionForExecute({sender:a,contract:s||this.getAddress(),function:e.toString(),gasLimit:BigInt(i.valueOf()),arguments:r});return p.setChainID(c),p.setValue(n),p.setGasPrice(o??qS.TRANSACTION_MIN_GAS_PRICE),p}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new mte.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new hte.ErrContractHasNoAddress}static computeAddress(e,r){let n=T1.Address.fromBech32(e.bech32());return new T1.AddressComputer().computeContractAddress(n,BigInt(r.valueOf()))}};I1.SmartContract=VS});var pR=L(Aa=>{"use strict";h();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.ContractCallPayloadBuilder=Aa.ContractUpgradePayloadBuilder=Aa.ContractDeployPayloadBuilder=void 0;var yte=xr(),jS=No(),QS=fi(),vte=Nl(),HS=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(){QS.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${yte.WasmVirtualMachine}@${r}`;return n=KS(n,this.arguments),new jS.TransactionPayload(n)}};Aa.ContractDeployPayloadBuilder=HS;var GS=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(){QS.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=KS(n,this.arguments),new jS.TransactionPayload(n)}};Aa.ContractUpgradePayloadBuilder=GS;var zS=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(){QS.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=KS(e,this.arguments),new jS.TransactionPayload(e)}};Aa.ContractCallPayloadBuilder=zS;function KS(t,e){let{argumentsString:r,count:n}=new vte.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var yi=L(Sr=>{"use strict";h();var bte=Sr&&Sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wn=Sr&&Sr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bte(e,t,r)};Object.defineProperty(Sr,"__esModule",{value:!0});wn(Nl(),Sr);wn(PP(),Sr);wn(QE(),Sr);wn(Rm(),Sr);wn(rS(),Sr);wn(xS(),Sr);wn(_S(),Sr);wn(NS(),Sr);wn(c1(),Sr);wn(Uh(),Sr);wn(uR(),Sr);wn(DS(),Sr);wn(hR(),Sr);wn(pR(),Sr);wn(dr(),Sr)});var Ll=L(Pr=>{"use strict";h();Object.defineProperty(Pr,"__esModule",{value:!0});Pr.gatherAllEvents=Pr.findEventsByFirstTopic=Pr.findEventsByIdentifier=Pr.findEventsByPredicate=Pr.SmartContractCallOutcome=Pr.TransactionOutcome=Pr.SmartContractResult=Pr.TransactionLogs=Pr.TransactionEvent=void 0;var WS=class{constructor(e){this.address="",this.identifier="",this.topics=[],this.dataItems=[],Object.assign(this,e)}};Pr.TransactionEvent=WS;var kh=class{constructor(e){this.address="",this.events=[],Object.assign(this,e)}};Pr.TransactionLogs=kh;var $S=class{constructor(e){this.sender="",this.receiver="",this.data=new Uint8Array,this.logs=new kh({}),Object.assign(this,e)}};Pr.SmartContractResult=$S;var YS=class{constructor(e){this.directSmartContractCallOutcome=new C1({}),this.smartContractResults=[],this.logs=new kh({}),Object.assign(this,e)}};Pr.TransactionOutcome=YS;var C1=class{constructor(e){this.function="",this.returnDataParts=[],this.returnMessage="",this.returnCode="",Object.assign(this,e)}};Pr.SmartContractCallOutcome=C1;function JS(t,e){return gR(t).filter(e)}Pr.findEventsByPredicate=JS;function wte(t,e){return JS(t,r=>r.identifier==e)}Pr.findEventsByIdentifier=wte;function Ate(t,e){return JS(t,r=>r.topics[0]?.toString()==e)}Pr.findEventsByFirstTopic=Ate;function gR(t){let e=[];e.push(...t.logs.events);for(let r of t.smartContractResults)e.push(...r.logs.events);return e}Pr.gatherAllEvents=gR});var Vh=L(x1=>{"use strict";h();Object.defineProperty(x1,"__esModule",{value:!0});x1.TransactionsConverter=void 0;var Ete=yi(),Ste=Dn(),Fl=Ll(),XS=class{transactionToPlainObject(e){return{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:this.toBase64OrUndefined(e.senderUsername),receiverUsername:this.toBase64OrUndefined(e.receiverUsername),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:this.toBase64OrUndefined(e.data),chainID:e.chainID.valueOf(),version:e.version,options:e.options==0?void 0:e.options,guardian:e.guardian?e.guardian:void 0,signature:this.toHexOrUndefined(e.signature),guardianSignature:this.toHexOrUndefined(e.guardianSignature),relayer:e.relayer?e.relayer:void 0,innerTransactions:e.innerTransactions.length?e.innerTransactions.map(n=>this.transactionToPlainObject(n)):void 0}}toBase64OrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("base64"):void 0}toHexOrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("hex"):void 0}plainObjectToTransaction(e){return new Ste.Transaction({nonce:BigInt(e.nonce),value:BigInt(e.value||""),receiver:e.receiver,receiverUsername:this.bufferFromBase64(e.receiverUsername).toString(),sender:e.sender,senderUsername:this.bufferFromBase64(e.senderUsername).toString(),guardian:e.guardian,gasPrice:BigInt(e.gasPrice),gasLimit:BigInt(e.gasLimit),data:this.bufferFromBase64(e.data),chainID:String(e.chainID),version:Number(e.version),options:Number(e.options),signature:this.bufferFromHex(e.signature),guardianSignature:this.bufferFromHex(e.guardianSignature),relayer:e.relayer,innerTransactions:e.innerTransactions?e.innerTransactions.map(n=>this.plainObjectToTransaction(n)):void 0})}bufferFromBase64(e){return b.Buffer.from(e||"","base64")}bufferFromHex(e){return b.Buffer.from(e||"","hex")}transactionOnNetworkToOutcome(e){let n=new Ete.ResultsParser().parseUntypedOutcome(e),i=new Fl.SmartContractCallOutcome({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.values}),s=e.contractResults.items.map(c=>this.smartContractResultOnNetworkToSmartContractResult(c)),o=new Fl.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(c=>this.eventOnNetworkToEvent(c))});return new Fl.TransactionOutcome({logs:o,smartContractResults:s,directSmartContractCallOutcome:i})}smartContractResultOnNetworkToSmartContractResult(e){return new Fl.SmartContractResult({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:b.Buffer.from(e.data),logs:new Fl.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(r=>this.eventOnNetworkToEvent(r))})})}eventOnNetworkToEvent(e){let r=e.dataPayload?.valueOf()||b.Buffer.from(e.data||""),n=e.additionalData?.map(i=>b.Buffer.from(i.valueOf()))||[];return n.length===0&&r.length&&n.push(b.Buffer.from(r)),new Fl.TransactionEvent({address:e.address.bech32(),identifier:e.identifier,topics:e.topics.map(i=>b.Buffer.from(i.hex(),"hex")),dataItems:n})}};x1.TransactionsConverter=XS});var mR=L(Bs=>{"use strict";h();var _te=Bs&&Bs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tte=Bs&&Bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ite=Bs&&Bs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_te(e,t,r);return Tte(e,t),e};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.Hash=void 0;var Cte=Ite(Ve()),ZS=class t{constructor(e){if(!e)this.hash=b.Buffer.from([]);else if(e instanceof b.Buffer)this.hash=e;else if(typeof e=="string")this.hash=b.Buffer.from(e,"hex");else throw new Cte.ErrBadType("hash","buffer | string",e)}static empty(){return new t(b.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};Bs.Hash=ZS});var N1=L(wi=>{"use strict";h();var xte=wi&&wi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nte=wi&&wi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ote=wi&&wi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xte(e,t,r);return Nte(e,t),e};Object.defineProperty(wi,"__esModule",{value:!0});wi.interpretSignatureAsBuffer=wi.Signature=void 0;var yR=Ote(Ve()),vR=64,e_=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof b.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new yR.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return b.Buffer.from(e,"hex").length==vR}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=vR)throw new yR.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};wi.Signature=e_;function Pte(t){if(ArrayBuffer.isView(t))return b.Buffer.from(t);if(t.hex!=null)return b.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}wi.interpretSignatureAsBuffer=Pte});var wR=L((NTe,bR)=>{"use strict";h();bR.exports=Rte;function Rte(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";h();var O1=SR;O1.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var ql=new Array(64),ER=new Array(123);for(Ji=0;Ji<64;)ER[ql[Ji]=Ji<26?Ji+65:Ji<52?Ji+71:Ji<62?Ji-4:Ji-59|43]=Ji++;var Ji;O1.encode=function(e,r,n){for(var i=null,s=[],o=0,c=0,a;r>2],a=(u&3)<<4,c=1;break;case 1:s[o++]=ql[a|u>>4],a=(u&15)<<2,c=2;break;case 2:s[o++]=ql[a|u>>6],s[o++]=ql[u&63],c=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return c&&(s[o++]=ql[a],s[o++]=61,c===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var AR="invalid encoding";O1.decode=function(e,r,n){for(var i=n,s=0,o,c=0;c1)break;if((a=ER[a])===void 0)throw Error(AR);switch(s){case 0:o=a,s=1;break;case 1:r[n++]=o<<2|(a&48)>>4,o=a,s=2;break;case 2:r[n++]=(o&15)<<4|(a&60)>>2,o=a,s=3;break;case 3:r[n++]=(o&3)<<6|a,s=0;break}}if(s===1)throw Error(AR);return n-i};O1.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var IR=L((MTe,TR)=>{"use strict";h();TR.exports=P1;function P1(){this._listeners={}}P1.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};P1.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";h();RR.exports=CR(CR);function CR(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(a,u,f){e[0]=a,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3]}function s(a,u,f){e[0]=a,u[f]=r[3],u[f+1]=r[2],u[f+2]=r[1],u[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(a,u){return r[0]=a[u],r[1]=a[u+1],r[2]=a[u+2],r[3]=a[u+3],e[0]}function c(a,u){return r[3]=a[u],r[2]=a[u+1],r[1]=a[u+2],r[0]=a[u+3],e[0]}t.readFloatLE=n?o:c,t.readFloatBE=n?c:o}():function(){function e(n,i,s,o){var c=i<0?1:0;if(c&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((c<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((c<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var a=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-a)*8388608)&8388607;n((c<<31|a+127<<23|u)>>>0,s,o)}}t.writeFloatLE=e.bind(null,xR),t.writeFloatBE=e.bind(null,NR);function r(n,i,s){var o=n(i,s),c=(o>>31)*2+1,a=o>>>23&255,u=o&8388607;return a===255?u?NaN:c*(1/0):a===0?c*1401298464324817e-60*u:c*Math.pow(2,a-150)*(u+8388608)}t.readFloatLE=r.bind(null,OR),t.readFloatBE=r.bind(null,PR)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(a,u,f){e[0]=a,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3],u[f+4]=r[4],u[f+5]=r[5],u[f+6]=r[6],u[f+7]=r[7]}function s(a,u,f){e[0]=a,u[f]=r[7],u[f+1]=r[6],u[f+2]=r[5],u[f+3]=r[4],u[f+4]=r[3],u[f+5]=r[2],u[f+6]=r[1],u[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(a,u){return r[0]=a[u],r[1]=a[u+1],r[2]=a[u+2],r[3]=a[u+3],r[4]=a[u+4],r[5]=a[u+5],r[6]=a[u+6],r[7]=a[u+7],e[0]}function c(a,u){return r[7]=a[u],r[6]=a[u+1],r[5]=a[u+2],r[4]=a[u+3],r[3]=a[u+4],r[2]=a[u+5],r[1]=a[u+6],r[0]=a[u+7],e[0]}t.readDoubleLE=n?o:c,t.readDoubleBE=n?c:o}():function(){function e(n,i,s,o,c,a){var u=o<0?1:0;if(u&&(o=-o),o===0)n(0,c,a+i),n(1/o>0?0:2147483648,c,a+s);else if(isNaN(o))n(0,c,a+i),n(2146959360,c,a+s);else if(o>17976931348623157e292)n(0,c,a+i),n((u<<31|2146435072)>>>0,c,a+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,c,a+i),n((u<<31|f/4294967296)>>>0,c,a+s);else{var p=Math.floor(Math.log(o)/Math.LN2);p===1024&&(p=1023),f=o*Math.pow(2,-p),n(f*4503599627370496>>>0,c,a+i),n((u<<31|p+1023<<20|f*1048576&1048575)>>>0,c,a+s)}}}t.writeDoubleLE=e.bind(null,xR,0,4),t.writeDoubleBE=e.bind(null,NR,4,0);function r(n,i,s,o,c){var a=n(o,c+i),u=n(o,c+s),f=(u>>31)*2+1,p=u>>>20&2047,S=4294967296*(u&1048575)+a;return p===2047?S?NaN:f*(1/0):p===0?f*5e-324*S:f*Math.pow(2,p-1075)*(S+4503599627370496)}t.readDoubleLE=r.bind(null,OR,0,4),t.readDoubleBE=r.bind(null,PR,4,0)}(),t}function xR(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function NR(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function OR(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function PR(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var DR=L((exports,module)=>{"use strict";h();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var LR=L(BR=>{"use strict";h();var t_=BR;t_.length=function(e){for(var r=0,n=0,i=0;i191&&a<224?o[c++]=(a&31)<<6|e[r++]&63:a>239&&a<365?(a=((a&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[c++]=55296+(a>>10),o[c++]=56320+(a&1023)):o[c++]=(a&15)<<12|(e[r++]&63)<<6|e[r++]&63,c>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),c=0);return s?(c&&s.push(String.fromCharCode.apply(String,o.slice(0,c))),s.join("")):String.fromCharCode.apply(String,o.slice(0,c))};t_.write=function(e,r,n){for(var i=n,s,o,c=0;c>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(c+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++c,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var qR=L((kTe,FR)=>{"use strict";h();FR.exports=Mte;function Mte(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(a){if(a<1||a>i)return t(a);o+a>n&&(s=t(n),o=0);var u=e.call(s,o,o+=a);return o&7&&(o=(o|7)+1),u}}});var kR=L((HTe,UR)=>{"use strict";h();UR.exports=Ur;var Hh=Sa();function Ur(t,e){this.lo=t>>>0,this.hi=e>>>0}var Vc=Ur.zero=new Ur(0,0);Vc.toNumber=function(){return 0};Vc.zzEncode=Vc.zzDecode=function(){return this};Vc.length=function(){return 1};var Dte=Ur.zeroHash="\0\0\0\0\0\0\0\0";Ur.fromNumber=function(e){if(e===0)return Vc;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Ur(n,i)};Ur.from=function(e){if(typeof e=="number")return Ur.fromNumber(e);if(Hh.isString(e))if(Hh.Long)e=Hh.Long.fromString(e);else return Ur.fromNumber(parseInt(e,10));return e.low||e.high?new Ur(e.low>>>0,e.high>>>0):Vc};Ur.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Ur.prototype.toLong=function(e){return Hh.Long?new Hh.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ea=String.prototype.charCodeAt;Ur.fromHash=function(e){return e===Dte?Vc:new Ur((Ea.call(e,0)|Ea.call(e,1)<<8|Ea.call(e,2)<<16|Ea.call(e,3)<<24)>>>0,(Ea.call(e,4)|Ea.call(e,5)<<8|Ea.call(e,6)<<16|Ea.call(e,7)<<24)>>>0)};Ur.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)};Ur.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};Ur.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};Ur.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Sa=L(r_=>{"use strict";h();var we=r_;we.asPromise=wR();we.base64=_R();we.EventEmitter=IR();we.float=MR();we.inquire=DR();we.utf8=LR();we.pool=qR();we.LongBits=kR();we.isNode=!!(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||r_;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,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};we.Buffer=function(){try{var t=we.inquire("buffer").Buffer;return t.prototype.utf8Write?t: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,r){var n=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function VR(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};we.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";h();QR.exports=ot;var Ai=Sa(),n_,R1=Ai.LongBits,GR=Ai.base64,zR=Ai.utf8;function Gh(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function s_(){}function Bte(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function ot(){this.len=0,this.head=new Gh(s_,0,0),this.tail=this.head,this.states=null}var jR=function(){return Ai.Buffer?function(){return(ot.create=function(){return new n_})()}:function(){return new ot}};ot.create=jR();ot.alloc=function(e){return new Ai.Array(e)};Ai.Array!==Array&&(ot.alloc=Ai.pool(ot.alloc,Ai.Array.prototype.subarray));ot.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Gh(e,r,n),this.len+=r,this};function o_(t,e,r){e[r]=t&255}function Lte(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function a_(t,e){this.len=t,this.next=void 0,this.val=e}a_.prototype=Object.create(Gh.prototype);a_.prototype.fn=Lte;ot.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new a_((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};ot.prototype.int32=function(e){return e<0?this._push(c_,10,R1.fromNumber(e)):this.uint32(e)};ot.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function c_(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}ot.prototype.uint64=function(e){var r=R1.from(e);return this._push(c_,r.length(),r)};ot.prototype.int64=ot.prototype.uint64;ot.prototype.sint64=function(e){var r=R1.from(e).zzEncode();return this._push(c_,r.length(),r)};ot.prototype.bool=function(e){return this._push(o_,1,e?1:0)};function i_(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}ot.prototype.fixed32=function(e){return this._push(i_,4,e>>>0)};ot.prototype.sfixed32=ot.prototype.fixed32;ot.prototype.fixed64=function(e){var r=R1.from(e);return this._push(i_,4,r.lo)._push(i_,4,r.hi)};ot.prototype.sfixed64=ot.prototype.fixed64;ot.prototype.float=function(e){return this._push(Ai.float.writeFloatLE,4,e)};ot.prototype.double=function(e){return this._push(Ai.float.writeDoubleLE,8,e)};var Fte=Ai.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(o_,1,0);if(Ai.isString(e)){var n=ot.alloc(r=GR.length(e));GR.decode(e,n,0),e=n}return this.uint32(r)._push(Fte,r,e)};ot.prototype.string=function(e){var r=zR.length(e);return r?this.uint32(r)._push(zR.write,r,e):this._push(o_,1,0)};ot.prototype.fork=function(){return this.states=new Bte(this),this.head=this.tail=new Gh(s_,0,0),this.len=0,this};ot.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 Gh(s_,0,0),this.len=0),this};ot.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};ot.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};ot._configure=function(t){n_=t,ot.create=jR(),n_._configure()}});var $R=L((WTe,WR)=>{"use strict";h();WR.exports=Ls;var KR=u_();(Ls.prototype=Object.create(KR.prototype)).constructor=Ls;var _a=Sa();function Ls(){KR.call(this)}Ls._configure=function(){Ls.alloc=_a._Buffer_allocUnsafe,Ls.writeBytesBuffer=_a.Buffer&&_a.Buffer.prototype instanceof Uint8Array&&_a.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(Ls.writeBytesBuffer,r,e),this};function qte(t,e,r){t.length<40?_a.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Ls.prototype.string=function(e){var r=_a.Buffer.byteLength(e);return this.uint32(r),r&&this._push(qte,r,e),this};Ls._configure()});var d_=L((YTe,eM)=>{"use strict";h();eM.exports=_r;var Xi=Sa(),f_,XR=Xi.LongBits,Ute=Xi.utf8;function Zi(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function _r(t){this.buf=t,this.pos=0,this.len=t.length}var YR=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new _r(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new _r(e);throw Error("illegal buffer")},ZR=function(){return Xi.Buffer?function(r){return(_r.create=function(i){return Xi.Buffer.isBuffer(i)?new f_(i):YR(i)})(r)}:YR};_r.create=ZR();_r.prototype._slice=Xi.Array.prototype.subarray||Xi.Array.prototype.slice;_r.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,Zi(this,10);return e}}();_r.prototype.int32=function(){return this.uint32()|0};_r.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function l_(){var t=new XR(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Zi(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Zi(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}_r.prototype.bool=function(){return this.uint32()!==0};function M1(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}_r.prototype.fixed32=function(){if(this.pos+4>this.len)throw Zi(this,4);return M1(this.buf,this.pos+=4)};_r.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Zi(this,4);return M1(this.buf,this.pos+=4)|0};function JR(){if(this.pos+8>this.len)throw Zi(this,8);return new XR(M1(this.buf,this.pos+=4),M1(this.buf,this.pos+=4))}_r.prototype.float=function(){if(this.pos+4>this.len)throw Zi(this,4);var e=Xi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};_r.prototype.double=function(){if(this.pos+8>this.len)throw Zi(this,4);var e=Xi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};_r.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Zi(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=Xi.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};_r.prototype.string=function(){var e=this.bytes();return Ute.read(e,0,e.length)};_r.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Zi(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Zi(this);while(this.buf[this.pos++]&128);return this};_r.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};_r._configure=function(t){f_=t,_r.create=ZR(),f_._configure();var e=Xi.Long?"toLong":"toNumber";Xi.merge(_r.prototype,{int64:function(){return l_.call(this)[e](!1)},uint64:function(){return l_.call(this)[e](!0)},sint64:function(){return l_.call(this).zzDecode()[e](!1)},fixed64:function(){return JR.call(this)[e](!0)},sfixed64:function(){return JR.call(this)[e](!1)}})}});var iM=L((XTe,nM)=>{"use strict";h();nM.exports=Hc;var rM=d_();(Hc.prototype=Object.create(rM.prototype)).constructor=Hc;var tM=Sa();function Hc(t){rM.call(this,t)}Hc._configure=function(){tM.Buffer&&(Hc.prototype._slice=tM.Buffer.prototype.slice)};Hc.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))};Hc._configure()});var oM=L((eIe,sM)=>{"use strict";h();sM.exports=zh;var h_=Sa();(zh.prototype=Object.create(h_.EventEmitter.prototype)).constructor=zh;function zh(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");h_.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}zh.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return h_.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,u){if(a)return o.emit("error",a,e),s(a);if(u===null){o.end(!0);return}if(!(u instanceof n))try{u=n[o.responseDelimited?"decodeDelimited":"decode"](u)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",u,e),s(null,u)})}catch(c){o.emit("error",c,e),setTimeout(function(){s(c)},0);return}};zh.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var cM=L(aM=>{"use strict";h();var kte=aM;kte.Service=oM()});var lM=L((iIe,uM)=>{"use strict";h();uM.exports={}});var hM=L(dM=>{"use strict";h();var Fn=dM;Fn.build="minimal";Fn.Writer=u_();Fn.BufferWriter=$R();Fn.Reader=d_();Fn.BufferReader=iM();Fn.util=Sa();Fn.rpc=cM();Fn.roots=lM();Fn.configure=fM;function fM(){Fn.util._configure(),Fn.Writer._configure(Fn.BufferWriter),Fn.Reader._configure(Fn.BufferReader)}fM()});var gM=L((cIe,pM)=>{"use strict";h();pM.exports=hM()});var p_=L((mM,jh)=>{"use strict";h();(function(t,e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof Mp=="function"&&typeof jh=="object"&&jh&&jh.exports&&(jh.exports=e(gM()))})(mM,function(t){"use strict";var e=t.Reader,r=t.Writer,n=t.util,i=t.roots.default||(t.roots.default={});return i.proto=function(){var s={};return s.Transaction=function(){function o(c){if(this.InnerTransactions=[],c)for(var a=Object.keys(c),u=0;u>>3){case 1:{p.Nonce=a.uint64();break}case 2:{p.Value=a.bytes();break}case 3:{p.RcvAddr=a.bytes();break}case 4:{p.RcvUserName=a.bytes();break}case 5:{p.SndAddr=a.bytes();break}case 6:{p.SndUserName=a.bytes();break}case 7:{p.GasPrice=a.uint64();break}case 8:{p.GasLimit=a.uint64();break}case 9:{p.Data=a.bytes();break}case 10:{p.ChainID=a.bytes();break}case 11:{p.Version=a.uint32();break}case 12:{p.Signature=a.bytes();break}case 13:{p.Options=a.uint32();break}case 14:{p.GuardianAddr=a.bytes();break}case 15:{p.GuardianSignature=a.bytes();break}case 16:{p.Relayer=a.bytes();break}case 17:{p.InnerTransactions&&p.InnerTransactions.length||(p.InnerTransactions=[]),p.InnerTransactions.push(i.proto.Transaction.decode(a,a.uint32()));break}default:a.skipType(S&7);break}}return p},o.decodeDelimited=function(a){return a instanceof e||(a=new e(a)),this.decode(a,a.uint32())},o.verify=function(a){if(typeof a!="object"||a===null)return"object expected";if(a.Nonce!=null&&a.hasOwnProperty("Nonce")&&!n.isInteger(a.Nonce)&&!(a.Nonce&&n.isInteger(a.Nonce.low)&&n.isInteger(a.Nonce.high)))return"Nonce: integer|Long expected";if(a.Value!=null&&a.hasOwnProperty("Value")&&!(a.Value&&typeof a.Value.length=="number"||n.isString(a.Value)))return"Value: buffer expected";if(a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&!(a.RcvAddr&&typeof a.RcvAddr.length=="number"||n.isString(a.RcvAddr)))return"RcvAddr: buffer expected";if(a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&!(a.RcvUserName&&typeof a.RcvUserName.length=="number"||n.isString(a.RcvUserName)))return"RcvUserName: buffer expected";if(a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&!(a.SndAddr&&typeof a.SndAddr.length=="number"||n.isString(a.SndAddr)))return"SndAddr: buffer expected";if(a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&!(a.SndUserName&&typeof a.SndUserName.length=="number"||n.isString(a.SndUserName)))return"SndUserName: buffer expected";if(a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&!n.isInteger(a.GasPrice)&&!(a.GasPrice&&n.isInteger(a.GasPrice.low)&&n.isInteger(a.GasPrice.high)))return"GasPrice: integer|Long expected";if(a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&!n.isInteger(a.GasLimit)&&!(a.GasLimit&&n.isInteger(a.GasLimit.low)&&n.isInteger(a.GasLimit.high)))return"GasLimit: integer|Long expected";if(a.Data!=null&&a.hasOwnProperty("Data")&&!(a.Data&&typeof a.Data.length=="number"||n.isString(a.Data)))return"Data: buffer expected";if(a.ChainID!=null&&a.hasOwnProperty("ChainID")&&!(a.ChainID&&typeof a.ChainID.length=="number"||n.isString(a.ChainID)))return"ChainID: buffer expected";if(a.Version!=null&&a.hasOwnProperty("Version")&&!n.isInteger(a.Version))return"Version: integer expected";if(a.Signature!=null&&a.hasOwnProperty("Signature")&&!(a.Signature&&typeof a.Signature.length=="number"||n.isString(a.Signature)))return"Signature: buffer expected";if(a.Options!=null&&a.hasOwnProperty("Options")&&!n.isInteger(a.Options))return"Options: integer expected";if(a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&!(a.GuardianAddr&&typeof a.GuardianAddr.length=="number"||n.isString(a.GuardianAddr)))return"GuardianAddr: buffer expected";if(a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&!(a.GuardianSignature&&typeof a.GuardianSignature.length=="number"||n.isString(a.GuardianSignature)))return"GuardianSignature: buffer expected";if(a.Relayer!=null&&a.hasOwnProperty("Relayer")&&!(a.Relayer&&typeof a.Relayer.length=="number"||n.isString(a.Relayer)))return"Relayer: buffer expected";if(a.InnerTransactions!=null&&a.hasOwnProperty("InnerTransactions")){if(!Array.isArray(a.InnerTransactions))return"InnerTransactions: array expected";for(var u=0;u>>0,a.Nonce.high>>>0).toNumber(!0))),a.Value!=null&&(typeof a.Value=="string"?n.base64.decode(a.Value,u.Value=n.newBuffer(n.base64.length(a.Value)),0):a.Value.length>=0&&(u.Value=a.Value)),a.RcvAddr!=null&&(typeof a.RcvAddr=="string"?n.base64.decode(a.RcvAddr,u.RcvAddr=n.newBuffer(n.base64.length(a.RcvAddr)),0):a.RcvAddr.length>=0&&(u.RcvAddr=a.RcvAddr)),a.RcvUserName!=null&&(typeof a.RcvUserName=="string"?n.base64.decode(a.RcvUserName,u.RcvUserName=n.newBuffer(n.base64.length(a.RcvUserName)),0):a.RcvUserName.length>=0&&(u.RcvUserName=a.RcvUserName)),a.SndAddr!=null&&(typeof a.SndAddr=="string"?n.base64.decode(a.SndAddr,u.SndAddr=n.newBuffer(n.base64.length(a.SndAddr)),0):a.SndAddr.length>=0&&(u.SndAddr=a.SndAddr)),a.SndUserName!=null&&(typeof a.SndUserName=="string"?n.base64.decode(a.SndUserName,u.SndUserName=n.newBuffer(n.base64.length(a.SndUserName)),0):a.SndUserName.length>=0&&(u.SndUserName=a.SndUserName)),a.GasPrice!=null&&(n.Long?(u.GasPrice=n.Long.fromValue(a.GasPrice)).unsigned=!0:typeof a.GasPrice=="string"?u.GasPrice=parseInt(a.GasPrice,10):typeof a.GasPrice=="number"?u.GasPrice=a.GasPrice:typeof a.GasPrice=="object"&&(u.GasPrice=new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0))),a.GasLimit!=null&&(n.Long?(u.GasLimit=n.Long.fromValue(a.GasLimit)).unsigned=!0:typeof a.GasLimit=="string"?u.GasLimit=parseInt(a.GasLimit,10):typeof a.GasLimit=="number"?u.GasLimit=a.GasLimit:typeof a.GasLimit=="object"&&(u.GasLimit=new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0))),a.Data!=null&&(typeof a.Data=="string"?n.base64.decode(a.Data,u.Data=n.newBuffer(n.base64.length(a.Data)),0):a.Data.length>=0&&(u.Data=a.Data)),a.ChainID!=null&&(typeof a.ChainID=="string"?n.base64.decode(a.ChainID,u.ChainID=n.newBuffer(n.base64.length(a.ChainID)),0):a.ChainID.length>=0&&(u.ChainID=a.ChainID)),a.Version!=null&&(u.Version=a.Version>>>0),a.Signature!=null&&(typeof a.Signature=="string"?n.base64.decode(a.Signature,u.Signature=n.newBuffer(n.base64.length(a.Signature)),0):a.Signature.length>=0&&(u.Signature=a.Signature)),a.Options!=null&&(u.Options=a.Options>>>0),a.GuardianAddr!=null&&(typeof a.GuardianAddr=="string"?n.base64.decode(a.GuardianAddr,u.GuardianAddr=n.newBuffer(n.base64.length(a.GuardianAddr)),0):a.GuardianAddr.length>=0&&(u.GuardianAddr=a.GuardianAddr)),a.GuardianSignature!=null&&(typeof a.GuardianSignature=="string"?n.base64.decode(a.GuardianSignature,u.GuardianSignature=n.newBuffer(n.base64.length(a.GuardianSignature)),0):a.GuardianSignature.length>=0&&(u.GuardianSignature=a.GuardianSignature)),a.Relayer!=null&&(typeof a.Relayer=="string"?n.base64.decode(a.Relayer,u.Relayer=n.newBuffer(n.base64.length(a.Relayer)),0):a.Relayer.length>=0&&(u.Relayer=a.Relayer)),a.InnerTransactions){if(!Array.isArray(a.InnerTransactions))throw TypeError(".proto.Transaction.InnerTransactions: array expected");u.InnerTransactions=[];for(var f=0;f>>0,a.Nonce.high>>>0).toNumber(!0):a.Nonce),a.Value!=null&&a.hasOwnProperty("Value")&&(f.Value=u.bytes===String?n.base64.encode(a.Value,0,a.Value.length):u.bytes===Array?Array.prototype.slice.call(a.Value):a.Value),a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&(f.RcvAddr=u.bytes===String?n.base64.encode(a.RcvAddr,0,a.RcvAddr.length):u.bytes===Array?Array.prototype.slice.call(a.RcvAddr):a.RcvAddr),a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&(f.RcvUserName=u.bytes===String?n.base64.encode(a.RcvUserName,0,a.RcvUserName.length):u.bytes===Array?Array.prototype.slice.call(a.RcvUserName):a.RcvUserName),a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&(f.SndAddr=u.bytes===String?n.base64.encode(a.SndAddr,0,a.SndAddr.length):u.bytes===Array?Array.prototype.slice.call(a.SndAddr):a.SndAddr),a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&(f.SndUserName=u.bytes===String?n.base64.encode(a.SndUserName,0,a.SndUserName.length):u.bytes===Array?Array.prototype.slice.call(a.SndUserName):a.SndUserName),a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&(typeof a.GasPrice=="number"?f.GasPrice=u.longs===String?String(a.GasPrice):a.GasPrice:f.GasPrice=u.longs===String?n.Long.prototype.toString.call(a.GasPrice):u.longs===Number?new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0):a.GasPrice),a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&(typeof a.GasLimit=="number"?f.GasLimit=u.longs===String?String(a.GasLimit):a.GasLimit:f.GasLimit=u.longs===String?n.Long.prototype.toString.call(a.GasLimit):u.longs===Number?new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0):a.GasLimit),a.Data!=null&&a.hasOwnProperty("Data")&&(f.Data=u.bytes===String?n.base64.encode(a.Data,0,a.Data.length):u.bytes===Array?Array.prototype.slice.call(a.Data):a.Data),a.ChainID!=null&&a.hasOwnProperty("ChainID")&&(f.ChainID=u.bytes===String?n.base64.encode(a.ChainID,0,a.ChainID.length):u.bytes===Array?Array.prototype.slice.call(a.ChainID):a.ChainID),a.Version!=null&&a.hasOwnProperty("Version")&&(f.Version=a.Version),a.Signature!=null&&a.hasOwnProperty("Signature")&&(f.Signature=u.bytes===String?n.base64.encode(a.Signature,0,a.Signature.length):u.bytes===Array?Array.prototype.slice.call(a.Signature):a.Signature),a.Options!=null&&a.hasOwnProperty("Options")&&(f.Options=a.Options),a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&(f.GuardianAddr=u.bytes===String?n.base64.encode(a.GuardianAddr,0,a.GuardianAddr.length):u.bytes===Array?Array.prototype.slice.call(a.GuardianAddr):a.GuardianAddr),a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&(f.GuardianSignature=u.bytes===String?n.base64.encode(a.GuardianSignature,0,a.GuardianSignature.length):u.bytes===Array?Array.prototype.slice.call(a.GuardianSignature):a.GuardianSignature),a.Relayer!=null&&a.hasOwnProperty("Relayer")&&(f.Relayer=u.bytes===String?n.base64.encode(a.Relayer,0,a.Relayer.length):u.bytes===Array?Array.prototype.slice.call(a.Relayer):a.Relayer),a.InnerTransactions&&a.InnerTransactions.length){f.InnerTransactions=[];for(var S=0;S{"use strict";h();var Vte=Ei&&Ei.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hte=Ei&&Ei.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gte=Ei&&Ei.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vte(e,t,r);return Hte(e,t),e},zte=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.ProtoSerializer=void 0;var jte=zte((qt(),qe(jt))),D1=Nt(),g_=xr(),Qte=Gte(Ve()),Kte=na(),m_=class{serializeTransaction(e){let r=p_().proto,n=this.convertToProtoMessage(e),i=r.Transaction.encode(n).finish();return b.Buffer.from(i)}convertToProtoMessage(e){let r=p_().proto,n=new D1.Address(e.receiver).getPublicKey(),i=new D1.Address(e.sender).getPublicKey(),s=new r.Transaction({Nonce:Number(e.nonce)?Number(e.nonce):void 0,Value:this.serializeTransactionValue(e.value),RcvAddr:n,RcvUserName:e.receiverUsername?b.Buffer.from(e.receiverUsername).toString("base64"):void 0,SndAddr:i,SndUserName:e.senderUsername?b.Buffer.from(e.senderUsername).toString("base64"):void 0,GasPrice:Number(e.gasPrice),GasLimit:Number(e.gasLimit),Data:e.data.length==0?null:e.data,ChainID:b.Buffer.from(e.chainID),Version:e.version,Signature:e.signature});return e.options!==g_.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.options),this.isGuardedTransaction(e)&&(s.GuardianAddr=new D1.Address(e.guardian).getPublicKey(),s.GuardianSignature=e.guardianSignature),e.relayer&&(s.Relayer=new D1.Address(e.relayer).getPublicKey()),s.InnerTransactions=e.innerTransactions.map(o=>this.convertToProtoMessage(o)),s}serializeTransactionValue(e){let r=new jte.default(e.toString());if(r.isZero())return b.Buffer.from([0,0]);let n=Kte.bigIntToBuffer(r);return n=b.Buffer.concat([b.Buffer.from([0]),n]),n}isGuardedTransaction(e){let r=e.guardian.length>0,n=e.guardianSignature.length>0;return this.isWithGuardian(e)&&r&&n}isWithGuardian(e){return(e.options&g_.TRANSACTION_OPTIONS_TX_GUARDED)==g_.TRANSACTION_OPTIONS_TX_GUARDED}deserializeTransaction(e){throw new Qte.ErrUnsupportedOperation("deserializeTransaction")}};Ei.ProtoSerializer=m_});var vM=L(Gc=>{"use strict";h();var Wte=Gc&&Gc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$te=Gc&&Gc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wte(e,t,r)};Object.defineProperty(Gc,"__esModule",{value:!0});$te(yM(),Gc)});var B1=L(_i=>{"use strict";h();var Yte=_i&&_i.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jte=_i&&_i.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xte=_i&&_i.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yte(e,t,r);return Jte(e,t),e},Zte=_i&&_i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_i,"__esModule",{value:!0});_i.TransactionComputer=void 0;var bM=Zte((qt(),qe(jt))),Si=xr(),y_=Xte(Ve()),ere=vM(),tre=Dn(),rre=ZE(),nre=Yd(),ire=32,v_=class{constructor(){}computeTransactionFee(e,r){let n=BigInt(r.MinGasLimit+e.data.length*r.GasPerDataByte);if(n>e.gasLimit)throw new y_.ErrNotEnoughGas(parseInt(e.gasLimit.toString(),10));let i=e.gasPrice,s=n*i;if(n===e.gasLimit)return s;let o=e.gasLimit-n,c=BigInt(new bM.default(i.toString()).multipliedBy(new bM.default(r.GasPriceModifier)).toFixed(0)),a=o*c;return s+a}computeBytesForSigning(e){this.ensureValidTransactionFields(e);let r=this.toPlainObject(e),n=JSON.stringify(r);return new Uint8Array(b.Buffer.from(n))}computeBytesForVerifying(e){return this.hasOptionsSetForHashSigning(e)?this.computeHashForSigning(e):this.computeBytesForSigning(e)}computeHashForSigning(e){let r=this.toPlainObject(e),n=b.Buffer.from(JSON.stringify(r));return nre("keccak256").update(n).digest()}computeTransactionHash(e){let n=new ere.ProtoSerializer().serializeTransaction(new tre.Transaction(e)),i=rre(ire).update(n).digest("hex");return b.Buffer.from(i,"hex")}hasOptionsSetForGuardedTransaction(e){return(e.options&Si.TRANSACTION_OPTIONS_TX_GUARDED)==Si.TRANSACTION_OPTIONS_TX_GUARDED}hasOptionsSetForHashSigning(e){return(e.options&Si.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Si.TRANSACTION_OPTIONS_TX_HASH_SIGN}applyGuardian(e,r){e.versionthis.toPlainObject(i,!0)):void 0,n}toHexOrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("hex"):void 0}toBase64OrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("base64"):void 0}ensureValidTransactionFields(e){if(!e.chainID.length)throw new y_.ErrBadUsage("The `chainID` field is not set");if(e.version= ${Si.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS}`)}};_i.TransactionComputer=v_});var Dn=L(Ul=>{"use strict";h();Object.defineProperty(Ul,"__esModule",{value:!0});Ul.TransactionHash=Ul.Transaction=void 0;var wM=(qt(),qe(jt)),b_=Nt(),w_=xr(),AM=Vh(),sre=mR(),EM=Vd(),SM=N1(),ore=No(),A_=B1(),E_=class{constructor(e){this.nonce=BigInt(e.nonce?.valueOf()||0n),this.value=e.value?BigInt(new wM.BigNumber(e.value.toString()).toFixed(0)):0n,this.sender=this.addressAsBech32(e.sender),this.receiver=this.addressAsBech32(e.receiver),this.senderUsername=e.senderUsername||"",this.receiverUsername=e.receiverUsername||"",this.gasPrice=BigInt(e.gasPrice?.valueOf()||w_.TRANSACTION_MIN_GAS_PRICE),this.gasLimit=BigInt(e.gasLimit.valueOf()),this.data=e.data?.valueOf()||new Uint8Array,this.chainID=e.chainID.valueOf(),this.version=Number(e.version?.valueOf()||w_.TRANSACTION_VERSION_DEFAULT),this.options=Number(e.options?.valueOf()||w_.TRANSACTION_OPTIONS_DEFAULT),this.guardian=e.guardian?this.addressAsBech32(e.guardian):"",this.signature=e.signature||b.Buffer.from([]),this.guardianSignature=e.guardianSignature||b.Buffer.from([]),this.relayer=e.relayer||"",this.innerTransactions=e.innerTransactions||[]}addressAsBech32(e){return typeof e=="string"?e:e.bech32()}getNonce(){return Number(this.nonce)}setNonce(e){this.nonce=BigInt(e.valueOf())}getValue(){return this.value}setValue(e){this.value=BigInt(e.toString())}getSender(){return b_.Address.fromBech32(this.sender)}setSender(e){this.sender=typeof e=="string"?e:e.bech32()}getReceiver(){return b_.Address.fromBech32(this.receiver)}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return new b_.Address(this.guardian)}getGasPrice(){return Number(this.gasPrice)}setGasPrice(e){this.gasPrice=BigInt(e.valueOf())}getGasLimit(){return Number(this.gasLimit)}setGasLimit(e){this.gasLimit=BigInt(e.valueOf())}getData(){return new ore.TransactionPayload(b.Buffer.from(this.data))}getChainID(){return this.chainID}setChainID(e){this.chainID=e.valueOf()}getVersion(){return new EM.TransactionVersion(this.version)}setVersion(e){this.version=e.valueOf()}getOptions(){return new EM.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=e.valueOf()}getSignature(){return b.Buffer.from(this.signature)}getGuardianSignature(){return b.Buffer.from(this.guardianSignature)}setGuardian(e){this.guardian=typeof e=="string"?e:e.bech32()}getHash(){return L1.compute(this)}serializeForSigning(){let r=new A_.TransactionComputer().computeBytesForSigning(this);return b.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){return new AM.TransactionsConverter().transactionToPlainObject(this)}static fromPlainObject(e){return new AM.TransactionsConverter().plainObjectToTransaction(e)}applySignature(e){this.signature=SM.interpretSignatureAsBuffer(e)}applyGuardianSignature(e){this.guardianSignature=SM.interpretSignatureAsBuffer(e)}toSendable(){return this.toPlainObject()}computeFee(e){let n=new A_.TransactionComputer().computeTransactionFee(this,e);return new wM.BigNumber(n.toString())}};Ul.Transaction=E_;var L1=class t extends sre.Hash{constructor(e){super(e)}static compute(e){let n=new A_.TransactionComputer().computeTransactionHash(e);return new t(b.Buffer.from(n).toString("hex"))}};Ul.TransactionHash=L1});var TM=L(F1=>{"use strict";h();Object.defineProperty(F1,"__esModule",{value:!0});F1.TokenOperationsFactory=void 0;var S_=xr(),are=ra(),_M=Vd(),cre=Dn(),ure=No(),ce=Yp(),__=class{constructor(e){this.config=e,this.trueAsHex=ce.utf8ToHex("true"),this.falseAsHex=ce.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.bigIntToHex(e.initialSupply),ce.bigIntToHex(e.numDecimals),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){are.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.bigIntToHex(e.numDecimals),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.utf8ToHex(e.tokenType),ae.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user),...e.addRoleLocalMint?[ae.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ae.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user),...e.addRoleNFTCreate?[ae.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ae.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ae.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ae.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user),...e.addRoleNFTCreate?[ae.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ae.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ae.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ae.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ae.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.initialQuantity),ae.utf8ToHex(e.name),ae.bigIntToHex(e.royalties),ae.utf8ToHex(e.hash),ae.bufferToHex(e.attributes),...e.uris.map(ae.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.tokenNonce),ae.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.tokenNonce),ae.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.tokenNonce),ae.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:u,dataParts:a}){let c=this.buildTransactionPayload(a),f=o||this.computeGasLimit(c,u),d=new pP.TransactionVersion(Db.TRANSACTION_VERSION_DEFAULT),w=new pP.TransactionOptions(Db.TRANSACTION_OPTIONS_DEFAULT);return new q$.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:c,version:d,options:w})}buildTransactionPayload(e){let r=e.join(Db.ARGUMENTS_SEPARATOR);return new V$.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};O0.TokenOperationsFactory=Pb});var yP=D(D0=>{"use strict";h();Object.defineProperty(D0,"__esModule",{value:!0});D0.TokenOperationsFactoryConfig=void 0;var k$=ke(),Rb=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=k$.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};D0.TokenOperationsFactoryConfig=Rb});var vP=D(P0=>{"use strict";h();Object.defineProperty(P0,"__esModule",{value:!0});P0.TokenOperationsOutcomeParser=void 0;var H$=ke(),Bb=Ie(),wP=Yd(),Mb=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=r.topics[3]?.valueOf();return{tokenIdentifier:n,nonce:i,attributes:s}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){for(let r of e.logs.events)if(r.identifier=="signalError"){let n=p.Buffer.from(r.data.substring(1),"hex").toString(),i=r.topics[1]?.valueOf().toString();throw new Bb.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${i} (${n})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new Bb.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new Bb.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){return e.topics[0]?.valueOf().toString()}extractNonce(e){return wP.bufferToBigInt(e.topics[1]?.valueOf()).toFixed(0)}extractAmount(e){return wP.bufferToBigInt(e.topics[2]?.valueOf()).toFixed(0)}extractAddress(e){return H$.Address.fromBuffer(e.topics[3]?.valueOf()).toString()}};P0.TokenOperationsOutcomeParser=Mb});var Fb=D(Ms=>{"use strict";h();var G$=Ms&&Ms.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lb=Ms&&Ms.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&G$(e,t,r)};Object.defineProperty(Ms,"__esModule",{value:!0});Lb(mP(),Ms);Lb(yP(),Ms);Lb(vP(),Ms)});var AP=D(R0=>{"use strict";h();Object.defineProperty(R0,"__esModule",{value:!0});R0.DelegationTransactionsOutcomeParser=void 0;var j$=ke(),z$=Ie(),Q$=vc(),Ub=class{constructor(){}parseCreateNewDelegationContract(e){return this.ensureNoError(e.logs.events),Q$.findEventsByIdentifier(e,"SCDeploy").map(n=>({contractAddress:this.extractContractAddress(n)}))}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=p.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new z$.ErrParseTransactionOutcome(`encountered signalError: ${i} (${p.Buffer.from(n,"hex").toString()})`)}}extractContractAddress(e){if(!e.topics[0]?.length)return"";let r=p.Buffer.from(e.topics[0]);return j$.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return p.Buffer.from(e).toString()}};R0.DelegationTransactionsOutcomeParser=Ub});var SP=D(B0=>{"use strict";h();Object.defineProperty(B0,"__esModule",{value:!0});B0.SmartContractTransactionsOutcomeParser=void 0;var EP=ke(),K$=Ie(),bP=Vn(),W$=vc(),qb=class{constructor(e){this.abi=e?.abi,this.legacyResultsParser=e?.legacyResultsParser||new bP.ResultsParser}parseDeploy(e){let r=e.transactionOutcome.directSmartContractCallOutcome,i=W$.findEventsByIdentifier(e.transactionOutcome,"SCDeploy").map(s=>this.parseScDeployEvent(s));return{returnCode:r.returnCode,returnMessage:r.returnMessage,contracts:i}}parseScDeployEvent(e){let r=e.topics[0],n=e.topics[1],i=e.topics[2],s=r?.length?new EP.Address(r).toBech32():"",o=n?.length?new EP.Address(n).toBech32():"";return{address:s,ownerAddress:o,codeHash:i}}parseExecute(e){let r=e.transactionOutcome.directSmartContractCallOutcome;if(!this.abi)return{values:r.returnDataParts,returnCode:r.returnCode,returnMessage:r.returnMessage};let n=e.function||r.function;if(!n)throw new K$.Err('Function name is not available in the transaction outcome, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');let i=this.abi.getEndpoint(n),s={returnCode:new bP.ReturnCode(r.returnCode),returnMessage:r.returnMessage,values:r.returnDataParts.map(u=>p.Buffer.from(u))},o=this.legacyResultsParser.parseOutcomeFromUntypedBundle(s,i);return{values:o.values.map(u=>u.valueOf()),returnCode:o.returnCode.toString(),returnMessage:o.returnMessage}}};B0.SmartContractTransactionsOutcomeParser=qb});var TP=D(M0=>{"use strict";h();Object.defineProperty(M0,"__esModule",{value:!0});M0.TokenManagementTransactionsOutcomeParser=void 0;var $$=ke(),IP=Ie(),_P=Pu(),vr=vc(),Vb=class{constructor(){}parseIssueFungible(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"issue").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueNonFungible(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"issueNonFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueSemiFungible(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"issueSemiFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterMetaEsdt(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"registerMetaESDT").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterAndSetAllRoles(e){this.ensureNoError(e.logs.events);let r=vr.findEventsByIdentifier(e,"registerAndSetAllRoles"),n=vr.findEventsByIdentifier(e,"ESDTSetRole");if(r.length!==n.length)throw new IP.ErrParseTransactionOutcome("Register Events and Set Role events mismatch. Should have the same number of events.");return r.map((i,s)=>{let o=this.extractTokenIdentifier(i),a=n[s].topics.slice(3).map(c=>this.decodeTopicAsString(c));return{tokenIdentifier:o,roles:a}})}parseSetBurnRoleGlobally(e){this.ensureNoError(e.logs.events)}parseUnsetBurnRoleGlobally(e){this.ensureNoError(e.logs.events)}parseSetSpecialRole(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTSetRole").map(n=>this.getOutputForSetSpecialRoleEvent(n))}getOutputForSetSpecialRoleEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),s=e.topics.slice(3).map(o=>this.decodeTopicAsString(o));return{userAddress:r,tokenIdentifier:n,roles:s}}parseNftCreate(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTCreate").map(n=>this.getOutputForNftCreateEvent(n))}getOutputForNftCreateEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,initialQuantity:i}}parseLocalMint(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTLocalMint").map(n=>this.getOutputForLocalMintEvent(n))}getOutputForLocalMintEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,mintedSupply:s}}parseLocalBurn(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTLocalBurn").map(n=>this.getOutputForLocalBurnEvent(n))}getOutputForLocalBurnEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,burntSupply:s}}parsePause(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseUnpause(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTUnPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseFreeze(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTFreeze").map(n=>this.getOutputForFreezeEvent(n))}getOutputForFreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTUnFreeze").map(n=>this.getOutputForUnfreezeEvent(n))}getOutputForUnfreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTWipe").map(n=>this.getOutputForWipeEvent(n))}getOutputForWipeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTUpdateAttributes").map(n=>this.getOutputForUpdateAttributesEvent(n))}getOutputForUpdateAttributesEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=e.topics[3]?e.topics[3]:new Uint8Array;return{tokenIdentifier:r,nonce:n,attributes:i}}parseAddQuantity(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTAddQuantity").map(n=>this.getOutputForAddQuantityEvent(n))}getOutputForAddQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,addedQuantity:i}}parseBurnQuantity(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTBurn").map(n=>this.getOutputForBurnQuantityEvent(n))}getOutputForBurnQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,burntQuantity:i}}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=p.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new IP.ErrParseTransactionOutcome(`encountered signalError: ${i} (${p.Buffer.from(n,"hex").toString()})`)}}extractTokenIdentifier(e){return e.topics[0]?.length?this.decodeTopicAsString(e.topics[0]):""}extractNonce(e){if(!e.topics[1]?.length)return BigInt(0);let r=p.Buffer.from(e.topics[1]);return BigInt(_P.bufferToBigInt(r).toFixed(0))}extractAmount(e){if(!e.topics[2]?.length)return BigInt(0);let r=p.Buffer.from(e.topics[2]);return BigInt(_P.bufferToBigInt(r).toFixed(0))}extractAddress(e){if(!e.topics[3]?.length)return"";let r=p.Buffer.from(e.topics[3]);return $$.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return p.Buffer.from(e).toString()}};M0.TokenManagementTransactionsOutcomeParser=Vb});var CP=D(L0=>{"use strict";h();Object.defineProperty(L0,"__esModule",{value:!0});L0.TransactionEventsParser=void 0;var Y$=Vn(),kb=class{constructor(e){this.legacyResultsParser=new Y$.ResultsParser,this.abi=e.abi,this.firstTopicIsIdentifier=e.firstTopicIsIdentifier??!0}parseEvents(e){let r=[];for(let n of e.events){let i=this.parseEvent({event:n});r.push(i)}return r}parseEvent(e){let r=e.event.topics.map(u=>p.Buffer.from(u)),n=this.firstTopicIsIdentifier?r[0]?.toString():e.event.identifier;this.firstTopicIsIdentifier&&r.shift();let i=e.event.dataItems.map(u=>p.Buffer.from(u)),s=this.abi.getEvent(n);return this.legacyResultsParser.doParseEvent({topics:r,dataItems:i,eventDefinition:s})}};L0.TransactionEventsParser=kb});var Hb=D(bi=>{"use strict";h();var J$=bi&&bi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),th=bi&&bi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&J$(e,t,r)};Object.defineProperty(bi,"__esModule",{value:!0});th(AP(),bi);th(vc(),bi);th(SP(),bi);th(TP(),bi);th(CP(),bi)});var Sc=D(F0=>{"use strict";h();Object.defineProperty(F0,"__esModule",{value:!0});F0.Account=void 0;var X$=ke(),Gb=class{constructor(e){this.address=X$.Address.empty(),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()}}};F0.Account=Gb});var zb=D(Ic=>{"use strict";h();Object.defineProperty(Ic,"__esModule",{value:!0});Ic.MessageComputer=Ic.Message=void 0;var rh=yr(),Z$=ke(),eY=af(),U0=class{constructor(e){this.data=e.data,this.signature=e.signature,this.address=e.address,this.version=e.version||rh.DEFAULT_MESSAGE_VERSION,this.signer=e.signer||rh.SDK_JS_SIGNER}};Ic.Message=U0;var jb=class{constructor(){}computeBytesForSigning(e){let r=p.Buffer.from(e.data.length.toString()),n=p.Buffer.concat([r,e.data]),i=p.Buffer.concat([p.Buffer.from(rh.MESSAGE_PREFIX),n]);return eY("keccak256").update(i).digest()}computeBytesForVerifying(e){return this.computeBytesForSigning(e)}packMessage(e){return{message:p.Buffer.from(e.data).toString("hex"),signature:e.signature?p.Buffer.from(e.signature).toString("hex"):"",address:e.address?e.address.bech32():"",version:e.version,signer:e.signer}}unpackMessage(e){let r=this.trimHexPrefix(e.message),n=p.Buffer.from(r,"hex"),i=this.trimHexPrefix(e.signature||""),s=p.Buffer.from(i,"hex"),o;e.address&&(o=Z$.Address.fromBech32(e.address));let u=e.version||rh.DEFAULT_MESSAGE_VERSION,a=e.signer||rh.UNKNOWN_SIGNER;return new U0({data:n,signature:s,address:o,version:u,signer:a})}trimHexPrefix(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}};Ic.MessageComputer=jb});var Wb=D(es=>{"use strict";h();var tY=es&&es.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rY=es&&es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nY=es&&es.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tY(e,t,r);return rY(e,t),e};Object.defineProperty(es,"__esModule",{value:!0});es.AsyncTimer=void 0;var iY=nY(Ie()),sY=Ie(),Qb=so(),Kb=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new iY.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Qb.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){Qb.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new sY.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Qb.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};es.AsyncTimer=Kb});var V0=D(q0=>{"use strict";h();Object.defineProperty(q0,"__esModule",{value:!0});q0.TransactionWatcher=void 0;var $b=Wb(),NP=yr(),Ls=Ie(),xP=so(),Co=class t{constructor(e,r={}){this.fetcher=new Yb(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}async awaitPending(e){let r=s=>s.status.isPending(),n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Ls.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitCompleted(e){let r=s=>{if(s.isCompleted===void 0)throw new Ls.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Ls.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitAllEvents(e,r){let n=o=>{let u=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>u.includes(c))},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Ls.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitAnyEvent(e,r){let n=o=>{let u=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>u.includes(c))!=null},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Ls.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitOnCondition(e,r){let n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Ls.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}transactionOrTxHashToTxHash(e){let r=typeof e=="string"?e:e.getHash().hex();if(r.length!==NP.HEX_TRANSACTION_HASH_LENGTH)throw new Ls.Err(`Invalid transaction hash length. The length of a hex encoded hash should be ${NP.HEX_TRANSACTION_HASH_LENGTH}.`);return r}async awaitConditionally(e,r,n){let i=new $b.AsyncTimer("watcher:periodic"),s=new $b.AsyncTimer("watcher:patience"),o=new $b.AsyncTimer("watcher:timeout"),u=!1,a,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),u=!0});!u;){await i.start(this.pollingIntervalMilliseconds);try{if(a=await r(),c=e(a),c||u)break}catch(f){if(xP.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Ls.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Ls.Err))throw f}}if(c&&await s.start(this.patienceMilliseconds),o.isStopped()||o.stop(),!a||!c)throw n();return a}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};q0.TransactionWatcher=Co;Co.DefaultPollingInterval=6e3;Co.DefaultTimeout=Co.DefaultPollingInterval*15;Co.DefaultPatience=0;Co.NoopOnStatusReceived=t=>{};var Yb=class{constructor(e){this.fetcher=e}async getTransaction(e){return xP.Logger.debug(`transactionWatcher, getTransaction(${e})`),await this.fetcher.getTransaction(e)}}});var H0=D(k0=>{"use strict";h();Object.defineProperty(k0,"__esModule",{value:!0});k0.SignableMessage=void 0;var oY=ke(),aY=Yf(),uY=yr(),cY=af(),Jb=class{constructor(e){this.message=p.Buffer.from([]),this.signature=p.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=oY.Address.empty(),Object.assign(this,e)}serializeForSigning(){let e=p.Buffer.from(this.message.length.toString()),r=p.Buffer.concat([e,this.message]),n=p.Buffer.concat([p.Buffer.from(uY.MESSAGE_PREFIX),r]);return cY("keccak256").update(n).digest()}serializeForSigningRaw(){return p.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=aY.interpretSignatureAsBuffer(e)}getMessageSize(){let e=p.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};k0.SignableMessage=Jb});var _c=D(Ar=>{"use strict";h();var lY=Ar&&Ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fY=Ar&&Ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hY=Ar&&Ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lY(e,t,r);return fY(e,t),e};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.zeroPadStringIfOddLength=Ar.isPaddedHex=Ar.numberToPaddedHex=Ar.Nonce=Ar.Address=void 0;var OP=hY(_v()),dY="erd",Xb=class t{constructor(e){this.value=e}static fromPubkey(e){let r=OP.toWords(e),n=OP.encode(dY,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Ar.Address=Xb;var Zb=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return DP(this.value)}};Ar.Nonce=Zb;function DP(t){let e=t.toString(16);return PP(e)}Ar.numberToPaddedHex=DP;function gY(t){t=t||"";let e=p.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ar.isPaddedHex=gY;function PP(t){return t=t||"",t.length%2==1?"0"+t:t}Ar.zeroPadStringIfOddLength=PP});var RP=D(No=>{"use strict";h();var pY=No&&No.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(No,"__esModule",{value:!0});No.EsdtContractAddress=No.MaxUint64AsBigNumber=void 0;var mY=pY((nr(),xe(hr))),yY=_c();No.MaxUint64AsBigNumber=new mY.default("18446744073709551615");No.EsdtContractAddress=new yY.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var tS=D(Tc=>{"use strict";h();var wY=Tc&&Tc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tc,"__esModule",{value:!0});Tc.ContractQueryResponse=void 0;var vY=wY((nr(),xe(hr))),AY=RP(),eS=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new vY.default(e.gasRemaining||e.GasRemaining||0),o=AY.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>p.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};Tc.ContractQueryResponse=eS});var BP=D(xo=>{"use strict";h();Object.defineProperty(xo,"__esModule",{value:!0});xo.ErrAccountNotConnected=xo.ErrCannotSignSingleTransaction=xo.Err=void 0;var nh=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};xo.Err=nh;var rS=class extends nh{constructor(){super("Cannot sign single transaction.")}};xo.ErrCannotSignSingleTransaction=rS;var nS=class extends nh{constructor(){super("Account is not connected.")}};xo.ErrAccountNotConnected=nS});var MP=D(ih=>{"use strict";h();Object.defineProperty(ih,"__esModule",{value:!0});ih.Operation=void 0;var EY;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(EY=ih.Operation||(ih.Operation={}))});var iS=D(Cc=>{"use strict";h();var Oo=Cc&&Cc.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cc,"__esModule",{value:!0});Cc.ExtensionProvider=void 0;var bY=en(),LP=BP(),sh=MP(),oh=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Oo(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oo(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(sh.Operation.Connect,n),this.account.address})}logout(){return Oo(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(sh.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 Oo(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 Oo(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oo(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new LP.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new LP.ErrAccountNotConnected}signTransactions(e){return Oo(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(sh.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>bY.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Oo(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(sh.Operation.SignMessage,r)).signature,s=p.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(sh.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};Cc.ExtensionProvider=oh;oh._instance=new oh});function TY(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){CY(t);return}return e}function CY(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function ah(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!_Y.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(SY.test(t)||IY.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,TY)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var SY,IY,_Y,kP=de(()=>{h();SY=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,IY=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,_Y=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function NY(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function dr(t,...e){try{return NY(t(...e))}catch(r){return Promise.reject(r)}}function xY(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function OY(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function uh(t){if(xY(t))return String(t);if(OY(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return uh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function HP(){if(typeof p.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function GP(t){if(typeof t=="string")return t;HP();let e=p.Buffer.from(t).toString("base64");return sS+e}function jP(t){return typeof t!="string"||!t.startsWith(sS)?t:(HP(),p.Buffer.from(t.slice(sS.length),"base64"))}function Hr(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function zP(...t){return Hr(t.join(":"))}function ch(t){return t=Hr(t),t?t+":":""}var sS,QP=de(()=>{h();sS="base64:"});function $P(t={}){let e={mounts:{"":t.driver||PY()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(d=>d.startsWith(c)||f&&c.startsWith(d)).map(d=>({relativeBase:c.length>d.length?c.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),i=(c,f)=>{if(e.watching){f=Hr(f);for(let d of e.watchListeners)d(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await KP(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},u=(c,f,d)=>{let w=new Map,A=_=>{let N=w.get(_.base);return N||(N={driver:_.driver,base:_.base,items:[]},w.set(_.base,N)),N};for(let _ of c){let N=typeof _=="string",P=Hr(N?_:_.key),V=N?void 0:_.value,U=N||!_.options?f:{...f,..._.options},Q=r(P);A(Q).items.push({key:P,value:V,relativeKey:Q.relativeKey,options:U})}return Promise.all([...w.values()].map(_=>d(_))).then(_=>_.flat())},a={hasItem(c,f={}){c=Hr(c);let{relativeKey:d,driver:w}=r(c);return dr(w.hasItem,d,f)},getItem(c,f={}){c=Hr(c);let{relativeKey:d,driver:w}=r(c);return dr(w.getItem,d,f).then(A=>ah(A))},getItems(c,f){return u(c,f,d=>d.driver.getItems?dr(d.driver.getItems,d.items.map(w=>({key:w.relativeKey,options:w.options})),f).then(w=>w.map(A=>({key:zP(d.base,A.key),value:ah(A.value)}))):Promise.all(d.items.map(w=>dr(d.driver.getItem,w.relativeKey,w.options).then(A=>({key:w.key,value:ah(A)})))))},getItemRaw(c,f={}){c=Hr(c);let{relativeKey:d,driver:w}=r(c);return w.getItemRaw?dr(w.getItemRaw,d,f):dr(w.getItem,d,f).then(A=>jP(A))},async setItem(c,f,d={}){if(f===void 0)return a.removeItem(c);c=Hr(c);let{relativeKey:w,driver:A}=r(c);A.setItem&&(await dr(A.setItem,w,uh(f),d),A.watch||i("update",c))},async setItems(c,f){await u(c,f,async d=>{if(d.driver.setItems)return dr(d.driver.setItems,d.items.map(w=>({key:w.relativeKey,value:uh(w.value),options:w.options})),f);d.driver.setItem&&await Promise.all(d.items.map(w=>dr(d.driver.setItem,w.relativeKey,uh(w.value),w.options)))})},async setItemRaw(c,f,d={}){if(f===void 0)return a.removeItem(c,d);c=Hr(c);let{relativeKey:w,driver:A}=r(c);if(A.setItemRaw)await dr(A.setItemRaw,w,f,d);else if(A.setItem)await dr(A.setItem,w,GP(f),d);else return;A.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=Hr(c);let{relativeKey:d,driver:w}=r(c);w.removeItem&&(await dr(w.removeItem,d,f),(f.removeMeta||f.removeMata)&&await dr(w.removeItem,d+"$",f),w.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=Hr(c);let{relativeKey:d,driver:w}=r(c),A=Object.create(null);if(w.getMeta&&Object.assign(A,await dr(w.getMeta,d,f)),!f.nativeOnly){let _=await dr(w.getItem,d+"$",f).then(N=>ah(N));_&&typeof _=="object"&&(typeof _.atime=="string"&&(_.atime=new Date(_.atime)),typeof _.mtime=="string"&&(_.mtime=new Date(_.mtime)),Object.assign(A,_))}return A},setMeta(c,f,d={}){return this.setItem(c+"$",f,d)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=ch(c);let d=n(c,!0),w=[],A=[];for(let _ of d){let P=(await dr(_.driver.getKeys,_.relativeBase,f)).map(V=>_.mountpoint+Hr(V)).filter(V=>!w.some(U=>V.startsWith(U)));A.push(...P),w=[_.mountpoint,...w.filter(V=>!V.startsWith(_.mountpoint))]}return c?A.filter(_=>_.startsWith(c)&&!_.endsWith("$")):A.filter(_=>!_.endsWith("$"))},async clear(c,f={}){c=ch(c),await Promise.all(n(c,!1).map(async d=>{if(d.driver.clear)return dr(d.driver.clear,d.relativeBase,f);if(d.driver.removeItem){let w=await d.driver.getKeys(d.relativeBase||"",f);return Promise.all(w.map(A=>d.driver.removeItem(A,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>WP(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=ch(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((d,w)=>w.length-d.length)),e.mounts[c]=f,e.watching&&Promise.resolve(KP(f,i,c)).then(d=>{e.unwatch[c]=d}).catch(console.error),a},async unmount(c,f=!0){c=ch(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await WP(e.mounts[c]),e.mountpoints=e.mountpoints.filter(d=>d!==c),delete e.mounts[c])},getMount(c=""){c=Hr(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=Hr(c),n(c,f.parents).map(w=>({driver:w.driver,base:w.mountpoint}))}};return a}function KP(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function WP(t){typeof t.dispose=="function"&&await dr(t.dispose)}var DY,PY,YP=de(()=>{h();kP();QP();DY="memory",PY=()=>{let t=new Map;return{name:DY,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function Ga(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function aS(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Ga(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function lh(){return oS||(oS=aS("keyval-store","keyval")),oS}function uS(t,e=lh()){return e("readonly",r=>Ga(r.get(t)))}function JP(t,e,r=lh()){return r("readwrite",n=>(n.put(e,t),Ga(n.transaction)))}function XP(t,e=lh()){return e("readwrite",r=>(r.delete(t),Ga(r.transaction)))}function ZP(t=lh()){return t("readwrite",e=>(e.clear(),Ga(e.transaction)))}function RY(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ga(t.transaction)}function e8(t=lh()){return t("readonly",e=>{if(e.getAllKeys)return Ga(e.getAllKeys());let r=[];return RY(e,n=>r.push(n.key)).then(()=>r)})}var oS,t8=de(()=>{h()});var r8={};Ot(r8,{safeJsonParse:()=>Po,safeJsonStringify:()=>Si});function Po(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return MY(t)}catch{return t}}function Si(t){return typeof t=="string"?t:BY(t)||""}var BY,MY,Nc=de(()=>{h();BY=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),MY=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var i8={};Ot(i8,{KeyValueStorage:()=>hS,default:()=>hS});function VY(t){var e;return[t[0],Po((e=t[1])!=null?e:"")]}var LY,FY,UY,qY,lS,cS,Q0,fS,kY,n8,HY,GY,hS,s8=de(()=>{h();YP();t8();Nc();LY="idb-keyval",FY=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=aS(t.dbName,t.storeName)),{name:LY,options:t,async hasItem(i){return!(typeof await uS(r(i),n)>"u")},async getItem(i){return await uS(r(i),n)??null},setItem(i,s){return JP(r(i),s,n)},removeItem(i){return XP(r(i),n)},getKeys(){return e8(n)},clear(){return ZP(n)}}},UY="WALLET_CONNECT_V2_INDEXED_DB",qY="keyvaluestorage",lS=class{constructor(){this.indexedDb=$P({driver:FY({dbName:UY,storeName:qY})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Si(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},cS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Q0={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof cS<"u"&&cS.localStorage?Q0.exports=cS.localStorage:typeof window<"u"&&window.localStorage?Q0.exports=window.localStorage:Q0.exports=new e})();fS=class{constructor(){this.localStorage=Q0.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(VY)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Po(r)}async setItem(e,r){this.localStorage.setItem(e,Si(r))}async removeItem(e){this.localStorage.removeItem(e)}},kY="wc_storage_version",n8=1,HY=async(t,e,r)=>{let n=kY,i=await e.getItem(n);if(i&&i>=n8){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let u=s.shift();if(!u)continue;let a=u.toLowerCase();if(a.includes("wc@")||a.includes("walletconnect")||a.includes("wc_")||a.includes("wallet_connect")){let c=await t.getItem(u);await e.setItem(u,c),o.push(u)}}await e.setItem(n,n8),r(e),GY(t,o)},GY=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},hS=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new fS;this.storage=e;try{let r=new lS;HY(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var xc={};Ot(xc,{__assign:()=>gS,__asyncDelegator:()=>rJ,__asyncGenerator:()=>tJ,__asyncValues:()=>nJ,__await:()=>fh,__awaiter:()=>$Y,__classPrivateFieldGet:()=>aJ,__classPrivateFieldSet:()=>uJ,__createBinding:()=>JY,__decorate:()=>QY,__exportStar:()=>XY,__extends:()=>jY,__generator:()=>YY,__importDefault:()=>oJ,__importStar:()=>sJ,__makeTemplateObject:()=>iJ,__metadata:()=>WY,__param:()=>KY,__read:()=>o8,__rest:()=>zY,__spread:()=>ZY,__spreadArrays:()=>eJ,__values:()=>pS});function jY(t,e){dS(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function zY(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;u--)(o=t[u])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function KY(t,e){return function(r,n){e(r,n,t)}}function WY(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function $Y(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})}function YY(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(c){return function(f){return a([c,f])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o8(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function ZY(){for(var t=[],e=0;e1||u(w,A)})})}function u(w,A){try{a(n[w](A))}catch(_){d(s[0][3],_)}}function a(w){w.value instanceof fh?Promise.resolve(w.value.v).then(c,f):d(s[0][2],w)}function c(w){u("next",w)}function f(w){u("throw",w)}function d(w,A){w(A),s.shift(),s.length&&u(s[0][0],s[0][1])}}function rJ(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:fh(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function nJ(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof pS=="function"?pS(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(u,a){o=t[s](o),i(u,a,o.done,o.value)})}}function i(s,o,u,a){Promise.resolve(a).then(function(c){s({value:c,done:u})},o)}}function iJ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function sJ(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function oJ(t){return t&&t.__esModule?t:{default:t}}function aJ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function uJ(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var dS,gS,Oc=de(()=>{h();dS=function(t,e){return dS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},dS(t,e)};gS=function(){return gS=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";h();Object.defineProperty(K0,"__esModule",{value:!0});K0.delay=void 0;function cJ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}K0.delay=cJ});var u8=D(Dc=>{"use strict";h();Object.defineProperty(Dc,"__esModule",{value:!0});Dc.ONE_THOUSAND=Dc.ONE_HUNDRED=void 0;Dc.ONE_HUNDRED=100;Dc.ONE_THOUSAND=1e3});var c8=D(le=>{"use strict";h();Object.defineProperty(le,"__esModule",{value:!0});le.ONE_YEAR=le.FOUR_WEEKS=le.THREE_WEEKS=le.TWO_WEEKS=le.ONE_WEEK=le.THIRTY_DAYS=le.SEVEN_DAYS=le.FIVE_DAYS=le.THREE_DAYS=le.ONE_DAY=le.TWENTY_FOUR_HOURS=le.TWELVE_HOURS=le.SIX_HOURS=le.THREE_HOURS=le.ONE_HOUR=le.SIXTY_MINUTES=le.THIRTY_MINUTES=le.TEN_MINUTES=le.FIVE_MINUTES=le.ONE_MINUTE=le.SIXTY_SECONDS=le.THIRTY_SECONDS=le.TEN_SECONDS=le.FIVE_SECONDS=le.ONE_SECOND=void 0;le.ONE_SECOND=1;le.FIVE_SECONDS=5;le.TEN_SECONDS=10;le.THIRTY_SECONDS=30;le.SIXTY_SECONDS=60;le.ONE_MINUTE=le.SIXTY_SECONDS;le.FIVE_MINUTES=le.ONE_MINUTE*5;le.TEN_MINUTES=le.ONE_MINUTE*10;le.THIRTY_MINUTES=le.ONE_MINUTE*30;le.SIXTY_MINUTES=le.ONE_MINUTE*60;le.ONE_HOUR=le.SIXTY_MINUTES;le.THREE_HOURS=le.ONE_HOUR*3;le.SIX_HOURS=le.ONE_HOUR*6;le.TWELVE_HOURS=le.ONE_HOUR*12;le.TWENTY_FOUR_HOURS=le.ONE_HOUR*24;le.ONE_DAY=le.TWENTY_FOUR_HOURS;le.THREE_DAYS=le.ONE_DAY*3;le.FIVE_DAYS=le.ONE_DAY*5;le.SEVEN_DAYS=le.ONE_DAY*7;le.THIRTY_DAYS=le.ONE_DAY*30;le.ONE_WEEK=le.SEVEN_DAYS;le.TWO_WEEKS=le.ONE_WEEK*2;le.THREE_WEEKS=le.ONE_WEEK*3;le.FOUR_WEEKS=le.ONE_WEEK*4;le.ONE_YEAR=le.ONE_DAY*365});var mS=D(W0=>{"use strict";h();Object.defineProperty(W0,"__esModule",{value:!0});var l8=(Oc(),xe(xc));l8.__exportStar(u8(),W0);l8.__exportStar(c8(),W0)});var h8=D(Pc=>{"use strict";h();Object.defineProperty(Pc,"__esModule",{value:!0});Pc.fromMiliseconds=Pc.toMiliseconds=void 0;var f8=mS();function lJ(t){return t*f8.ONE_THOUSAND}Pc.toMiliseconds=lJ;function fJ(t){return Math.floor(t/f8.ONE_THOUSAND)}Pc.fromMiliseconds=fJ});var g8=D($0=>{"use strict";h();Object.defineProperty($0,"__esModule",{value:!0});var d8=(Oc(),xe(xc));d8.__exportStar(a8(),$0);d8.__exportStar(h8(),$0)});var p8=D(hh=>{"use strict";h();Object.defineProperty(hh,"__esModule",{value:!0});hh.Watch=void 0;var Y0=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};hh.Watch=Y0;hh.default=Y0});var m8=D(J0=>{"use strict";h();Object.defineProperty(J0,"__esModule",{value:!0});J0.IWatch=void 0;var yS=class{};J0.IWatch=yS});var y8=D(wS=>{"use strict";h();Object.defineProperty(wS,"__esModule",{value:!0});var hJ=(Oc(),xe(xc));hJ.__exportStar(m8(),wS)});var Bc=D(Rc=>{"use strict";h();Object.defineProperty(Rc,"__esModule",{value:!0});var X0=(Oc(),xe(xc));X0.__exportStar(g8(),Rc);X0.__exportStar(p8(),Rc);X0.__exportStar(y8(),Rc);X0.__exportStar(mS(),Rc)});var dh,w8=de(()=>{h();dh=class{}});var v8={};Ot(v8,{IEvents:()=>dh});var vS=de(()=>{h();w8()});var b8={};Ot(b8,{HEARTBEAT_EVENTS:()=>E8,HEARTBEAT_INTERVAL:()=>AS,HeartBeat:()=>ES,IHeartBeat:()=>Z0});var A8,em,Z0,AS,E8,ES,S8=de(()=>{h();A8=ge(Os()),em=ge(Bc());vS();Z0=class extends dh{constructor(e){super()}},AS=em.FIVE_SECONDS,E8={pulse:"heartbeat_pulse"},ES=class t extends Z0{constructor(e){super(e),this.events=new A8.EventEmitter,this.interval=AS,this.interval=e?.interval||AS}static async init(e){let r=new t(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,em.toMiliseconds)(this.interval))}pulse(){this.events.emit(E8.pulse)}}});var _8=D((KAe,I8)=>{"use strict";h();function dJ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}I8.exports=gJ;function gJ(t,e,r){var n=r&&r.stringify||dJ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var u=1;u-1?d:0,t.charCodeAt(A+1)){case 100:case 102:if(f>=a||e[f]==null)break;d=a||e[f]==null)break;d=a||e[f]===void 0)break;d",d=A+2,A++;break}c+=n(e[f]),d=A+2,A++;break;case 115:if(f>=a)break;d{"use strict";h();var T8=_8();x8.exports=ts;var gh=IJ().console||{},pJ={mapHttpRequest:tm,mapHttpResponse:tm,wrapRequestSerializer:bS,wrapResponseSerializer:bS,wrapErrorSerializer:bS,req:tm,res:tm,err:AJ};function mJ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function ts(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||gh;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=mJ(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let u=t.level||"info",a=Object.create(r);a.log||(a.log=ph),Object.defineProperty(a,"levelVal",{get:f}),Object.defineProperty(a,"level",{get:d,set:w});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:EJ(t)};a.levels=ts.levels,a.level=u,a.setMaxListeners=a.getMaxListeners=a.emit=a.addListener=a.on=a.prependListener=a.once=a.prependOnceListener=a.removeListener=a.removeAllListeners=a.listeners=a.listenerCount=a.eventNames=a.write=a.flush=ph,a.serializers=n,a._serialize=i,a._stdErrSerialize=s,a.child=A,e&&(a._logEvent=SS());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function w(_){if(_!=="silent"&&!this.levels.values[_])throw Error("unknown level "+_);this._level=_,Mc(c,a,"error","log"),Mc(c,a,"fatal","error"),Mc(c,a,"warn","error"),Mc(c,a,"info","log"),Mc(c,a,"debug","log"),Mc(c,a,"trace","log")}function A(_,N){if(!_)throw new Error("missing bindings for child Pino");N=N||{},i&&_.serializers&&(N.serializers=_.serializers);let P=N.serializers;if(i&&P){var V=Object.assign({},n,P),U=t.browser.serialize===!0?Object.keys(V):i;delete _.serializers,rm([_],U,V,this._stdErrSerialize)}function Q(L){this._childLevel=(L._childLevel|0)+1,this.error=Lc(L,_,"error"),this.fatal=Lc(L,_,"fatal"),this.warn=Lc(L,_,"warn"),this.info=Lc(L,_,"info"),this.debug=Lc(L,_,"debug"),this.trace=Lc(L,_,"trace"),V&&(this.serializers=V,this._serialize=U),e&&(this._logEvent=SS([].concat(L._logEvent.bindings,_)))}return Q.prototype=this,new Q(this)}return a}ts.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"}};ts.stdSerializers=pJ;ts.stdTimeFunctions=Object.assign({},{nullTime:C8,epochTime:N8,unixTime:bJ,isoTime:SJ});function Mc(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?ph:i[r]?i[r]:gh[r]||gh[n]||ph,yJ(t,e,r)}function yJ(t,e,r){!t.transmit&&e[r]===ph||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===gh?gh:this;for(var a=0;a-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Lc(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;iam,PINO_CUSTOM_CONTEXT_KEY:()=>Fc,PINO_LOGGER_DEFAULTS:()=>R8,formatChildLoggerContext:()=>F8,generateChildLogger:()=>DJ,generateClientLogger:()=>U8,generatePlatformLogger:()=>PJ,generateServerLogger:()=>q8,getBrowserLoggerContext:()=>B8,getDefaultLoggerOptions:()=>OJ,getLoggerContext:()=>L8,pino:()=>P8.default,setBrowserLoggerContext:()=>M8});function OJ(t){return om(sm({},t),{level:t?.level||R8.level})}function B8(t,e=Fc){return t[e]||""}function M8(t,e,r=Fc){return t[r]=e,t}function L8(t,e=Fc){let r="";return typeof t.bindings>"u"?r=B8(t,e):r=t.bindings().context||"",r}function F8(t,e,r=Fc){let n=L8(t,r);return n.trim()?`${n}/${e}`:e}function DJ(t,e,r=Fc){let n=F8(t,e,r),i=t.child({context:n});return M8(i,n,r)}function U8(t){var e,r;let n=new TS((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Fs.default)(om(sm({},t.opts),{level:"trace",browser:om(sm({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function q8(t){var e;let r=new CS((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Fs.default)(om(sm({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function PJ(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?U8(t):q8(t)}var Fs,P8,R8,Fc,am,_S,nm,im,TS,CS,_J,TJ,CJ,O8,NJ,xJ,D8,sm,om,xS=de(()=>{h();Fs=ge(IS()),P8=ge(IS());Nc();R8={level:"info"},Fc="custom_context",am=1e3*1024,_S=class{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},nm=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let r=new _S(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};let r=e.value;return e=e.next,{done:!1,value:r}}}}},im=class{constructor(e,r=am){this.level=e??"error",this.levelValue=Fs.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new nm(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Fs.levels.values.error?console.error(e):r===Fs.levels.values.warn?console.warn(e):r===Fs.levels.values.debug?console.debug(e):r===Fs.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Si({timestamp:new Date().toISOString(),log:e}));let r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new nm(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let r=this.getLogArray();return r.push(Si({extraMetadata:e})),new Blob(r,{type:"application/json"})}},TS=class{constructor(e,r=am){this.baseChunkLogger=new im(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){let r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CS=class{constructor(e,r=am){this.baseChunkLogger=new im(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}},_J=Object.defineProperty,TJ=Object.defineProperties,CJ=Object.getOwnPropertyDescriptors,O8=Object.getOwnPropertySymbols,NJ=Object.prototype.hasOwnProperty,xJ=Object.prototype.propertyIsEnumerable,D8=(t,e,r)=>e in t?_J(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sm=(t,e)=>{for(var r in e||(e={}))NJ.call(e,r)&&D8(t,r,e[r]);if(O8)for(var r of O8(e))xJ.call(e,r)&&D8(t,r,e[r]);return t},om=(t,e)=>TJ(t,CJ(e))});var WS=D(ur=>{"use strict";h();Object.defineProperty(ur,"__esModule",{value:!0});var Uc=(vS(),xe(v8)),V8=Os();function RJ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var BJ=RJ(V8),OS=class extends Uc.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},DS=class{constructor(e,r,n){this.core=e,this.logger=r}},PS=class extends Uc.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},RS=class{constructor(e,r){this.logger=e,this.core=r}},BS=class extends Uc.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},MS=class extends Uc.IEvents{constructor(e){super()}},LS=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},FS=class{constructor(){this.map=new Map}},US=class extends Uc.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},qS=class{constructor(e,r){this.core=e,this.logger=r}},VS=class extends Uc.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},kS=class{constructor(e,r){this.logger=e,this.core=r}},HS=class{constructor(e,r){this.projectId=e,this.logger=r}},GS=class{constructor(e,r){this.projectId=e,this.logger=r}},jS=class extends BJ.default{constructor(){super()}},zS=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QS=class extends V8.EventEmitter{constructor(){super()}},KS=class{constructor(e){this.client=e}};ur.ICore=OS,ur.ICrypto=DS,ur.IEchoClient=GS,ur.IEngine=KS,ur.IEngineEvents=QS,ur.IExpirer=VS,ur.IJsonRpcHistory=PS,ur.IKeyChain=qS,ur.IMessageTracker=RS,ur.IPairing=kS,ur.IPublisher=BS,ur.IRelayer=MS,ur.ISignClient=zS,ur.ISignClientEvents=jS,ur.IStore=LS,ur.ISubscriber=US,ur.ISubscriberTopicMap=FS,ur.IVerify=HS});var H8=D(um=>{"use strict";h();Object.defineProperty(um,"__esModule",{value:!0});um.BrowserRandomSource=void 0;var k8=65536,$S=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";h();Object.defineProperty(YS,"__esModule",{value:!0});function MJ(t){for(var e=0;e{h()});var j8=D(cm=>{"use strict";h();Object.defineProperty(cm,"__esModule",{value:!0});cm.NodeRandomSource=void 0;var LJ=Wn(),JS=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Pd<"u"){let e=G8();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";h();Object.defineProperty(lm,"__esModule",{value:!0});lm.SystemRandomSource=void 0;var FJ=H8(),UJ=j8(),XS=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new FJ.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new UJ.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)}};lm.SystemRandomSource=XS});var Q8=D(gn=>{"use strict";h();Object.defineProperty(gn,"__esModule",{value:!0});function qJ(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}gn.mul=Math.imul||qJ;function VJ(t,e){return t+e|0}gn.add=VJ;function kJ(t,e){return t-e|0}gn.sub=kJ;function HJ(t,e){return t<>>32-e}gn.rotl=HJ;function GJ(t,e){return t<<32-e|t>>>e}gn.rotr=GJ;function jJ(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}gn.isInteger=Number.isInteger||jJ;gn.MAX_SAFE_INTEGER=9007199254740991;gn.isSafeInteger=function(t){return gn.isInteger(t)&&t>=-gn.MAX_SAFE_INTEGER&&t<=gn.MAX_SAFE_INTEGER}});var qc=D(Ne=>{"use strict";h();Object.defineProperty(Ne,"__esModule",{value:!0});var K8=Q8();function zJ(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=zJ;function QJ(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=QJ;function KJ(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=KJ;function WJ(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=WJ;function W8(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=W8;Ne.writeInt16BE=W8;function $8(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=$8;Ne.writeInt16LE=$8;function ZS(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=ZS;function eI(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=eI;function tI(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=tI;function rI(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=rI;function fm(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=fm;Ne.writeInt32BE=fm;function hm(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=hm;Ne.writeInt32LE=hm;function $J(t,e){e===void 0&&(e=0);var r=ZS(t,e),n=ZS(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=$J;function YJ(t,e){e===void 0&&(e=0);var r=eI(t,e),n=eI(t,e+4);return r*4294967296+n}Ne.readUint64BE=YJ;function JJ(t,e){e===void 0&&(e=0);var r=tI(t,e),n=tI(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=JJ;function XJ(t,e){e===void 0&&(e=0);var r=rI(t,e),n=rI(t,e+4);return n*4294967296+r}Ne.readUint64LE=XJ;function Y8(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fm(t/4294967296>>>0,e,r),fm(t>>>0,e,r+4),e}Ne.writeUint64BE=Y8;Ne.writeInt64BE=Y8;function J8(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),hm(t>>>0,e,r),hm(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=J8;Ne.writeInt64LE=J8;function ZJ(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=ZJ;function eX(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=tX;function rX(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!K8.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";h();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.randomStringForEntropy=Mr.randomString=Mr.randomUint32=Mr.randomBytes=Mr.defaultRandomSource=void 0;var fX=z8(),hX=qc(),X8=Wn();Mr.defaultRandomSource=new fX.SystemRandomSource;function nI(t,e=Mr.defaultRandomSource){return e.randomBytes(t)}Mr.randomBytes=nI;function dX(t=Mr.defaultRandomSource){let e=nI(4,t),r=(0,hX.readUint32LE)(e);return(0,X8.wipe)(e),r}Mr.randomUint32=dX;var Z8="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function eR(t,e=Z8,r=Mr.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=nI(Math.ceil(t*256/s),r);for(let u=0;u0;u++){let a=o[u];a{"use strict";h();Object.defineProperty(Us,"__esModule",{value:!0});var kc=qc(),Vc=Wn();Us.DIGEST_LENGTH=64;Us.BLOCK_SIZE=128;var rR=function(){function t(){this.digestLength=Us.DIGEST_LENGTH,this.blockSize=Us.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Vc.wipe(this._buffer),Vc.wipe(this._tempHi),Vc.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(iI(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=iI(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var u=n+1;u0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Vc.wipe(e.stateHi),Vc.wipe(e.stateLo),e.buffer&&Vc.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Us.SHA512=rR;var tR=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 iI(t,e,r,n,i,s,o){for(var u=r[0],a=r[1],c=r[2],f=r[3],d=r[4],w=r[5],A=r[6],_=r[7],N=n[0],P=n[1],V=n[2],U=n[3],Q=n[4],L=n[5],k=n[6],H=n[7],q,v,C,R,F,B,l,g;o>=128;){for(var y=0;y<16;y++){var E=8*y+s;t[y]=kc.readUint32BE(i,E),e[y]=kc.readUint32BE(i,E+4)}for(var y=0;y<80;y++){var I=u,T=a,M=c,x=f,m=d,O=w,Y=A,$=_,b=N,j=P,z=V,W=U,ie=Q,te=L,ee=k,se=H;if(q=_,v=H,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=(d>>>14|Q<<18)^(d>>>18|Q<<14)^(Q>>>9|d<<23),v=(Q>>>14|d<<18)^(Q>>>18|d<<14)^(d>>>9|Q<<23),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=d&w^~d&A,v=Q&L^~Q&k,F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=tR[y*2],v=tR[y*2+1],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=t[y%16],v=e[y%16],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,C=l&65535|g<<16,R=F&65535|B<<16,q=C,v=R,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=(u>>>28|N<<4)^(N>>>2|u<<30)^(N>>>7|u<<25),v=(N>>>28|u<<4)^(u>>>2|N<<30)^(u>>>7|N<<25),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=u&a^u&c^a&c,v=N&P^N&V^P&V,F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,$=l&65535|g<<16,se=F&65535|B<<16,q=x,v=W,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=C,v=R,F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,x=l&65535|g<<16,W=F&65535|B<<16,a=I,c=T,f=M,d=x,w=m,A=O,_=Y,u=$,P=b,V=j,U=z,Q=W,L=ie,k=te,H=ee,N=se,y%16===15)for(var E=0;E<16;E++)q=t[E],v=e[E],F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=t[(E+9)%16],v=e[(E+9)%16],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,C=t[(E+1)%16],R=e[(E+1)%16],q=(C>>>1|R<<31)^(C>>>8|R<<24)^C>>>7,v=(R>>>1|C<<31)^(R>>>8|C<<24)^(R>>>7|C<<25),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,C=t[(E+14)%16],R=e[(E+14)%16],q=(C>>>19|R<<13)^(R>>>29|C<<3)^C>>>6,v=(R>>>19|C<<13)^(C>>>29|R<<3)^(R>>>6|C<<26),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,t[E]=l&65535|g<<16,e[E]=F&65535|B<<16}q=u,v=N,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[0],v=n[0],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[0]=u=l&65535|g<<16,n[0]=N=F&65535|B<<16,q=a,v=P,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[1],v=n[1],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[1]=a=l&65535|g<<16,n[1]=P=F&65535|B<<16,q=c,v=V,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[2],v=n[2],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[2]=c=l&65535|g<<16,n[2]=V=F&65535|B<<16,q=f,v=U,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[3],v=n[3],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[3]=f=l&65535|g<<16,n[3]=U=F&65535|B<<16,q=d,v=Q,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[4],v=n[4],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[4]=d=l&65535|g<<16,n[4]=Q=F&65535|B<<16,q=w,v=L,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[5],v=n[5],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[5]=w=l&65535|g<<16,n[5]=L=F&65535|B<<16,q=A,v=k,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[6],v=n[6],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[6]=A=l&65535|g<<16,n[6]=k=F&65535|B<<16,q=_,v=H,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[7],v=n[7],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[7]=_=l&65535|g<<16,n[7]=H=F&65535|B<<16,s+=128,o-=128}return s}function pX(t){var e=new rR;e.update(t);var r=e.digest();return e.clean(),r}Us.hash=pX});var yR=D(Ge=>{"use strict";h();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.convertSecretKeyToX25519=Ge.convertPublicKeyToX25519=Ge.verify=Ge.sign=Ge.extractPublicKeyFromSecretKey=Ge.generateKeyPair=Ge.generateKeyPairFromSeed=Ge.SEED_LENGTH=Ge.SECRET_KEY_LENGTH=Ge.PUBLIC_KEY_LENGTH=Ge.SIGNATURE_LENGTH=void 0;var mX=mh(),yh=nR(),uR=Wn();Ge.SIGNATURE_LENGTH=64;Ge.PUBLIC_KEY_LENGTH=32;Ge.SECRET_KEY_LENGTH=64;Ge.SEED_LENGTH=32;function Ae(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,cR(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function lR(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function oR(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return wh(r,t),wh(n,e),lR(r,n)}function fR(t){let e=new Uint8Array(32);return wh(e,t),e[0]&1}function EX(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function ja(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Qa(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Nt(t,e,r){let n,i,s=0,o=0,u=0,a=0,c=0,f=0,d=0,w=0,A=0,_=0,N=0,P=0,V=0,U=0,Q=0,L=0,k=0,H=0,q=0,v=0,C=0,R=0,F=0,B=0,l=0,g=0,y=0,E=0,I=0,T=0,M=0,x=r[0],m=r[1],O=r[2],Y=r[3],$=r[4],b=r[5],j=r[6],z=r[7],W=r[8],ie=r[9],te=r[10],ee=r[11],se=r[12],oe=r[13],J=r[14],ue=r[15];n=e[0],s+=n*x,o+=n*m,u+=n*O,a+=n*Y,c+=n*$,f+=n*b,d+=n*j,w+=n*z,A+=n*W,_+=n*ie,N+=n*te,P+=n*ee,V+=n*se,U+=n*oe,Q+=n*J,L+=n*ue,n=e[1],o+=n*x,u+=n*m,a+=n*O,c+=n*Y,f+=n*$,d+=n*b,w+=n*j,A+=n*z,_+=n*W,N+=n*ie,P+=n*te,V+=n*ee,U+=n*se,Q+=n*oe,L+=n*J,k+=n*ue,n=e[2],u+=n*x,a+=n*m,c+=n*O,f+=n*Y,d+=n*$,w+=n*b,A+=n*j,_+=n*z,N+=n*W,P+=n*ie,V+=n*te,U+=n*ee,Q+=n*se,L+=n*oe,k+=n*J,H+=n*ue,n=e[3],a+=n*x,c+=n*m,f+=n*O,d+=n*Y,w+=n*$,A+=n*b,_+=n*j,N+=n*z,P+=n*W,V+=n*ie,U+=n*te,Q+=n*ee,L+=n*se,k+=n*oe,H+=n*J,q+=n*ue,n=e[4],c+=n*x,f+=n*m,d+=n*O,w+=n*Y,A+=n*$,_+=n*b,N+=n*j,P+=n*z,V+=n*W,U+=n*ie,Q+=n*te,L+=n*ee,k+=n*se,H+=n*oe,q+=n*J,v+=n*ue,n=e[5],f+=n*x,d+=n*m,w+=n*O,A+=n*Y,_+=n*$,N+=n*b,P+=n*j,V+=n*z,U+=n*W,Q+=n*ie,L+=n*te,k+=n*ee,H+=n*se,q+=n*oe,v+=n*J,C+=n*ue,n=e[6],d+=n*x,w+=n*m,A+=n*O,_+=n*Y,N+=n*$,P+=n*b,V+=n*j,U+=n*z,Q+=n*W,L+=n*ie,k+=n*te,H+=n*ee,q+=n*se,v+=n*oe,C+=n*J,R+=n*ue,n=e[7],w+=n*x,A+=n*m,_+=n*O,N+=n*Y,P+=n*$,V+=n*b,U+=n*j,Q+=n*z,L+=n*W,k+=n*ie,H+=n*te,q+=n*ee,v+=n*se,C+=n*oe,R+=n*J,F+=n*ue,n=e[8],A+=n*x,_+=n*m,N+=n*O,P+=n*Y,V+=n*$,U+=n*b,Q+=n*j,L+=n*z,k+=n*W,H+=n*ie,q+=n*te,v+=n*ee,C+=n*se,R+=n*oe,F+=n*J,B+=n*ue,n=e[9],_+=n*x,N+=n*m,P+=n*O,V+=n*Y,U+=n*$,Q+=n*b,L+=n*j,k+=n*z,H+=n*W,q+=n*ie,v+=n*te,C+=n*ee,R+=n*se,F+=n*oe,B+=n*J,l+=n*ue,n=e[10],N+=n*x,P+=n*m,V+=n*O,U+=n*Y,Q+=n*$,L+=n*b,k+=n*j,H+=n*z,q+=n*W,v+=n*ie,C+=n*te,R+=n*ee,F+=n*se,B+=n*oe,l+=n*J,g+=n*ue,n=e[11],P+=n*x,V+=n*m,U+=n*O,Q+=n*Y,L+=n*$,k+=n*b,H+=n*j,q+=n*z,v+=n*W,C+=n*ie,R+=n*te,F+=n*ee,B+=n*se,l+=n*oe,g+=n*J,y+=n*ue,n=e[12],V+=n*x,U+=n*m,Q+=n*O,L+=n*Y,k+=n*$,H+=n*b,q+=n*j,v+=n*z,C+=n*W,R+=n*ie,F+=n*te,B+=n*ee,l+=n*se,g+=n*oe,y+=n*J,E+=n*ue,n=e[13],U+=n*x,Q+=n*m,L+=n*O,k+=n*Y,H+=n*$,q+=n*b,v+=n*j,C+=n*z,R+=n*W,F+=n*ie,B+=n*te,l+=n*ee,g+=n*se,y+=n*oe,E+=n*J,I+=n*ue,n=e[14],Q+=n*x,L+=n*m,k+=n*O,H+=n*Y,q+=n*$,v+=n*b,C+=n*j,R+=n*z,F+=n*W,B+=n*ie,l+=n*te,g+=n*ee,y+=n*se,E+=n*oe,I+=n*J,T+=n*ue,n=e[15],L+=n*x,k+=n*m,H+=n*O,q+=n*Y,v+=n*$,C+=n*b,R+=n*j,F+=n*z,B+=n*W,l+=n*ie,g+=n*te,y+=n*ee,E+=n*se,I+=n*oe,T+=n*J,M+=n*ue,s+=38*k,o+=38*H,u+=38*q,a+=38*v,c+=38*C,f+=38*R,d+=38*F,w+=38*B,A+=38*l,_+=38*g,N+=38*y,P+=38*E,V+=38*I,U+=38*T,Q+=38*M,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=u,t[3]=a,t[4]=c,t[5]=f,t[6]=d,t[7]=w,t[8]=A,t[9]=_,t[10]=N,t[11]=P,t[12]=V,t[13]=U,t[14]=Q,t[15]=L}function za(t,e){Nt(t,e,e)}function hR(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)za(r,r),n!==2&&n!==4&&Nt(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function bX(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)za(r,r),n!==1&&Nt(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function uI(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),u=Ae(),a=Ae(),c=Ae(),f=Ae();Qa(r,t[1],t[0]),Qa(f,e[1],e[0]),Nt(r,r,f),ja(n,t[0],t[1]),ja(f,e[0],e[1]),Nt(n,n,f),Nt(i,t[3],e[3]),Nt(i,i,vX),Nt(s,t[2],e[2]),ja(s,s,s),Qa(o,n,r),Qa(u,s,i),ja(a,s,i),ja(c,n,r),Nt(t[0],o,u),Nt(t[1],c,a),Nt(t[2],a,u),Nt(t[3],o,c)}function aR(t,e,r){for(let n=0;n<4;n++)cR(t[n],e[n],r)}function lI(t,e){let r=Ae(),n=Ae(),i=Ae();hR(i,e[2]),Nt(r,e[0],i),Nt(n,e[1],i),wh(t,n),t[31]^=fR(r)<<7}function dR(t,e,r){Ro(t[0],aI),Ro(t[1],Hc),Ro(t[2],Hc),Ro(t[3],aI);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;aR(t,e,i),uI(e,t),uI(t,t),aR(t,e,i)}}function fI(t,e){let r=[Ae(),Ae(),Ae(),Ae()];Ro(r[0],iR),Ro(r[1],sR),Ro(r[2],Hc),Nt(r[3],iR,sR),dR(t,r,e)}function gR(t){if(t.length!==Ge.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ge.SEED_LENGTH} bytes`);let e=(0,yh.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ae(),Ae(),Ae(),Ae()];fI(n,e),lI(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ge.generateKeyPairFromSeed=gR;function SX(t){let e=(0,mX.randomBytes)(32,t),r=gR(e);return(0,uR.wipe)(e),r}Ge.generateKeyPair=SX;function IX(t){if(t.length!==Ge.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ge.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ge.extractPublicKeyFromSecretKey=IX;var oI=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 pR(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*oI[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*oI[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function cI(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;pR(t,e)}function _X(t,e){let r=new Float64Array(64),n=[Ae(),Ae(),Ae(),Ae()],i=(0,yh.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new yh.SHA512;o.update(s.subarray(32)),o.update(e);let u=o.digest();o.clean(),cI(u),fI(n,u),lI(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let a=o.digest();cI(a);for(let c=0;c<32;c++)r[c]=u[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=a[c]*i[f];return pR(s.subarray(32),r),s}Ge.sign=_X;function mR(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),u=Ae(),a=Ae();return Ro(t[2],Hc),EX(t[1],e),za(i,t[1]),Nt(s,i,wX),Qa(i,i,t[2]),ja(s,t[2],s),za(o,s),za(u,o),Nt(a,u,o),Nt(r,a,i),Nt(r,r,s),bX(r,r),Nt(r,r,i),Nt(r,r,s),Nt(r,r,s),Nt(t[0],r,s),za(n,t[0]),Nt(n,n,s),oR(n,i)&&Nt(t[0],t[0],AX),za(n,t[0]),Nt(n,n,s),oR(n,i)?-1:(fR(t[0])===e[31]>>7&&Qa(t[0],aI,t[0]),Nt(t[3],t[0],t[1]),0)}function TX(t,e,r){let n=new Uint8Array(32),i=[Ae(),Ae(),Ae(),Ae()],s=[Ae(),Ae(),Ae(),Ae()];if(r.length!==Ge.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ge.SIGNATURE_LENGTH} bytes`);if(mR(s,t))return!1;let o=new yh.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let u=o.digest();return cI(u),dR(i,s,u),fI(s,r.subarray(32)),uI(i,s),lI(n,i),!lR(r,n)}Ge.verify=TX;function CX(t){let e=[Ae(),Ae(),Ae(),Ae()];if(mR(e,t))throw new Error("Ed25519: invalid public key");let r=Ae(),n=Ae(),i=e[1];ja(r,Hc,i),Qa(n,Hc,i),hR(n,n),Nt(r,r,n);let s=new Uint8Array(32);return wh(s,r),s}Ge.convertPublicKeyToX25519=CX;function NX(t){let e=(0,yh.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,uR.wipe)(e),r}Ge.convertSecretKeyToX25519=NX});var dm,gm,Ka,Gc,pm,vh,mm,ym,wm,jc,vm,Am,wR,vR,Em=de(()=>{h();dm="EdDSA",gm="JWT",Ka=".",Gc="base64url",pm="utf8",vh="utf8",mm=":",ym="did",wm="key",jc="base58btc",vm="z",Am="K36",wR=32,vR=32});function zc(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}var bm=de(()=>{h()});function Sm(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=zc(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var hI=de(()=>{h();bm()});function xX(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(Q);V!==U;){for(var k=_[V],H=0,q=Q-1;(k!==0||H>>0,L[q]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");P=H,V++}for(var v=Q-P;v!==Q&&L[v]===0;)v++;for(var C=a.repeat(N);v>>0,Q=new Uint8Array(U);_[N];){var L=r[_.charCodeAt(N)];if(L===255)return;for(var k=0,H=U-1;(L!==0||k>>0,Q[H]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");V=k,N++}if(_[N]!==" "){for(var q=U-V;q!==U&&Q[q]===0;)q++;for(var v=new Uint8Array(P+(U-q)),C=P;q!==U;)v[C++]=Q[q++];return v}}}function A(_){var N=w(_);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:w,decode:A}}var OX,DX,AR,ER=de(()=>{h();OX=xX,DX=OX,AR=DX});var PEe,bR,qs,SR,IR,Bo=de(()=>{h();PEe=new Uint8Array(0),bR=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},SR=t=>new TextEncoder().encode(t),IR=t=>new TextDecoder().decode(t)});var dI,gI,pI,TR,mI,Qc,Mo,PX,RX,jt,Ii=de(()=>{h();ER();Bo();dI=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},gI=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return TR(this,e)}},pI=class{constructor(e){this.decoders=e}or(e){return TR(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},TR=(t,e)=>new pI({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),mI=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new dI(e,r,n),this.decoder=new gI(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Qc=({name:t,prefix:e,encode:r,decode:n})=>new mI(t,e,r,n),Mo=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=AR(r,e);return Qc({prefix:t,name:e,encode:n,decode:s=>qs(i(s))})},PX=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(u-=8,o[c++]=255&a>>u)}if(u>=r||255&a<<8-u)throw new SyntaxError("Unexpected end of data");return o},RX=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&u>>o];if(o&&(s+=e[i&u<Qc({prefix:e,name:t,encode(i){return RX(i,n,r)},decode(i){return PX(i,n,r,t)}})});var yI={};Ot(yI,{identity:()=>BX});var BX,CR=de(()=>{h();Ii();Bo();BX=Qc({prefix:"\0",name:"identity",encode:t=>IR(t),decode:t=>SR(t)})});var wI={};Ot(wI,{base2:()=>MX});var MX,NR=de(()=>{h();Ii();MX=jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var vI={};Ot(vI,{base8:()=>LX});var LX,xR=de(()=>{h();Ii();LX=jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var AI={};Ot(AI,{base10:()=>FX});var FX,OR=de(()=>{h();Ii();FX=Mo({prefix:"9",name:"base10",alphabet:"0123456789"})});var EI={};Ot(EI,{base16:()=>UX,base16upper:()=>qX});var UX,qX,DR=de(()=>{h();Ii();UX=jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qX=jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var bI={};Ot(bI,{base32:()=>Kc,base32hex:()=>GX,base32hexpad:()=>zX,base32hexpadupper:()=>QX,base32hexupper:()=>jX,base32pad:()=>kX,base32padupper:()=>HX,base32upper:()=>VX,base32z:()=>KX});var Kc,VX,kX,HX,GX,jX,zX,QX,KX,SI=de(()=>{h();Ii();Kc=jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),VX=jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kX=jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),HX=jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),GX=jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jX=jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zX=jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),QX=jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),KX=jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var II={};Ot(II,{base36:()=>WX,base36upper:()=>$X});var WX,$X,PR=de(()=>{h();Ii();WX=Mo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$X=Mo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var _I={};Ot(_I,{base58btc:()=>rs,base58flickr:()=>YX});var rs,YX,TI=de(()=>{h();Ii();rs=Mo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),YX=Mo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var CI={};Ot(CI,{base64:()=>JX,base64pad:()=>XX,base64url:()=>ZX,base64urlpad:()=>eZ});var JX,XX,ZX,eZ,RR=de(()=>{h();Ii();JX=jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),XX=jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ZX=jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),eZ=jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var NI={};Ot(NI,{base256emoji:()=>sZ});function nZ(t){return t.reduce((e,r)=>(e+=tZ[r],e),"")}function iZ(t){let e=[];for(let r of t){let n=rZ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var BR,tZ,rZ,sZ,MR=de(()=>{h();Ii();BR=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}"),tZ=BR.reduce((t,e,r)=>(t[r]=e,t),[]),rZ=BR.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);sZ=Qc({prefix:"\u{1F680}",name:"base256emoji",encode:nZ,decode:iZ})});function UR(t,e,r){e=e||[],r=r||0;for(var n=r;t>=cZ;)e[r++]=t&255|LR,t/=128;for(;t&uZ;)e[r++]=t&255|LR,t>>>=7;return e[r]=t|0,UR.bytes=r-n+1,e}function xI(t,n){var r=0,n=n||0,i=0,s=n,o,u=t.length;do{if(s>=u)throw xI.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&FR)<=fZ);return xI.bytes=s-n,r}var oZ,LR,aZ,uZ,cZ,lZ,fZ,FR,hZ,dZ,gZ,pZ,mZ,yZ,wZ,vZ,AZ,EZ,bZ,SZ,Ah,qR=de(()=>{h();oZ=UR,LR=128,aZ=127,uZ=~aZ,cZ=Math.pow(2,31);lZ=xI,fZ=128,FR=127;hZ=Math.pow(2,7),dZ=Math.pow(2,14),gZ=Math.pow(2,21),pZ=Math.pow(2,28),mZ=Math.pow(2,35),yZ=Math.pow(2,42),wZ=Math.pow(2,49),vZ=Math.pow(2,56),AZ=Math.pow(2,63),EZ=function(t){return t{h();qR();Eh=(t,e=0)=>[Ah.decode(t,e),Ah.decode.bytes],Wc=(t,e,r=0)=>(Ah.encode(t,e,r),e),$c=t=>Ah.encodingLength(t)});var Wa,VR,kR,Yc,Sh=de(()=>{h();Bo();_m();Wa=(t,e)=>{let r=e.byteLength,n=$c(t),i=n+$c(r),s=new Uint8Array(i+r);return Wc(t,s,0),Wc(r,s,n),s.set(e,i),new Yc(t,r,e,s)},VR=t=>{let e=qs(t),[r,n]=Eh(e),[i,s]=Eh(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Yc(r,i,o,e)},kR=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&bR(t.bytes,e.bytes),Yc=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var DI,OI,PI=de(()=>{h();Sh();DI=({name:t,code:e,encode:r})=>new OI(t,e,r),OI=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Wa(this.code,r):r.then(n=>Wa(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var RI={};Ot(RI,{sha256:()=>IZ,sha512:()=>_Z});var GR,IZ,_Z,jR=de(()=>{h();PI();GR=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),IZ=DI({name:"sha2-256",code:18,encode:GR("SHA-256")}),_Z=DI({name:"sha2-512",code:19,encode:GR("SHA-512")})});var BI={};Ot(BI,{identity:()=>NZ});var zR,TZ,QR,CZ,NZ,KR=de(()=>{h();Bo();Sh();zR=0,TZ="identity",QR=qs,CZ=t=>Wa(zR,QR(t)),NZ={code:zR,name:TZ,encode:QR,digest:CZ}});var WR=de(()=>{h();Bo()});var wbe,vbe,$R=de(()=>{h();wbe=new TextEncoder,vbe=new TextDecoder});var Nm,DZ,PZ,RZ,Ih,BZ,YR,JR,Tm,Cm,MZ,LZ,FZ,XR=de(()=>{h();_m();Sh();TI();SI();Bo();Nm=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Cm,byteLength:Cm,code:Tm,version:Tm,multihash:Tm,bytes:Tm,_baseCache:Cm,asCID:Cm})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Ih)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==BZ)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Wa(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&kR(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return PZ(r,i,e||rs.encoder);default:return RZ(r,i,e||Kc.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 LZ(/^0\.0/,FZ),!!(e&&(e[JR]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||YR(r,n,i.bytes))}else if(e!=null&&e[JR]===!0){let{version:r,multihash:n,code:i}=e,s=VR(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==Ih)throw new Error(`Version 0 CID must use dag-pb (code: ${Ih}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=YR(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Ih,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=qs(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Yc(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,w]=Eh(e.subarray(r));return r+=w,d},i=n(),s=Ih;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,u=n(),a=n(),c=r+a,f=c-o;return{version:i,codec:s,multihashCode:u,digestSize:a,multihashSize:f,size:c}}static parse(e,r){let[n,i]=DZ(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},DZ=(t,e)=>{switch(t[0]){case"Q":{let r=e||rs;return[rs.prefix,r.decode(`${rs.prefix}${t}`)]}case rs.prefix:{let r=e||rs;return[rs.prefix,r.decode(t)]}case Kc.prefix:{let r=e||Kc;return[Kc.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},PZ=(t,e,r)=>{let{prefix:n}=r;if(n!==rs.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},RZ=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},Ih=112,BZ=18,YR=(t,e,r)=>{let n=$c(t),i=n+$c(e),s=new Uint8Array(i+r.byteLength);return Wc(t,s,0),Wc(e,s,n),s.set(r,i),s},JR=Symbol.for("@ipld/js-cid/CID"),Tm={writable:!1,configurable:!1,enumerable:!0},Cm={writable:!1,enumerable:!1,configurable:!1},MZ="0.0.0-dev",LZ=(t,e)=>{if(t.test(MZ))console.warn(e);else throw new Error(e)},FZ=`CID.isCID(v) is deprecated and will be removed in the next major release. +Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.bigIntToHex(e.numDecimals),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.utf8ToHex(e.tokenType),ce.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user),...e.addRoleLocalMint?[ce.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ce.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user),...e.addRoleNFTCreate?[ce.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ce.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ce.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ce.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user),...e.addRoleNFTCreate?[ce.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ce.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ce.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ce.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ce.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.initialQuantity),ce.utf8ToHex(e.name),ce.bigIntToHex(e.royalties),ce.utf8ToHex(e.hash),ce.bufferToHex(e.attributes),...e.uris.map(ce.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.tokenNonce),ce.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.tokenNonce),ce.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.tokenNonce),ce.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:c,dataParts:a}){let u=this.buildTransactionPayload(a),f=o||this.computeGasLimit(u,c),p=new _M.TransactionVersion(S_.TRANSACTION_VERSION_DEFAULT),S=new _M.TransactionOptions(S_.TRANSACTION_OPTIONS_DEFAULT);return new cre.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:u,version:p,options:S})}buildTransactionPayload(e){let r=e.join(S_.ARGUMENTS_SEPARATOR);return new ure.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};F1.TokenOperationsFactory=__});var IM=L(q1=>{"use strict";h();Object.defineProperty(q1,"__esModule",{value:!0});q1.TokenOperationsFactoryConfig=void 0;var lre=Nt(),T_=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=lre.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};q1.TokenOperationsFactoryConfig=T_});var xM=L(U1=>{"use strict";h();Object.defineProperty(U1,"__esModule",{value:!0});U1.TokenOperationsOutcomeParser=void 0;var fre=Nt(),I_=Ve(),CM=Yp(),C_=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=r.topics[3]?.valueOf();return{tokenIdentifier:n,nonce:i,attributes:s}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){for(let r of e.logs.events)if(r.identifier=="signalError"){let n=b.Buffer.from(r.data.substring(1),"hex").toString(),i=r.topics[1]?.valueOf().toString();throw new I_.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${i} (${n})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new I_.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new I_.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){return e.topics[0]?.valueOf().toString()}extractNonce(e){return CM.bufferToBigInt(e.topics[1]?.valueOf()).toFixed(0)}extractAmount(e){return CM.bufferToBigInt(e.topics[2]?.valueOf()).toFixed(0)}extractAddress(e){return fre.Address.fromBuffer(e.topics[3]?.valueOf()).toString()}};U1.TokenOperationsOutcomeParser=C_});var N_=L(Oo=>{"use strict";h();var dre=Oo&&Oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x_=Oo&&Oo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dre(e,t,r)};Object.defineProperty(Oo,"__esModule",{value:!0});x_(TM(),Oo);x_(IM(),Oo);x_(xM(),Oo)});var NM=L(k1=>{"use strict";h();Object.defineProperty(k1,"__esModule",{value:!0});k1.DelegationTransactionsOutcomeParser=void 0;var hre=Nt(),pre=Vh(),gre=Ve(),mre=Ll(),O_=class{constructor(){}parseCreateNewDelegationContract(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),mre.findEventsByIdentifier(e,"SCDeploy").map(n=>({contractAddress:this.extractContractAddress(n)}))}ensureTransactionOutcome(e){return"hash"in e?new pre.TransactionsConverter().transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=b.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new gre.ErrParseTransactionOutcome(`encountered signalError: ${i} (${b.Buffer.from(n,"hex").toString()})`)}}extractContractAddress(e){if(!e.topics[0]?.length)return"";let r=b.Buffer.from(e.topics[0]);return hre.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return b.Buffer.from(e).toString()}};k1.DelegationTransactionsOutcomeParser=O_});var RM=L(V1=>{"use strict";h();Object.defineProperty(V1,"__esModule",{value:!0});V1.SmartContractTransactionsOutcomeParser=void 0;var OM=Nt(),yre=xr(),PM=Ve(),kl=yi(),Qh=Ll(),Vl;(function(t){t.SCDeploy="SCDeploy",t.SignalError="signalError",t.WriteLog="writeLog"})(Vl||(Vl={}));var P_=class{constructor(e){this.abi=e?.abi,this.legacyResultsParser=e?.legacyResultsParser||new kl.ResultsParser}parseDeploy(e){return"transactionOutcome"in e?this.parseDeployGivenTransactionOutcome(e.transactionOutcome):this.parseDeployGivenTransactionOnNetwork(e.transactionOnNetwork)}parseDeployGivenTransactionOutcome(e){let r=e.directSmartContractCallOutcome,i=Qh.findEventsByIdentifier(e,Vl.SCDeploy).map(s=>this.parseScDeployEvent(s));return{returnCode:r.returnCode,returnMessage:r.returnMessage,contracts:i}}parseDeployGivenTransactionOnNetwork(e){let r=this.findDirectSmartContractCallOutcome(e),i=e.logs.events.concat(e.contractResults.items.flatMap(s=>s.logs.events)).filter(s=>s.identifier===Vl.SCDeploy).map(s=>this.parseScDeployEvent({topics:s.topics.map(o=>b.Buffer.from(o.hex(),"hex"))}));return{returnCode:r.returnCode,returnMessage:r.returnMessage,contracts:i}}parseScDeployEvent(e){let r=e.topics[0],n=e.topics[1],i=e.topics[2],s=r?.length?new OM.Address(r).toBech32():"",o=n?.length?new OM.Address(n).toBech32():"";return{address:s,ownerAddress:o,codeHash:i}}parseExecute(e){return"transactionOutcome"in e?this.parseExecuteGivenTransactionOutcome(e.transactionOutcome,e.function):this.parseExecuteGivenTransactionOnNetwork(e.transactionOnNetwork,e.function)}parseExecuteGivenTransactionOutcome(e,r){let n=e.directSmartContractCallOutcome;if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(r=r||n.function,!r)throw new PM.Err('Function name is not available in the transaction outcome, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');let i=this.abi.getEndpoint(r),s={returnCode:new kl.ReturnCode(n.returnCode),returnMessage:n.returnMessage,values:n.returnDataParts.map(c=>b.Buffer.from(c))},o=this.legacyResultsParser.parseOutcomeFromUntypedBundle(s,i);return{values:o.values.map(c=>c.valueOf()),returnCode:o.returnCode.toString(),returnMessage:o.returnMessage}}parseExecuteGivenTransactionOnNetwork(e,r){let n=this.findDirectSmartContractCallOutcome(e);if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(r=r||n.function,!r)throw new PM.Err('Function name is not available in the transaction, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');let i=new kl.ArgSerializer,s=this.abi.getEndpoint(r),o=n.returnDataParts.map(a=>b.Buffer.from(a)),c=i.buffersToValues(o,s.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:c}}findDirectSmartContractCallOutcome(e){let r=this.findDirectSmartContractCallOutcomeWithinSmartContractResults(e);return r||(r=this.findDirectSmartContractCallOutcomeIfError(e),r)||(r=this.findDirectSmartContractCallOutcomeWithinWriteLogEvents(e),r)?r:new Qh.SmartContractCallOutcome({function:e.function,returnCode:"",returnMessage:"",returnDataParts:[]})}findDirectSmartContractCallOutcomeWithinSmartContractResults(e){let r=new kl.ArgSerializer,n=[];for(let a of e.contractResults.items){let u=a.data.startsWith(yre.ARGUMENTS_SEPARATOR),f=a.receiver.bech32()===e.sender.bech32(),p=a.previousHash===e.hash;u&&f&&p&&n.push(a)}if(n.length===0)return null;if(n.length>1)throw new Error(`More than one smart contract result (holding the return data) found for transaction: ${e.hash}`);let[i]=n,[s,o,...c]=r.stringToBuffers(i.data);return new Qh.SmartContractCallOutcome({function:e.function,returnCode:o?.toString(),returnMessage:i.returnMessage||o?.toString(),returnDataParts:c})}findDirectSmartContractCallOutcomeIfError(e){let r=new kl.ArgSerializer,n=Vl.SignalError,i=[];i.push(...e.logs.events.filter(f=>f.identifier===n));for(let f of e.contractResults.items)f.previousHash==e.hash&&i.push(...f.logs.events.filter(p=>p.identifier===n));if(i.length===0)return null;if(i.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);let[s]=i,o=s.dataPayload?.valueOf().toString()||"",c=s.getLastTopic()?.toString(),a=r.stringToBuffers(o),u=a[a.length-1];return new Qh.SmartContractCallOutcome({function:e.function,returnCode:u?.toString()||n,returnMessage:c||u?.toString()||n,returnDataParts:[]})}findDirectSmartContractCallOutcomeWithinWriteLogEvents(e){let r=new kl.ArgSerializer,n=Vl.WriteLog,i=[];i.push(...e.logs.events.filter(f=>f.identifier===n));for(let f of e.contractResults.items)f.previousHash==e.hash&&i.push(...f.logs.events.filter(p=>p.identifier===n));if(i.length===0)return null;if(i.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);let[s]=i,o=s.dataPayload?.valueOf().toString()||"",[c,a,...u]=r.stringToBuffers(o);return new Qh.SmartContractCallOutcome({function:e.function,returnCode:a?.toString(),returnMessage:a?.toString(),returnDataParts:u})}};V1.SmartContractTransactionsOutcomeParser=P_});var BM=L(H1=>{"use strict";h();Object.defineProperty(H1,"__esModule",{value:!0});H1.TokenManagementTransactionsOutcomeParser=void 0;var vre=Nt(),bre=Vh(),MM=Ve(),DM=na(),kr=Ll(),R_=class{constructor(){}parseIssueFungible(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"issue").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueNonFungible(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"issueNonFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueSemiFungible(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"issueSemiFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterMetaEsdt(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"registerMetaESDT").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterAndSetAllRoles(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);let r=kr.findEventsByIdentifier(e,"registerAndSetAllRoles"),n=kr.findEventsByIdentifier(e,"ESDTSetRole");if(r.length!==n.length)throw new MM.ErrParseTransactionOutcome("Register Events and Set Role events mismatch. Should have the same number of events.");return r.map((i,s)=>{let o=this.extractTokenIdentifier(i),a=n[s].topics.slice(3).map(u=>this.decodeTopicAsString(u));return{tokenIdentifier:o,roles:a}})}parseSetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseUnsetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseSetSpecialRole(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTSetRole").map(n=>this.getOutputForSetSpecialRoleEvent(n))}getOutputForSetSpecialRoleEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),s=e.topics.slice(3).map(o=>this.decodeTopicAsString(o));return{userAddress:r,tokenIdentifier:n,roles:s}}parseNftCreate(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTCreate").map(n=>this.getOutputForNftCreateEvent(n))}getOutputForNftCreateEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,initialQuantity:i}}parseLocalMint(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTLocalMint").map(n=>this.getOutputForLocalMintEvent(n))}getOutputForLocalMintEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,mintedSupply:s}}parseLocalBurn(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTLocalBurn").map(n=>this.getOutputForLocalBurnEvent(n))}getOutputForLocalBurnEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,burntSupply:s}}parsePause(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseUnpause(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTUnPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseFreeze(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTFreeze").map(n=>this.getOutputForFreezeEvent(n))}getOutputForFreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTUnFreeze").map(n=>this.getOutputForUnfreezeEvent(n))}getOutputForUnfreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTWipe").map(n=>this.getOutputForWipeEvent(n))}getOutputForWipeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTUpdateAttributes").map(n=>this.getOutputForUpdateAttributesEvent(n))}getOutputForUpdateAttributesEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=e.topics[3]?e.topics[3]:new Uint8Array;return{tokenIdentifier:r,nonce:n,attributes:i}}parseAddQuantity(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTAddQuantity").map(n=>this.getOutputForAddQuantityEvent(n))}getOutputForAddQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,addedQuantity:i}}parseBurnQuantity(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTBurn").map(n=>this.getOutputForBurnQuantityEvent(n))}getOutputForBurnQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,burntQuantity:i}}ensureTransactionOutcome(e){return"hash"in e?new bre.TransactionsConverter().transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=b.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new MM.ErrParseTransactionOutcome(`encountered signalError: ${i} (${b.Buffer.from(n,"hex").toString()})`)}}extractTokenIdentifier(e){return e.topics[0]?.length?this.decodeTopicAsString(e.topics[0]):""}extractNonce(e){if(!e.topics[1]?.length)return BigInt(0);let r=b.Buffer.from(e.topics[1]);return BigInt(DM.bufferToBigInt(r).toFixed(0))}extractAmount(e){if(!e.topics[2]?.length)return BigInt(0);let r=b.Buffer.from(e.topics[2]);return BigInt(DM.bufferToBigInt(r).toFixed(0))}extractAddress(e){if(!e.topics[3]?.length)return"";let r=b.Buffer.from(e.topics[3]);return vre.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return b.Buffer.from(e).toString()}};H1.TokenManagementTransactionsOutcomeParser=R_});var LM=L(G1=>{"use strict";h();Object.defineProperty(G1,"__esModule",{value:!0});G1.TransactionEventsParser=void 0;var wre=yi(),M_=class{constructor(e){this.legacyResultsParser=new wre.ResultsParser,this.abi=e.abi,this.firstTopicIsIdentifier=e.firstTopicIsIdentifier??!0}parseEvents(e){let r=[];for(let n of e.events){let i=this.parseEvent({event:n});r.push(i)}return r}parseEvent(e){let r=e.event.topics.map(c=>b.Buffer.from(c)),n=this.firstTopicIsIdentifier?r[0]?.toString():e.event.identifier;this.firstTopicIsIdentifier&&r.shift();let i=e.event.dataItems.map(c=>b.Buffer.from(c)),s=this.abi.getEvent(n);return this.legacyResultsParser.doParseEvent({topics:r,dataItems:i,eventDefinition:s})}};G1.TransactionEventsParser=M_});var D_=L(es=>{"use strict";h();var Are=es&&es.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kh=es&&es.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Are(e,t,r)};Object.defineProperty(es,"__esModule",{value:!0});Kh(NM(),es);Kh(Ll(),es);Kh(RM(),es);Kh(BM(),es);Kh(LM(),es)});var Hl=L(z1=>{"use strict";h();Object.defineProperty(z1,"__esModule",{value:!0});z1.Account=void 0;var Ere=Nt(),B_=class{constructor(e){this.address=Ere.Address.empty(),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()}}};z1.Account=B_});var Q1=L(Gl=>{"use strict";h();Object.defineProperty(Gl,"__esModule",{value:!0});Gl.MessageComputer=Gl.Message=void 0;var Wh=xr(),Sre=Nt(),_re=Yd(),j1=class{constructor(e){this.data=e.data,this.signature=e.signature,this.address=e.address,this.version=e.version||Wh.DEFAULT_MESSAGE_VERSION,this.signer=e.signer||Wh.SDK_JS_SIGNER}};Gl.Message=j1;var L_=class{constructor(){}computeBytesForSigning(e){let r=b.Buffer.from(e.data.length.toString()),n=b.Buffer.concat([r,e.data]),i=b.Buffer.concat([b.Buffer.from(Wh.MESSAGE_PREFIX),n]);return _re("keccak256").update(i).digest()}computeBytesForVerifying(e){return this.computeBytesForSigning(e)}packMessage(e){return{message:b.Buffer.from(e.data).toString("hex"),signature:e.signature?b.Buffer.from(e.signature).toString("hex"):"",address:e.address?e.address.bech32():"",version:e.version,signer:e.signer}}unpackMessage(e){let r=this.trimHexPrefix(e.message),n=b.Buffer.from(r,"hex"),i=this.trimHexPrefix(e.signature||""),s=b.Buffer.from(i,"hex"),o;e.address&&(o=Sre.Address.fromBech32(e.address));let c=e.version||Wh.DEFAULT_MESSAGE_VERSION,a=e.signer||Wh.UNKNOWN_SIGNER;return new j1({data:n,signature:s,address:o,version:c,signer:a})}trimHexPrefix(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}};Gl.MessageComputer=L_});var U_=L(Fs=>{"use strict";h();var Tre=Fs&&Fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ire=Fs&&Fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cre=Fs&&Fs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tre(e,t,r);return Ire(e,t),e};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.AsyncTimer=void 0;var xre=Cre(Ve()),Nre=Ve(),F_=ra(),q_=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new xre.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,F_.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){F_.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new Nre.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(F_.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};Fs.AsyncTimer=q_});var W1=L(K1=>{"use strict";h();Object.defineProperty(K1,"__esModule",{value:!0});K1.TransactionWatcher=void 0;var k_=U_(),FM=xr(),Po=Ve(),qM=ra(),Ta=class t{constructor(e,r={}){this.fetcher=new V_(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}async awaitPending(e){let r=s=>s.status.isPending(),n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Po.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitCompleted(e){let r=s=>{if(s.isCompleted===void 0)throw new Po.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Po.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitAllEvents(e,r){let n=o=>{let c=this.getAllTransactionEvents(o).map(u=>u.identifier);return r.every(u=>c.includes(u))},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Po.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitAnyEvent(e,r){let n=o=>{let c=this.getAllTransactionEvents(o).map(u=>u.identifier);return r.find(u=>c.includes(u))!=null},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Po.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitOnCondition(e,r){let n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Po.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}transactionOrTxHashToTxHash(e){let r=typeof e=="string"?e:e.getHash().hex();if(r.length!==FM.HEX_TRANSACTION_HASH_LENGTH)throw new Po.Err(`Invalid transaction hash length. The length of a hex encoded hash should be ${FM.HEX_TRANSACTION_HASH_LENGTH}.`);return r}async awaitConditionally(e,r,n){let i=new k_.AsyncTimer("watcher:periodic"),s=new k_.AsyncTimer("watcher:patience"),o=new k_.AsyncTimer("watcher:timeout"),c=!1,a,u=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),c=!0});!c;){await i.start(this.pollingIntervalMilliseconds);try{if(a=await r(),u=e(a),u||c)break}catch(f){if(qM.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Po.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Po.Err))throw f}}if(u&&await s.start(this.patienceMilliseconds),o.isStopped()||o.stop(),!a||!u)throw n();return a}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};K1.TransactionWatcher=Ta;Ta.DefaultPollingInterval=6e3;Ta.DefaultTimeout=Ta.DefaultPollingInterval*15;Ta.DefaultPatience=0;Ta.NoopOnStatusReceived=t=>{};var V_=class{constructor(e){this.fetcher=e}async getTransaction(e){return qM.Logger.debug(`transactionWatcher, getTransaction(${e})`),await this.fetcher.getTransaction(e)}}});var Ti=L(Vr=>{"use strict";h();var Ore=Vr&&Vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pre=Vr&&Vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rre=Vr&&Vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ore(e,t,r);return Pre(e,t),e};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.zeroPadStringIfOddLength=Vr.isPaddedHex=Vr.numberToPaddedHex=Vr.Nonce=Vr.Address=void 0;var UM=Rre(g2()),Mre="erd",H_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=UM.toWords(e),n=UM.encode(Mre,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vr.Address=H_;var G_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return kM(this.value)}};Vr.Nonce=G_;function kM(t){let e=t.toString(16);return VM(e)}Vr.numberToPaddedHex=kM;function Dre(t){t=t||"";let e=b.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vr.isPaddedHex=Dre;function VM(t){return t=t||"",t.length%2==1?"0"+t:t}Vr.zeroPadStringIfOddLength=VM});var $h=L(Ii=>{"use strict";h();var Bre=Ii&&Ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.UnknownClientName=Ii.BaseUserAgent=Ii.EsdtContractAddress=Ii.MaxUint64AsBigNumber=void 0;var Lre=Bre((qt(),qe(jt))),Fre=Ti();Ii.MaxUint64AsBigNumber=new Lre.default("18446744073709551615");Ii.EsdtContractAddress=new Fre.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u");Ii.BaseUserAgent="multiversx-sdk";Ii.UnknownClientName="unknown"});var jl=L(zl=>{"use strict";h();var qre=zl&&zl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zl,"__esModule",{value:!0});zl.ContractQueryResponse=void 0;var Ure=qre((qt(),qe(jt))),kre=$h(),z_=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new Ure.default(e.gasRemaining||e.GasRemaining||0),o=kre.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>b.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};zl.ContractQueryResponse=z_});var HM=L(()=>{"use strict";h();global.Buffer||(global.Buffer=wo().Buffer)});var K_=L(Ql=>{"use strict";h();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.SmartContractQueryResponse=Ql.SmartContractQuery=void 0;var j_=class{constructor(e){this.contract=e.contract,this.caller=e.caller,this.value=e.value,this.function=e.function,this.arguments=e.arguments}};Ql.SmartContractQuery=j_;var Q_=class{constructor(e){this.function=e.function,this.returnCode=e.returnCode,this.returnMessage=e.returnMessage,this.returnDataParts=e.returnDataParts}};Ql.SmartContractQueryResponse=Q_});var zM=L($1=>{"use strict";h();Object.defineProperty($1,"__esModule",{value:!0});$1.QueryRunnerAdapter=void 0;var GM=Nt(),Vre=K_(),W_=class{constructor(e){this.networkProvider=e.networkProvider}async runQuery(e){let r={address:GM.Address.fromBech32(e.contract),caller:e.caller?GM.Address.fromBech32(e.caller):void 0,func:e.function,value:e.value,getEncodedArguments:()=>e.arguments.map(i=>b.Buffer.from(i).toString("hex"))},n=await this.networkProvider.queryContract(r);return new Vre.SmartContractQueryResponse({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.getReturnDataParts()})}};$1.QueryRunnerAdapter=W_});var jM=L(zc=>{"use strict";h();var Hre=zc&&zc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gre=zc&&zc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hre(e,t,r)};Object.defineProperty(zc,"__esModule",{value:!0});Gre(zM(),zc)});var QM=L(jc=>{"use strict";h();var zre=jc&&jc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jre=jc&&jc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zre(e,t,r)};Object.defineProperty(jc,"__esModule",{value:!0});jre(Vh(),jc)});var WM=L(Qc=>{"use strict";h();Object.defineProperty(Qc,"__esModule",{value:!0});Qc.GasEstimator=Qc.DefaultGasConfiguration=void 0;Qc.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Qre=1e5,KM=8e5,$_=class{constructor(e){this.gasConfiguration=e||Qc.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Qre}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+KM}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+KM)*r+this.gasConfiguration.gasPerDataByte*e}};Qc.GasEstimator=$_});var YM=L($M=>{"use strict";h();Object.defineProperty($M,"__esModule",{value:!0})});var XM=L(JM=>{"use strict";h();Object.defineProperty(JM,"__esModule",{value:!0})});var ZM=L(Y1=>{"use strict";h();Object.defineProperty(Y1,"__esModule",{value:!0});Y1.RelayedTransactionV1Builder=void 0;var Y_=Nt(),Kre=Ve(),Wre=Dn(),$re=No(),Yre=s1(),J_=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new Kre.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${b.Buffer.from(e).toString("hex")}`,n=new $re.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new Wre.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new Y_.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Y_.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:BigInt(this.innerTransaction.getValue().toString()),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:b.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new Y_.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?b.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?b.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return Yre.stringify(e)}};Y1.RelayedTransactionV1Builder=J_});var t7=L(J1=>{"use strict";h();Object.defineProperty(J1,"__esModule",{value:!0});J1.RelayedTransactionV2Builder=void 0;var e7=Ve(),Yh=yi(),Jre=Dn(),Xre=No(),X_=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new e7.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new e7.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Yh.ArgSerializer().valuesToString([new Yh.AddressValue(this.innerTransaction.getReceiver()),new Yh.U64Value(this.innerTransaction.getNonce().valueOf()),new Yh.BytesValue(this.innerTransaction.getData().valueOf()),new Yh.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new Xre.TransactionPayload(r),i=new Jre.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID,version:this.innerTransaction.getVersion(),options:this.innerTransaction.getOptions()});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};J1.RelayedTransactionV2Builder=X_});var r7=L(X1=>{"use strict";h();Object.defineProperty(X1,"__esModule",{value:!0});X1.SignableMessage=void 0;var Zre=Nt(),ene=N1(),tne=xr(),rne=Yd(),Z_=class{constructor(e){this.message=b.Buffer.from([]),this.signature=b.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=Zre.Address.empty(),Object.assign(this,e)}serializeForSigning(){let e=b.Buffer.from(this.message.length.toString()),r=b.Buffer.concat([e,this.message]),n=b.Buffer.concat([b.Buffer.from(tne.MESSAGE_PREFIX),r]);return rne("keccak256").update(n).digest()}serializeForSigningRaw(){return b.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=ene.interpretSignatureAsBuffer(e)}getMessageSize(){let e=b.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};X1.SignableMessage=Z_});var i7=L(ey=>{"use strict";h();Object.defineProperty(ey,"__esModule",{value:!0});ey.SmartContractQueriesController=void 0;var n7=Ve(),nne=K_(),Z1=yi(),ine=dr(),e3=class{constructor(e){this.abi=e.abi,this.queryRunner=e.queryRunner,this.legacyResultsParser=new Z1.ResultsParser}async query(e){let r=this.createQuery(e),n=await this.runQuery(r);return this.raiseForStatus(n),this.parseQueryResponse(n)}raiseForStatus(e){if(!(e.returnCode==="ok"))throw new n7.ErrSmartContractQuery(e.returnCode,e.returnMessage)}createQuery(e){let r=this.encodeArguments(e.function,e.arguments);return new nne.SmartContractQuery({contract:e.contract,caller:e.caller,function:e.function,arguments:r,value:e.value})}encodeArguments(e,r){let n=this.abi?.getEndpoint(e);if(n){let i=Z1.NativeSerializer.nativeToTypedValues(r,n);return new Z1.ArgSerializer().valuesToBuffers(i)}if(this.areArgsOfTypedValue(r))return new Z1.ArgSerializer().valuesToBuffers(r);if(this.areArgsBuffers(r))return r.map(i=>b.Buffer.from(i));throw new n7.Err("cannot encode arguments: when ABI is not available, they must be either typed values or buffers")}areArgsOfTypedValue(e){return e.every(r=>ine.isTyped(r))}areArgsBuffers(e){for(let r of e)if(!ArrayBuffer.isView(r))return!1;return!0}async runQuery(e){return await this.queryRunner.runQuery(e)}parseQueryResponse(e){if(!this.abi)return e.returnDataParts;let r={returnCode:e.returnCode,returnMessage:e.returnMessage,getReturnDataParts:()=>e.returnDataParts.map(c=>b.Buffer.from(c))},n=e.function,i=this.abi.getEndpoint(n);return this.legacyResultsParser.parseQueryResponse(r,i).values.map(c=>c.valueOf())}};ey.SmartContractQueriesController=e3});var e0=L((S8e,G7)=>{"use strict";h();function b7(t,e){return function(){return t.apply(e,arguments)}}var{toString:sne}=Object.prototype,{getPrototypeOf:p3}=Object,oy=(t=>e=>{let r=sne.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),rs=t=>(t=t.toLowerCase(),e=>oy(e)===t),ay=t=>e=>typeof e===t,{isArray:$l}=Array,Xh=ay("undefined");function one(t){return t!==null&&!Xh(t)&&t.constructor!==null&&!Xh(t.constructor)&&Yn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var w7=rs("ArrayBuffer");function ane(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&w7(t.buffer),e}var cne=ay("string"),Yn=ay("function"),A7=ay("number"),cy=t=>t!==null&&typeof t=="object",une=t=>t===!0||t===!1,ty=t=>{if(oy(t)!=="object")return!1;let e=p3(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},lne=rs("Date"),fne=rs("File"),dne=rs("Blob"),hne=rs("FileList"),pne=t=>cy(t)&&Yn(t.pipe),gne=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Yn(t.append)&&((e=oy(t))==="formdata"||e==="object"&&Yn(t.toString)&&t.toString()==="[object FormData]"))},mne=rs("URLSearchParams"),[yne,vne,bne,wne]=["ReadableStream","Request","Response","Headers"].map(rs),Ane=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Zh(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),$l(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var Kc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S7=t=>!Xh(t)&&t!==Kc;function s3(){let{caseless:t}=S7(this)&&this||{},e={},r=(n,i)=>{let s=t&&E7(e,i)||i;ty(e[s])&&ty(n)?e[s]=s3(e[s],n):ty(n)?e[s]=s3({},n):$l(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(Zh(e,(i,s)=>{r&&Yn(i)?t[s]=b7(i,r):t[s]=i},{allOwnKeys:n}),t),Sne=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),_ne=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Tne=(t,e,r,n)=>{let i,s,o,c={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!c[o]&&(e[o]=t[o],c[o]=!0);t=r!==!1&&p3(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Ine=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},Cne=t=>{if(!t)return null;if($l(t))return t;let e=t.length;if(!A7(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},xne=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&p3(Uint8Array)),Nne=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},One=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Pne=rs("HTMLFormElement"),Rne=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),s7=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Mne=rs("RegExp"),_7=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};Zh(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},Dne=t=>{_7(t,(e,r)=>{if(Yn(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(Yn(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Bne=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return $l(t)?n(t):n(String(t).split(e)),r},Lne=()=>{},Fne=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,t3="abcdefghijklmnopqrstuvwxyz",o7="0123456789",T7={DIGIT:o7,ALPHA:t3,ALPHA_DIGIT:t3+t3.toUpperCase()+o7},qne=(t=16,e=T7.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function Une(t){return!!(t&&Yn(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var kne=t=>{let e=new Array(10),r=(n,i)=>{if(cy(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=$l(n)?[]:{};return Zh(n,(o,c)=>{let a=r(o,i+1);!Xh(a)&&(s[c]=a)}),e[i]=void 0,s}}return n};return r(t,0)},Vne=rs("AsyncFunction"),Hne=t=>t&&(cy(t)||Yn(t))&&Yn(t.then)&&Yn(t.catch),I7=((t,e)=>t?setImmediate:e?((r,n)=>(Kc.addEventListener("message",({source:i,data:s})=>{i===Kc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Kc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Yn(Kc.postMessage)),Gne=typeof queueMicrotask<"u"?queueMicrotask.bind(Kc):typeof O.default<"u"&&O.default.nextTick||I7,te={isArray:$l,isArrayBuffer:w7,isBuffer:one,isFormData:gne,isArrayBufferView:ane,isString:cne,isNumber:A7,isBoolean:une,isObject:cy,isPlainObject:ty,isReadableStream:yne,isRequest:vne,isResponse:bne,isHeaders:wne,isUndefined:Xh,isDate:lne,isFile:fne,isBlob:dne,isRegExp:Mne,isFunction:Yn,isStream:pne,isURLSearchParams:mne,isTypedArray:xne,isFileList:hne,forEach:Zh,merge:s3,extend:Ene,trim:Ane,stripBOM:Sne,inherits:_ne,toFlatObject:Tne,kindOf:oy,kindOfTest:rs,endsWith:Ine,toArray:Cne,forEachEntry:Nne,matchAll:One,isHTMLForm:Pne,hasOwnProperty:s7,hasOwnProp:s7,reduceDescriptors:_7,freezeMethods:Dne,toObjectSet:Bne,toCamelCase:Rne,noop:Lne,toFiniteNumber:Fne,findKey:E7,global:Kc,isContextDefined:S7,ALPHABET:T7,generateString:qne,isSpecCompliantForm:Une,toJSONObject:kne,isAsyncFn:Vne,isThenable:Hne,setImmediate:I7,asap:Gne};function je(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}te.inherits(je,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:te.toJSONObject(this.config),code:this.code,status:this.status}}});var C7=je.prototype,x7={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{x7[t]={value:t}});Object.defineProperties(je,x7);Object.defineProperty(C7,"isAxiosError",{value:!0});je.from=(t,e,r,n,i,s)=>{let o=Object.create(C7);return te.toFlatObject(t,o,function(a){return a!==Error.prototype},c=>c!=="isAxiosError"),je.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var zne=null;function o3(t){return te.isPlainObject(t)||te.isArray(t)}function N7(t){return te.endsWith(t,"[]")?t.slice(0,-2):t}function a7(t,e,r){return t?t.concat(e).map(function(i,s){return i=N7(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function jne(t){return te.isArray(t)&&!t.some(o3)}var Qne=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});function uy(t,e,r){if(!te.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=te.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(R,D){return!te.isUndefined(D[R])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,a=(r.Blob||typeof Blob<"u"&&Blob)&&te.isSpecCompliantForm(e);if(!te.isFunction(i))throw new TypeError("visitor must be a function");function u(N){if(N===null)return"";if(te.isDate(N))return N.toISOString();if(!a&&te.isBlob(N))throw new je("Blob is not supported. Use a Buffer instead.");return te.isArrayBuffer(N)||te.isTypedArray(N)?a&&typeof Blob=="function"?new Blob([N]):b.Buffer.from(N):N}function f(N,R,D){let U=N;if(N&&!D&&typeof N=="object"){if(te.endsWith(R,"{}"))R=n?R:R.slice(0,-2),N=JSON.stringify(N);else if(te.isArray(N)&&jne(N)||(te.isFileList(N)||te.endsWith(R,"[]"))&&(U=te.toArray(N)))return R=N7(R),U.forEach(function(z,H){!(te.isUndefined(z)||z===null)&&e.append(o===!0?a7([R],H,s):o===null?R:R+"[]",u(z))}),!1}return o3(N)?!0:(e.append(a7(D,R,s),u(N)),!1)}let p=[],S=Object.assign(Qne,{defaultVisitor:f,convertValue:u,isVisitable:o3});function I(N,R){if(!te.isUndefined(N)){if(p.indexOf(N)!==-1)throw Error("Circular reference detected in "+R.join("."));p.push(N),te.forEach(N,function(U,k){(!(te.isUndefined(U)||U===null)&&i.call(e,U,te.isString(k)?k.trim():k,R,S))===!0&&I(U,R?R.concat(k):[k])}),p.pop()}}if(!te.isObject(t))throw new TypeError("data must be an object");return I(t),e}function c7(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function g3(t,e){this._pairs=[],t&&uy(t,this,e)}var O7=g3.prototype;O7.append=function(e,r){this._pairs.push([e,r])};O7.toString=function(e){let r=e?function(n){return e.call(this,n,c7)}:c7;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Kne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function P7(t,e,r){if(!e)return t;let n=r&&r.encode||Kne,i=r&&r.serialize,s;if(i?s=i(e,r):s=te.isURLSearchParams(e)?e.toString():new g3(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var a3=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){te.forEach(this.handlers,function(n){n!==null&&e(n)})}},u7=a3,R7={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wne=typeof URLSearchParams<"u"?URLSearchParams:g3,$ne=typeof FormData<"u"?FormData:null,Yne=typeof Blob<"u"?Blob:null,Jne={isBrowser:!0,classes:{URLSearchParams:Wne,FormData:$ne,Blob:Yne},protocols:["http","https","file","blob","url","data"]},m3=typeof window<"u"&&typeof document<"u",c3=typeof navigator=="object"&&navigator||void 0,Xne=m3&&(!c3||["ReactNative","NativeScript","NS"].indexOf(c3.product)<0),Zne=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",eie=m3&&window.location.href||"http://localhost",tie=Object.freeze({__proto__:null,hasBrowserEnv:m3,hasStandardBrowserWebWorkerEnv:Zne,hasStandardBrowserEnv:Xne,navigator:c3,origin:eie}),qn={...tie,...Jne};function rie(t,e){return uy(t,new qn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return qn.isNode&&te.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function nie(t){return te.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function iie(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&te.isArray(i)?i.length:o,a?(te.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!te.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&te.isArray(i[o])&&(i[o]=iie(i[o])),!c)}if(te.isFormData(t)&&te.isFunction(t.entries)){let r={};return te.forEachEntry(t,(n,i)=>{e(nie(n),i,r,0)}),r}return null}function sie(t,e,r){if(te.isString(t))try{return(e||JSON.parse)(t),te.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var y3={transitional:R7,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=te.isObject(e);if(s&&te.isHTMLForm(e)&&(e=new FormData(e)),te.isFormData(e))return i?JSON.stringify(M7(e)):e;if(te.isArrayBuffer(e)||te.isBuffer(e)||te.isStream(e)||te.isFile(e)||te.isBlob(e)||te.isReadableStream(e))return e;if(te.isArrayBufferView(e))return e.buffer;if(te.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return rie(e,this.formSerializer).toString();if((c=te.isFileList(e))||n.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return uy(c?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),sie(e)):e}],transformResponse:[function(e){let r=this.transitional||y3.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(te.isResponse(e)||te.isReadableStream(e))return e;if(e&&te.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(c){if(o)throw c.name==="SyntaxError"?je.from(c,je.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qn.classes.FormData,Blob:qn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(["delete","get","head","post","put","patch"],t=>{y3.headers[t]={}});var v3=y3,oie=te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),aie=t=>{let e={},r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&oie[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},l7=Symbol("internals");function Jh(t){return t&&String(t).trim().toLowerCase()}function ry(t){return t===!1||t==null?t:te.isArray(t)?t.map(ry):String(t)}function cie(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var uie=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function r3(t,e,r,n,i){if(te.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!te.isString(e)){if(te.isString(n))return e.indexOf(n)!==-1;if(te.isRegExp(n))return n.test(e)}}function lie(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function fie(t,e){let r=te.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Kl=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(c,a,u){let f=Jh(a);if(!f)throw new Error("header name must be a non-empty string");let p=te.findKey(i,f);(!p||i[p]===void 0||u===!0||u===void 0&&i[p]!==!1)&&(i[p||a]=ry(c))}let o=(c,a)=>te.forEach(c,(u,f)=>s(u,f,a));if(te.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(te.isString(e)&&(e=e.trim())&&!uie(e))o(aie(e),r);else if(te.isHeaders(e))for(let[c,a]of e.entries())s(a,c,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Jh(e),e){let n=te.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return cie(i);if(te.isFunction(r))return r.call(this,i,n);if(te.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Jh(e),e){let n=te.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||r3(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=Jh(o),o){let c=te.findKey(n,o);c&&(!r||r3(n,n[c],c,r))&&(delete n[c],i=!0)}}return te.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||r3(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return te.forEach(this,(i,s)=>{let o=te.findKey(n,s);if(o){r[o]=ry(i),delete r[s];return}let c=e?lie(s):String(s).trim();c!==s&&delete r[s],r[c]=ry(i),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return te.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&te.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[l7]=this[l7]={accessors:{}}).accessors,i=this.prototype;function s(o){let c=Jh(o);n[c]||(fie(i,o),n[c]=!0)}return te.isArray(e)?e.forEach(s):s(e),this}};Kl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);te.reduceDescriptors(Kl.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});te.freezeMethods(Kl);var ts=Kl;function n3(t,e){let r=this||v3,n=e||r,i=ts.from(n.headers),s=n.data;return te.forEach(t,function(c){s=c.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function D7(t){return!!(t&&t.__CANCEL__)}function Yl(t,e,r){je.call(this,t??"canceled",je.ERR_CANCELED,e,r),this.name="CanceledError"}te.inherits(Yl,je,{__CANCEL__:!0});function B7(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new je("Request failed with status code "+r.status,[je.ERR_BAD_REQUEST,je.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function die(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function hie(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(a){let u=Date.now(),f=n[s];o||(o=u),r[i]=a,n[i]=u;let p=s,S=0;for(;p!==i;)S+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o{r=f,i=null,s&&(clearTimeout(s),s=null),t.apply(null,u)};return[(...u)=>{let f=Date.now(),p=f-r;p>=n?o(u,f):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}var iy=(t,e,r=3)=>{let n=0,i=hie(50,250);return pie(s=>{let o=s.loaded,c=s.lengthComputable?s.total:void 0,a=o-n,u=i(a),f=o<=c;n=o;let p={loaded:o,total:c,progress:c?o/c:void 0,bytes:a,rate:u||void 0,estimated:u&&c&&f?(c-o)/u:void 0,event:s,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},r)},f7=(t,e)=>{let r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},d7=t=>(...e)=>te.asap(()=>t(...e)),gie=qn.hasStandardBrowserEnv?function(){let e=qn.navigator&&/(msie|trident)/i.test(qn.navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let c=te.isString(o)?i(o):o;return c.protocol===n.protocol&&c.host===n.host}}():function(){return function(){return!0}}(),mie=qn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];te.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),te.isString(n)&&o.push("path="+n),te.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function yie(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function vie(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function L7(t,e){return t&&!yie(e)?vie(t,e):e}var h7=t=>t instanceof ts?{...t}:t;function Wc(t,e){e=e||{};let r={};function n(u,f,p){return te.isPlainObject(u)&&te.isPlainObject(f)?te.merge.call({caseless:p},u,f):te.isPlainObject(f)?te.merge({},f):te.isArray(f)?f.slice():f}function i(u,f,p){if(te.isUndefined(f)){if(!te.isUndefined(u))return n(void 0,u,p)}else return n(u,f,p)}function s(u,f){if(!te.isUndefined(f))return n(void 0,f)}function o(u,f){if(te.isUndefined(f)){if(!te.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function c(u,f,p){if(p in e)return n(u,f);if(p in t)return n(void 0,u)}let a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,f)=>i(h7(u),h7(f),!0)};return te.forEach(Object.keys(Object.assign({},t,e)),function(f){let p=a[f]||i,S=p(t[f],e[f],f);te.isUndefined(S)&&p!==c||(r[f]=S)}),r}var F7=t=>{let e=Wc({},t),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:c}=e;e.headers=o=ts.from(o),e.url=P7(L7(e.baseURL,e.url),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let a;if(te.isFormData(r)){if(qn.hasStandardBrowserEnv||qn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){let[u,...f]=a?a.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...f].join("; "))}}if(qn.hasStandardBrowserEnv&&(n&&te.isFunction(n)&&(n=n(e)),n||n!==!1&&gie(e.url))){let u=i&&s&&mie.read(s);u&&o.set(i,u)}return e},bie=typeof XMLHttpRequest<"u",wie=bie&&function(t){return new Promise(function(r,n){let i=F7(t),s=i.data,o=ts.from(i.headers).normalize(),{responseType:c,onUploadProgress:a,onDownloadProgress:u}=i,f,p,S,I,N;function R(){I&&I(),N&&N(),i.cancelToken&&i.cancelToken.unsubscribe(f),i.signal&&i.signal.removeEventListener("abort",f)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function U(){if(!D)return;let z=ts.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),F={data:!c||c==="text"||c==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:z,config:t,request:D};B7(function(q){r(q),R()},function(q){n(q),R()},F),D=null}"onloadend"in D?D.onloadend=U:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(U)},D.onabort=function(){D&&(n(new je("Request aborted",je.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new je("Network Error",je.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let H=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",F=i.transitional||R7;i.timeoutErrorMessage&&(H=i.timeoutErrorMessage),n(new je(H,F.clarifyTimeoutError?je.ETIMEDOUT:je.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&te.forEach(o.toJSON(),function(H,F){D.setRequestHeader(F,H)}),te.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),c&&c!=="json"&&(D.responseType=i.responseType),u&&([S,N]=iy(u,!0),D.addEventListener("progress",S)),a&&D.upload&&([p,I]=iy(a),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",I)),(i.cancelToken||i.signal)&&(f=z=>{D&&(n(!z||z.type?new Yl(null,t,D):z),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(f),i.signal&&(i.signal.aborted?f():i.signal.addEventListener("abort",f)));let k=die(i.url);if(k&&qn.protocols.indexOf(k)===-1){n(new je("Unsupported protocol "+k+":",je.ERR_BAD_REQUEST,t));return}D.send(s||null)})},Aie=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i,s=function(u){if(!i){i=!0,c();let f=u instanceof Error?u:this.reason;n.abort(f instanceof je?f:new Yl(f instanceof Error?f.message:f))}},o=e&&setTimeout(()=>{o=null,s(new je(`timeout ${e} of ms exceeded`,je.ETIMEDOUT))},e),c=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),t=null)};t.forEach(u=>u.addEventListener("abort",s));let{signal:a}=n;return a.unsubscribe=()=>te.asap(c),a}},Eie=Aie,Sie=function*(t,e){let r=t.byteLength;if(!e||r{let i=_ie(t,e),s=0,o,c=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{let{done:u,value:f}=await i.next();if(u){c(),a.close();return}let p=f.byteLength;if(r){let S=s+=p;r(S)}a.enqueue(new Uint8Array(f))}catch(u){throw c(u),u}},cancel(a){return c(a),i.return()}},{highWaterMark:2})},ly=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",q7=ly&&typeof ReadableStream=="function",Iie=ly&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),U7=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Cie=q7&&U7(()=>{let t=!1,e=new Request(qn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),g7=64*1024,u3=q7&&U7(()=>te.isReadableStream(new Response("").body)),sy={stream:u3&&(t=>t.body)};ly&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!sy[e]&&(sy[e]=te.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new je(`Response type '${e}' is not supported`,je.ERR_NOT_SUPPORT,n)})})})(new Response);var xie=async t=>{if(t==null)return 0;if(te.isBlob(t))return t.size;if(te.isSpecCompliantForm(t))return(await new Request(qn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(te.isArrayBufferView(t)||te.isArrayBuffer(t))return t.byteLength;if(te.isURLSearchParams(t)&&(t=t+""),te.isString(t))return(await Iie(t)).byteLength},Nie=async(t,e)=>{let r=te.toFiniteNumber(t.getContentLength());return r??xie(e)},Oie=ly&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:c,onUploadProgress:a,responseType:u,headers:f,withCredentials:p="same-origin",fetchOptions:S}=F7(t);u=u?(u+"").toLowerCase():"text";let I=Eie([i,s&&s.toAbortSignal()],o),N,R=I&&I.unsubscribe&&(()=>{I.unsubscribe()}),D;try{if(a&&Cie&&r!=="get"&&r!=="head"&&(D=await Nie(f,n))!==0){let F=new Request(e,{method:"POST",body:n,duplex:"half"}),V;if(te.isFormData(n)&&(V=F.headers.get("content-type"))&&f.setContentType(V),F.body){let[q,C]=f7(D,iy(d7(a)));n=p7(F.body,g7,q,C)}}te.isString(p)||(p=p?"include":"omit");let U="credentials"in Request.prototype;N=new Request(e,{...S,signal:I,method:r.toUpperCase(),headers:f.normalize().toJSON(),body:n,duplex:"half",credentials:U?p:void 0});let k=await fetch(N),z=u3&&(u==="stream"||u==="response");if(u3&&(c||z&&R)){let F={};["status","statusText","headers"].forEach(B=>{F[B]=k[B]});let V=te.toFiniteNumber(k.headers.get("content-length")),[q,C]=c&&f7(V,iy(d7(c),!0))||[];k=new Response(p7(k.body,g7,q,()=>{C&&C(),R&&R()}),F)}u=u||"text";let H=await sy[te.findKey(sy,u)||"text"](k,t);return!z&&R&&R(),await new Promise((F,V)=>{B7(F,V,{data:H,headers:ts.from(k.headers),status:k.status,statusText:k.statusText,config:t,request:N})})}catch(U){throw R&&R(),U&&U.name==="TypeError"&&/fetch/i.test(U.message)?Object.assign(new je("Network Error",je.ERR_NETWORK,t,N),{cause:U.cause||U}):je.from(U,U&&U.code,t,N)}}),l3={http:zne,xhr:wie,fetch:Oie};te.forEach(l3,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var m7=t=>`- ${t}`,Pie=t=>te.isFunction(t)||t===null||t===!1,k7={getAdapter:t=>{t=te.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${c} `+(a===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : +`+s.map(m7).join(` +`):" "+m7(s[0]):"as no adapter specified";throw new je("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:l3};function i3(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Yl(null,t)}function y7(t){return i3(t),t.headers=ts.from(t.headers),t.data=n3.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),k7.getAdapter(t.adapter||v3.adapter)(t).then(function(n){return i3(t),n.data=n3.call(t,t.transformResponse,n),n.headers=ts.from(n.headers),n},function(n){return D7(n)||(i3(t),n&&n.response&&(n.response.data=n3.call(t,t.transformResponse,n.response),n.response.headers=ts.from(n.response.headers))),Promise.reject(n)})}var V7="1.7.7",b3={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{b3[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var v7={};b3.transitional=function(e,r,n){function i(s,o){return"[Axios v"+V7+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,c)=>{if(e===!1)throw new je(i(o," has been removed"+(r?" in "+r:"")),je.ERR_DEPRECATED);return r&&!v7[o]&&(v7[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,c):!0}};function Rie(t,e,r){if(typeof t!="object")throw new je("options must be an object",je.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let c=t[s],a=c===void 0||o(c,s,t);if(a!==!0)throw new je("option "+s+" must be "+a,je.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new je("Unknown option "+s,je.ERR_BAD_OPTION)}}var f3={assertOptions:Rie,validators:b3},Ia=f3.validators,Wl=class{constructor(e){this.defaults=e,this.interceptors={request:new u7,response:new u7}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Wc(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&f3.assertOptions(n,{silentJSONParsing:Ia.transitional(Ia.boolean),forcedJSONParsing:Ia.transitional(Ia.boolean),clarifyTimeoutError:Ia.transitional(Ia.boolean)},!1),i!=null&&(te.isFunction(i)?r.paramsSerializer={serialize:i}:f3.assertOptions(i,{encode:Ia.function,serialize:Ia.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&te.merge(s.common,s[r.method]);s&&te.forEach(["delete","get","head","post","put","patch","common"],N=>{delete s[N]}),r.headers=ts.concat(o,s);let c=[],a=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(a=a&&R.synchronous,c.unshift(R.fulfilled,R.rejected))});let u=[];this.interceptors.response.forEach(function(R){u.push(R.fulfilled,R.rejected)});let f,p=0,S;if(!a){let N=[y7.bind(this),void 0];for(N.unshift.apply(N,c),N.push.apply(N,u),S=N.length,f=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(c=>{n.subscribe(c),s=c}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,c){n.reason||(n.reason=new Yl(s,o,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Mie=d3;function Die(t){return function(r){return t.apply(null,r)}}function Bie(t){return te.isObject(t)&&t.isAxiosError===!0}var h3={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(h3).forEach(([t,e])=>{h3[e]=t});var Lie=h3;function H7(t){let e=new ny(t),r=b7(ny.prototype.request,e);return te.extend(r,ny.prototype,e,{allOwnKeys:!0}),te.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return H7(Wc(t,i))},r}var Rr=H7(v3);Rr.Axios=ny;Rr.CanceledError=Yl;Rr.CancelToken=Mie;Rr.isCancel=D7;Rr.VERSION=V7;Rr.toFormData=uy;Rr.AxiosError=je;Rr.Cancel=Rr.CanceledError;Rr.all=function(e){return Promise.all(e)};Rr.spread=Die;Rr.isAxiosError=Bie;Rr.mergeConfig=Wc;Rr.AxiosHeaders=ts;Rr.formToJSON=t=>M7(te.isHTMLForm(t)?new FormData(t):t);Rr.getAdapter=k7.getAdapter;Rr.HttpStatusCode=Lie;Rr.default=Rr;G7.exports=Rr});var hy=L(Ca=>{"use strict";h();var Fie=Ca&&Ca.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ca,"__esModule",{value:!0});Ca.GuardianData=Ca.AccountOnNetwork=void 0;var z7=Fie((qt(),qe(jt))),fy=Ti(),w3=class t{constructor(e){this.address=new fy.Address(""),this.nonce=0,this.balance=new z7.default(0),this.code="",this.userName="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new fy.Address(e.address||""),r.nonce=Number(e.nonce||0),r.balance=new z7.default(e.balance||0),r.code=e.code||"",r.userName=e.username||"",r}};Ca.AccountOnNetwork=w3;var A3=class t{constructor(e){this.guarded=!1,Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.guarded=e.guarded||!1,e.activeGuardian&&(r.activeGuardian=dy.fromHttpResponse(e.activeGuardian)),e.pendingGuardian&&(r.pendingGuardian=dy.fromHttpResponse(e.pendingGuardian)),r}getCurrentGuardianAddress(){if(this.guarded)return this.activeGuardian?.address}};Ca.GuardianData=A3;var dy=class t{constructor(){this.activationEpoch=0,this.address=new fy.Address(""),this.serviceUID=""}static fromHttpResponse(e){let r=new t;return r.activationEpoch=Number(e.activationEpoch||0),r.address=new fy.Address(e.address||""),r.serviceUID=e.serviceUID||"",r}}});var E3=L(Jl=>{"use strict";h();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.defaultPagination=Jl.defaultAxiosConfig=void 0;var qie=s1()({constructorAction:"ignore"});Jl.defaultAxiosConfig={timeout:5e3,transformResponse:[function(t){return qie.parse(t)}]};Jl.defaultPagination={from:0,size:100}});var gy=L(py=>{"use strict";h();Object.defineProperty(py,"__esModule",{value:!0});py.ContractQueryRequest=void 0;var S3=class{constructor(e){this.query=e}toHttpRequest(){let e={},r=this.query;return e.scAddress=r.address.bech32(),e.caller=r.caller?.bech32()?r.caller.bech32():void 0,e.funcName=r.func.toString(),e.value=r.value?r.value.toString():void 0,e.args=r.getEncodedArguments(),e}};py.ContractQueryRequest=S3});var my=L(qs=>{"use strict";h();Object.defineProperty(qs,"__esModule",{value:!0});qs.ErrContractQuery=qs.ErrNetworkProvider=qs.ErrUnexpectedCondition=qs.Err=void 0;var Xl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};qs.Err=Xl;var _3=class extends Xl{constructor(e){super(`Unexpected condition: [${e}]`)}};qs.ErrUnexpectedCondition=_3;var T3=class extends Xl{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};qs.ErrNetworkProvider=T3;var I3=class extends Xl{constructor(e){super(e.message.replace("executeQuery:",""))}};qs.ErrContractQuery=I3});var x3=L(yy=>{"use strict";h();Object.defineProperty(yy,"__esModule",{value:!0});yy.NetworkGeneralStatistics=void 0;var C3=class t{constructor(){this.Shards=0,this.Blocks=0,this.Accounts=0,this.Transactions=0,this.RefreshRate=0,this.Epoch=0,this.RoundsPassed=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let r=new t;return r.Shards=Number(e.shards),r.Blocks=Number(e.blocks),r.Accounts=Number(e.accounts),r.Transactions=Number(e.transactions),r.RefreshRate=Number(e.refreshRate),r.Epoch=Number(e.epoch),r.RoundsPassed=Number(e.roundsPassed),r.RoundsPerEpoch=Number(e.roundsPerEpoch),r}};yy.NetworkGeneralStatistics=C3});var O3=L(Zl=>{"use strict";h();var Uie=Zl&&Zl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zl,"__esModule",{value:!0});Zl.NetworkStake=void 0;var j7=Uie((qt(),qe(jt))),N3=class t{constructor(){this.TotalValidators=0,this.ActiveValidators=0,this.QueueSize=0,this.TotalStaked=new j7.default(0)}static fromHttpResponse(e){let r=new t;return r.TotalValidators=Number(e.totalValidators),r.ActiveValidators=Number(e.activeValidators),r.QueueSize=Number(e.queueSize),r.TotalStaked=new j7.default(e.totalStaked),r}};Zl.NetworkStake=N3});var K7=L(ef=>{"use strict";h();var kie=ef&&ef.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ef,"__esModule",{value:!0});ef.PairOnNetwork=void 0;var Q7=Ti(),Us=kie((qt(),qe(jt))),P3=class t{constructor(e){this.address=new Q7.Address(""),this.id="",this.symbol="",this.name="",this.price=new Us.default(0),this.baseId="",this.basePrice=new Us.default(0),this.baseSymbol="",this.baseName="",this.quoteId="",this.quotePrice=new Us.default(0),this.quoteSymbol="",this.quoteName="",this.totalValue=new Us.default(0),this.volume24h=new Us.default(0),this.state="",this.type="",this.rawResponse={},Object.assign(this,e)}static fromApiHttpResponse(e){let r=new t;return r.address=new Q7.Address(e.address||""),r.id=e.id||"",r.symbol=e.symbol||"",r.name=e.name||"",r.price=new Us.default(e.price||0),r.baseId=e.baseId||"",r.basePrice=new Us.default(e.basePrice||0),r.baseSymbol=e.baseSymbol||"",r.baseName=e.baseName||"",r.quoteId=e.quoteId||"",r.quotePrice=new Us.default(e.quotePrice||0),r.quoteSymbol=e.quoteSymbol||"",r.quoteName=e.quoteName||"",r.totalValue=new Us.default(e.totalValue||0),r.volume24h=new Us.default(e.volume24h||0),r.state=e.state||"",r.type=e.type||"",r.rawResponse=e,r}};ef.PairOnNetwork=P3});var M3=L(tf=>{"use strict";h();var Vie=tf&&tf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tf,"__esModule",{value:!0});tf.NetworkConfig=void 0;var W7=Vie((qt(),qe(jt))),R3=class t{constructor(){this.ChainID="T",this.GasPerDataByte=1500,this.TopUpFactor=0,this.RoundDuration=0,this.RoundsPerEpoch=0,this.TopUpRewardsGradientPoint=new W7.default(0),this.MinGasLimit=5e4,this.MinGasPrice=1e9,this.GasPriceModifier=1,this.MinTransactionVersion=1}static fromHttpResponse(e){let r=new t;return r.ChainID=String(e.erd_chain_id),r.GasPerDataByte=Number(e.erd_gas_per_data_byte),r.TopUpFactor=Number(e.erd_top_up_factor),r.RoundDuration=Number(e.erd_round_duration),r.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),r.TopUpRewardsGradientPoint=new W7.default(e.erd_rewards_top_up_gradient_point),r.MinGasLimit=Number(e.erd_min_gas_limit),r.MinGasPrice=Number(e.erd_min_gas_price),r.MinTransactionVersion=Number(e.erd_min_transaction_version),r.GasPriceModifier=Number(e.erd_gas_price_modifier),r}};tf.NetworkConfig=R3});var B3=L(vy=>{"use strict";h();Object.defineProperty(vy,"__esModule",{value:!0});vy.NetworkStatus=void 0;var D3=class t{constructor(){this.CurrentRound=0,this.EpochNumber=0,this.HighestFinalNonce=0,this.Nonce=0,this.NonceAtEpochStart=0,this.NoncesPassedInCurrentEpoch=0,this.RoundAtEpochStart=0,this.RoundsPassedInCurrentEpoch=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let r=new t;return r.CurrentRound=Number(e.erd_current_round),r.EpochNumber=Number(e.erd_epoch_number),r.HighestFinalNonce=Number(e.erd_highest_final_nonce),r.Nonce=Number(e.erd_nonce),r.NonceAtEpochStart=Number(e.erd_nonce_at_epoch_start),r.NoncesPassedInCurrentEpoch=Number(e.erd_nonces_passed_in_current_epoch),r.RoundAtEpochStart=Number(e.erd_round_at_epoch_start),r.RoundsPassedInCurrentEpoch=Number(e.erd_rounds_passed_in_current_epoch),r.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),r}};vy.NetworkStatus=D3});var wy=L(xa=>{"use strict";h();var Hie=xa&&xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xa,"__esModule",{value:!0});xa.DefinitionOfTokenCollectionOnNetwork=xa.DefinitionOfFungibleTokenOnNetwork=void 0;var by=Hie((qt(),qe(jt))),rf=Ti(),L3=class t{constructor(){this.identifier="",this.name="",this.ticker="",this.owner=new rf.Address(""),this.decimals=0,this.supply=new by.default(0),this.isPaused=!1,this.canUpgrade=!1,this.canMint=!1,this.canBurn=!1,this.canChangeOwner=!1,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canAddSpecialRoles=!1,this.assets={}}static fromApiHttpResponse(e){let r=new t;return r.identifier=e.identifier||"",r.name=e.name||"",r.ticker=e.ticker||"",r.owner=new rf.Address(e.owner||""),r.decimals=e.decimals||0,r.supply=new by.default(e.supply||"0"),r.isPaused=e.isPaused||!1,r.canUpgrade=e.canUpgrade||!1,r.canMint=e.canMint||!1,r.canBurn=e.canBurn||!1,r.canChangeOwner=e.canChangeOwner||!1,r.canPause=e.canPause||!1,r.canFreeze=e.canFreeze||!1,r.canWipe=e.canWipe||!1,r.assets=e.assets||{},r}static fromResponseOfGetTokenProperties(e,r){let n=new t,[i,s,o,c,...a]=r,u=$7(a);return n.identifier=e,n.name=i.toString(),n.ticker=e,n.owner=rf.Address.fromPubkey(o),n.decimals=u.NumDecimals.toNumber(),n.supply=new by.default(c.toString()).shiftedBy(-n.decimals),n.isPaused=u.IsPaused,n.canUpgrade=u.CanUpgrade,n.canMint=u.CanMint,n.canBurn=u.CanBurn,n.canChangeOwner=u.CanChangeOwner,n.canPause=u.CanPause,n.canFreeze=u.CanFreeze,n.canWipe=u.CanWipe,n}};xa.DefinitionOfFungibleTokenOnNetwork=L3;var F3=class t{constructor(){this.collection="",this.type="",this.name="",this.ticker="",this.owner=new rf.Address(""),this.decimals=0,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canUpgrade=!1,this.canChangeOwner=!1,this.canAddSpecialRoles=!1,this.canTransferNftCreateRole=!1,this.canCreateMultiShard=!1}static fromApiHttpResponse(e){let r=new t;return r.collection=e.collection||"",r.type=e.type||"",r.name=e.name||"",r.ticker=e.ticker||"",r.owner=new rf.Address(e.owner||""),r.decimals=e.decimals||0,r.canPause=e.canPause||!1,r.canFreeze=e.canFreeze||!1,r.canWipe=e.canWipe||!1,r.canUpgrade=e.canUpgrade||!1,r.canAddSpecialRoles=e.canAddSpecialRoles||!1,r.canTransferNftCreateRole=e.canTransferNftCreateRole||!1,r}static fromResponseOfGetTokenProperties(e,r){let n=new t,[i,s,o,c,a,...u]=r,f=$7(u);return n.collection=e,n.type=s.toString(),n.name=i.toString(),n.ticker=e,n.owner=rf.Address.fromPubkey(o),n.decimals=f.NumDecimals.toNumber()??0,n.canPause=f.CanPause||!1,n.canFreeze=f.CanFreeze||!1,n.canWipe=f.CanWipe||!1,n.canUpgrade=f.CanUpgrade||!1,n.canChangeOwner=f.CanChangeOwner||!1,n.canAddSpecialRoles=f.CanAddSpecialRoles||!1,n.canTransferNftCreateRole=f.CanTransferNFTCreateRole||!1,n.canCreateMultiShard=f.CanCreateMultiShard||!1,n}};xa.DefinitionOfTokenCollectionOnNetwork=F3;function $7(t){let e={};for(let r of t){let[n,i]=r.toString().split("-");e[n]=Gie(i)}return e}function Gie(t){switch(t){case"true":return!0;case"false":return!1;default:return new by.default(t)}}});var Ay=L(nf=>{"use strict";h();Object.defineProperty(nf,"__esModule",{value:!0});nf.NonFungibleTokenOfAccountOnNetwork=nf.FungibleTokenOfAccountOnNetwork=void 0;var ks=(qt(),qe(jt)),q3=Ti(),U3=class t{constructor(){this.identifier="",this.balance=new ks.BigNumber(0),this.rawResponse={}}static fromHttpResponse(e){let r=new t;return r.identifier=e.tokenIdentifier||e.identifier||"",r.balance=new ks.BigNumber(e.balance||0),r.rawResponse=e,r}};nf.FungibleTokenOfAccountOnNetwork=U3;var k3=class t{constructor(e){this.identifier="",this.collection="",this.timestamp=0,this.attributes=b.Buffer.from([]),this.nonce=0,this.type="",this.name="",this.creator=new q3.Address(""),this.supply=new ks.BigNumber(0),this.decimals=0,this.royalties=new ks.BigNumber(0),this.assets=[],this.balance=new ks.BigNumber(0),Object.assign(this,e)}static fromProxyHttpResponse(e){let r=t.fromHttpResponse(e);return r.identifier=e.tokenIdentifier||"",r.collection=t.parseCollectionFromIdentifier(r.identifier),r.royalties=new ks.BigNumber(e.royalties||0).div(100),r}static fromProxyHttpResponseByNonce(e){let r=t.fromHttpResponse(e),n=new q3.Nonce(r.nonce).hex();return r.identifier=`${e.tokenIdentifier}-${n}`,r.collection=e.tokenIdentifier||"",r.royalties=new ks.BigNumber(e.royalties||0).div(100),r}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.identifier=e.identifier||"",r.collection=e.collection||"",r}static fromHttpResponse(e){let r=new t;return r.timestamp=Number(e.timestamp||0),r.attributes=b.Buffer.from(e.attributes||"","base64"),r.nonce=e.nonce||0,r.type=e.type||"",r.name=e.name||"",r.creator=new q3.Address(e.creator||""),r.decimals=Number(e.decimals||0),r.supply=new ks.BigNumber(e.balance||1),r.royalties=new ks.BigNumber(e.royalties||0),r.assets=e.assets||[],r.balance=new ks.BigNumber(e.balance||1),r}static parseCollectionFromIdentifier(e){return e.split("-").slice(0,2).join("-")}};nf.NonFungibleTokenOfAccountOnNetwork=k3});var sf=L(Ey=>{"use strict";h();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.TransactionStatus=void 0;var V3=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};Ey.TransactionStatus=V3});var G3=L(Na=>{"use strict";h();Object.defineProperty(Na,"__esModule",{value:!0});Na.TransactionEventTopic=Na.TransactionEventData=Na.TransactionEvent=void 0;var Y7=Ti(),H3=class t{constructor(e){this.address=new Y7.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new of(b.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new Y7.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Sy(n)),r.dataPayload=of.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(of.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Na.TransactionEvent=H3;var of=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(b.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Na.TransactionEventData=of;var Sy=class{constructor(e){this.raw=b.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Na.TransactionEventTopic=Sy});var t0=L(_y=>{"use strict";h();Object.defineProperty(_y,"__esModule",{value:!0});_y.TransactionLogs=void 0;var zie=my(),J7=Ti(),jie=G3(),z3=class t{constructor(e){this.address=new J7.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new J7.Address(e.address),r.events=(e.events||[]).map(n=>jie.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new zie.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};_y.TransactionLogs=z3});var Iy=L(af=>{"use strict";h();Object.defineProperty(af,"__esModule",{value:!0});af.ContractResultItem=af.ContractResults=void 0;var X7=t0(),Ty=Ti(),j3=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>r0.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>r0.fromApiHttpResponse(n));return new t(r)}};af.ContractResults=j3;var r0=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Ty.Address(""),this.sender=new Ty.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new X7.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=b.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Ty.Address(e.receiver),r.sender=new Ty.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=X7.TransactionLogs.fromHttpResponse(e.logs||{}),r}};af.ContractResultItem=r0});var xy=L(Cy=>{"use strict";h();Object.defineProperty(Cy,"__esModule",{value:!0});Cy.TransactionReceipt=void 0;var Z7=Ti(),Q3=class t{constructor(){this.value="",this.sender=new Z7.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new Z7.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Cy.TransactionReceipt=Q3});var Oy=L(cf=>{"use strict";h();Object.defineProperty(cf,"__esModule",{value:!0});cf.TransactionOnNetwork=cf.prepareTransactionForBroadcasting=void 0;var eD=sf(),K3=Iy(),Ny=Ti(),tD=t0(),rD=xy();function Qie(t){return"toSendable"in t?t.toSendable():{nonce:Number(t.nonce),value:t.value.toString(),receiver:t.receiver,sender:t.sender,senderUsername:t.senderUsername?b.Buffer.from(t.senderUsername).toString("base64"):void 0,receiverUsername:t.receiverUsername?b.Buffer.from(t.receiverUsername).toString("base64"):void 0,gasPrice:Number(t.gasPrice),gasLimit:Number(t.gasLimit),data:t.data.length===0?void 0:b.Buffer.from(t.data).toString("base64"),chainID:t.chainID,version:t.version,options:t.options,guardian:t.guardian||void 0,signature:b.Buffer.from(t.signature).toString("hex"),guardianSignature:t.guardianSignature.length===0?void 0:b.Buffer.from(t.guardianSignature).toString("hex")}}cf.prepareTransactionForBroadcasting=Qie;var W3=class t{constructor(e){this.hash="",this.type="",this.nonce=0,this.round=0,this.epoch=0,this.value="",this.receiver=new Ny.Address(""),this.sender=new Ny.Address(""),this.gasLimit=0,this.gasPrice=0,this.function="",this.data=b.Buffer.from([]),this.signature="",this.status=eD.TransactionStatus.createUnknown(),this.timestamp=0,this.blockNonce=0,this.hyperblockNonce=0,this.hyperblockHash="",this.receipt=new rD.TransactionReceipt,this.contractResults=new K3.ContractResults([]),this.logs=new tD.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e,r,n){let i=t.fromHttpResponse(e,r);return i.contractResults=K3.ContractResults.fromProxyHttpResponse(r.smartContractResults||[]),n&&(i.status=n,i.isCompleted=i.status.isSuccessful()||i.status.isFailed()),i}static fromApiHttpResponse(e,r){let n=t.fromHttpResponse(e,r);return n.contractResults=K3.ContractResults.fromApiHttpResponse(r.results||[]),n.isCompleted=!n.status.isPending(),n}static fromHttpResponse(e,r){let n=new t;return n.hash=e,n.type=r.type||"",n.nonce=r.nonce||0,n.round=r.round,n.epoch=r.epoch||0,n.value=(r.value||0).toString(),n.sender=new Ny.Address(r.sender),n.receiver=new Ny.Address(r.receiver),n.gasPrice=r.gasPrice||0,n.gasLimit=r.gasLimit||0,n.function=r.function||"",n.data=b.Buffer.from(r.data||"","base64"),n.status=new eD.TransactionStatus(r.status),n.timestamp=r.timestamp||0,n.blockNonce=r.blockNonce||0,n.hyperblockNonce=r.hyperblockNonce||0,n.hyperblockHash=r.hyperblockHash||"",n.receipt=rD.TransactionReceipt.fromHttpResponse(r.receipt||{}),n.logs=tD.TransactionLogs.fromHttpResponse(r.logs||{}),n}getDateTime(){return new Date(this.timestamp*1e3)}};cf.TransactionOnNetwork=W3});var $3=L(Py=>{"use strict";h();Object.defineProperty(Py,"__esModule",{value:!0});Py.extendUserAgent=void 0;var nD=e0(),Kie=$h();function Wie(t,e){e.headers||(e.headers=new nD.AxiosHeaders({})),e.clientName||console.log("Can you please provide the client name of the application that uses the SDK? It will be used for metrics.");let r=nD.AxiosHeaders.from(e.headers).normalize(!0),n=e.clientName||Kie.UnknownClientName,i=r.hasUserAgent()?r.getUserAgent():"",s=i?`${i} ${t}/${n}`:`${t}/${n}`;r.setUserAgent(s,!0)}Py.extendUserAgent=Wie});var X3=L(uf=>{"use strict";h();var $ie=uf&&uf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uf,"__esModule",{value:!0});uf.ProxyNetworkProvider=void 0;var iD=$ie(e0()),sD=hy(),Yie=E3(),oD=$h(),Jie=gy(),Xie=jl(),Y3=my(),Zie=M3(),ese=B3(),aD=wy(),Ry=Ay(),n0=Oy(),tse=sf(),rse=$3(),J3=class{constructor(e,r){this.userAgentPrefix=`${oD.BaseUserAgent}/proxy`,this.url=e,this.config={...Yie.defaultAxiosConfig,...r},rse.extendUserAgent(this.userAgentPrefix,this.config)}async getNetworkConfig(){let e=await this.doGetGeneric("network/config");return Zie.NetworkConfig.fromHttpResponse(e.config)}async getNetworkStatus(){let e=await this.doGetGeneric("network/status/4294967295");return ese.NetworkStatus.fromHttpResponse(e.status)}async getNetworkStakeStatistics(){throw new Error("Method not implemented.")}async getNetworkGeneralStatistics(){throw new Error("Method not implemented.")}async getAccount(e){let r=await this.doGetGeneric(`address/${e.bech32()}`);return sD.AccountOnNetwork.fromHttpResponse(r.account)}async getGuardianData(e){let r=await this.doGetGeneric(`address/${e.bech32()}/guardian-data`);return sD.GuardianData.fromHttpResponse(r.guardianData)}async getFungibleTokensOfAccount(e,r){let n=`address/${e.bech32()}/esdt`,i=await this.doGetGeneric(n),c=Object.values(i.esdts).filter(a=>!a.nonce).map(a=>Ry.FungibleTokenOfAccountOnNetwork.fromHttpResponse(a));return c.sort((a,u)=>a.identifier.localeCompare(u.identifier)),c}async getNonFungibleTokensOfAccount(e,r){let n=`address/${e.bech32()}/esdt`,i=await this.doGetGeneric(n),c=Object.values(i.esdts).filter(a=>a.nonce>=0).map(a=>Ry.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponse(a));return c.sort((a,u)=>a.identifier.localeCompare(u.identifier)),c}async getFungibleTokenOfAccount(e,r){let n=await this.doGetGeneric(`address/${e.bech32()}/esdt/${r}`);return Ry.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n.tokenData)}async getNonFungibleTokenOfAccount(e,r,n){let i=await this.doGetGeneric(`address/${e.bech32()}/nft/${r}/nonce/${n.valueOf()}`);return Ry.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponseByNonce(i.tokenData)}async getTransaction(e,r){let n;r===!0&&(n=this.getTransactionStatus(e));let i=this.buildUrlWithQueryParameters(`transaction/${e}`,{withResults:"true"}),s=await this.doGetGeneric(i);if(n){let o=await n;return n0.TransactionOnNetwork.fromProxyHttpResponse(e,s.transaction,o)}return n0.TransactionOnNetwork.fromProxyHttpResponse(e,s.transaction)}async getTransactionStatus(e){let r=await this.doGetGeneric(`transaction/${e}/process-status`);return new tse.TransactionStatus(r.status)}async sendTransaction(e){let r=n0.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transaction/send",r)).txHash}async sendTransactions(e){let r=e.map(s=>n0.prepareTransactionForBroadcasting(s)),n=await this.doPostGeneric("transaction/send-multiple",r),i=Array(e.length).fill(null);for(let s=0;s[r]})).getReturnDataParts()}async getDefinitionOfTokenCollection(e){let r=await this.getTokenProperties(e);return aD.DefinitionOfTokenCollectionOnNetwork.fromResponseOfGetTokenProperties(e,r)}async getNonFungibleToken(e,r){throw new Error("Method not implemented.")}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,r){return await this.doPost(e,r)}async doGet(e){let r=`${this.url}/${e}`;try{return(await iD.default.get(r,this.config)).data.data}catch(n){this.handleApiError(n,e)}}async doPost(e,r){let n=`${this.url}/${e}`;try{return(await iD.default.post(n,r,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data.data}catch(i){this.handleApiError(i,e)}}buildUrlWithQueryParameters(e,r){let n=new URLSearchParams;for(let[i,s]of Object.entries(r))s&&n.append(i,s);return`${e}?${n.toString()}`}handleApiError(e,r){if(!e.response)throw new Y3.ErrNetworkProvider(r,e.toString(),e);let n=e.response.data,i=n.message||n.error||JSON.stringify(n);throw new Y3.ErrNetworkProvider(r,i,e)}};uf.ProxyNetworkProvider=J3});var dD=L(lf=>{"use strict";h();var nse=lf&&lf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lf,"__esModule",{value:!0});lf.ApiNetworkProvider=void 0;var cD=nse(e0()),ise=hy(),My=E3(),sse=$h(),ose=gy(),ase=jl(),Z3=my(),cse=x3(),use=O3(),lse=K7(),uD=Ti(),fse=X3(),lD=wy(),i0=Ay(),fD=Oy(),dse=sf(),hse=$3(),e6=class{constructor(e,r){this.userAgentPrefix=`${sse.BaseUserAgent}/api`,this.url=e;let n=this.getProxyConfig(r);this.config={...My.defaultAxiosConfig,...r},this.backingProxyNetworkProvider=new fse.ProxyNetworkProvider(e,n),hse.extendUserAgent(this.userAgentPrefix,this.config)}getProxyConfig(e){let r=JSON.parse(JSON.stringify(e||{}));return r={...My.defaultAxiosConfig,...r},r}async getNetworkConfig(){return await this.backingProxyNetworkProvider.getNetworkConfig()}async getNetworkStatus(){return await this.backingProxyNetworkProvider.getNetworkStatus()}async getNetworkStakeStatistics(){let e=await this.doGetGeneric("stake");return use.NetworkStake.fromHttpResponse(e)}async getNetworkGeneralStatistics(){let e=await this.doGetGeneric("stats");return cse.NetworkGeneralStatistics.fromHttpResponse(e)}async getAccount(e){let r=await this.doGetGeneric(`accounts/${e.bech32()}`);return ise.AccountOnNetwork.fromHttpResponse(r)}async getGuardianData(e){return await this.backingProxyNetworkProvider.getGuardianData(e)}async getFungibleTokensOfAccount(e,r){r=r||My.defaultPagination;let n=`accounts/${e.bech32()}/tokens?${this.buildPaginationParams(r)}`,s=(await this.doGetGeneric(n)).map(o=>i0.FungibleTokenOfAccountOnNetwork.fromHttpResponse(o));return s.sort((o,c)=>o.identifier.localeCompare(c.identifier)),s}async getNonFungibleTokensOfAccount(e,r){r=r||My.defaultPagination;let n=`accounts/${e.bech32()}/nfts?${this.buildPaginationParams(r)}`,s=(await this.doGetGeneric(n)).map(o=>i0.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(o));return s.sort((o,c)=>o.identifier.localeCompare(c.identifier)),s}async getFungibleTokenOfAccount(e,r){let n=await this.doGetGeneric(`accounts/${e.bech32()}/tokens/${r}`);return i0.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n)}async getNonFungibleTokenOfAccount(e,r,n){let i=new uD.Nonce(n).hex(),s=await this.doGetGeneric(`accounts/${e.bech32()}/nfts/${r}-${i}`);return i0.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(s)}async getMexPairs(e){let r="mex/pairs";return e&&(r=`${r}?from=${e.from}&size=${e.size}`),(await this.doGetGeneric(r)).map(i=>lse.PairOnNetwork.fromApiHttpResponse(i))}async getTransaction(e){let r=await this.doGetGeneric(`transactions/${e}`);return fD.TransactionOnNetwork.fromApiHttpResponse(e,r)}async getTransactionStatus(e){let r=await this.doGetGeneric(`transactions/${e}?fields=status`);return new dse.TransactionStatus(r.status)}async sendTransaction(e){let r=fD.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transactions",r)).txHash}async sendTransactions(e){return await this.backingProxyNetworkProvider.sendTransactions(e)}async simulateTransaction(e){return await this.backingProxyNetworkProvider.simulateTransaction(e)}async queryContract(e){try{let r=new ose.ContractQueryRequest(e).toHttpRequest(),n=await this.doPostGeneric("query",r);return ase.ContractQueryResponse.fromHttpResponse(n)}catch(r){throw new Z3.ErrContractQuery(r)}}async getDefinitionOfFungibleToken(e){let r=await this.doGetGeneric(`tokens/${e}`);return lD.DefinitionOfFungibleTokenOnNetwork.fromApiHttpResponse(r)}async getDefinitionOfTokenCollection(e){let r=await this.doGetGeneric(`collections/${e}`);return lD.DefinitionOfTokenCollectionOnNetwork.fromApiHttpResponse(r)}async getNonFungibleToken(e,r){let n=new uD.Nonce(r).hex(),i=await this.doGetGeneric(`nfts/${e}-${n}`);return i0.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(i)}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,r){return await this.doPost(e,r)}buildPaginationParams(e){return`from=${e.from}&size=${e.size}`}async doGet(e){let r=`${this.url}/${e}`;try{return(await cD.default.get(r,this.config)).data}catch(n){this.handleApiError(n,e)}}async doPost(e,r){let n=`${this.url}/${e}`;try{return(await cD.default.post(n,r,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data}catch(i){this.handleApiError(i,e)}}handleApiError(e,r){if(!e.response)throw new Z3.ErrNetworkProvider(r,e.toString(),e);let n=e.response.data,i=n.message||n.error||JSON.stringify(n);throw new Z3.ErrNetworkProvider(r,i,e)}};lf.ApiNetworkProvider=e6});var mD=L(Ue=>{"use strict";h();Object.defineProperty(Ue,"__esModule",{value:!0});Ue.NetworkStatus=Ue.NetworkStake=Ue.NetworkGeneralStatistics=Ue.NetworkConfig=Ue.NonFungibleTokenOfAccountOnNetwork=Ue.FungibleTokenOfAccountOnNetwork=Ue.DefinitionOfTokenCollectionOnNetwork=Ue.DefinitionOfFungibleTokenOnNetwork=Ue.TransactionOnNetwork=Ue.TransactionStatus=Ue.TransactionReceipt=Ue.TransactionLogsOnNetwork=Ue.TransactionEventTopic=Ue.TransactionEventData=Ue.TransactionEventOnNetwork=Ue.ContractResults=Ue.ContractResultItem=Ue.ContractQueryResponse=Ue.AccountOnNetwork=Ue.ProxyNetworkProvider=Ue.ApiNetworkProvider=void 0;var pse=dD();Object.defineProperty(Ue,"ApiNetworkProvider",{enumerable:!0,get:function(){return pse.ApiNetworkProvider}});var gse=X3();Object.defineProperty(Ue,"ProxyNetworkProvider",{enumerable:!0,get:function(){return gse.ProxyNetworkProvider}});var mse=hy();Object.defineProperty(Ue,"AccountOnNetwork",{enumerable:!0,get:function(){return mse.AccountOnNetwork}});var yse=jl();Object.defineProperty(Ue,"ContractQueryResponse",{enumerable:!0,get:function(){return yse.ContractQueryResponse}});var hD=Iy();Object.defineProperty(Ue,"ContractResultItem",{enumerable:!0,get:function(){return hD.ContractResultItem}});Object.defineProperty(Ue,"ContractResults",{enumerable:!0,get:function(){return hD.ContractResults}});var t6=G3();Object.defineProperty(Ue,"TransactionEventOnNetwork",{enumerable:!0,get:function(){return t6.TransactionEvent}});Object.defineProperty(Ue,"TransactionEventData",{enumerable:!0,get:function(){return t6.TransactionEventData}});Object.defineProperty(Ue,"TransactionEventTopic",{enumerable:!0,get:function(){return t6.TransactionEventTopic}});var vse=t0();Object.defineProperty(Ue,"TransactionLogsOnNetwork",{enumerable:!0,get:function(){return vse.TransactionLogs}});var bse=xy();Object.defineProperty(Ue,"TransactionReceipt",{enumerable:!0,get:function(){return bse.TransactionReceipt}});var wse=sf();Object.defineProperty(Ue,"TransactionStatus",{enumerable:!0,get:function(){return wse.TransactionStatus}});var Ase=Oy();Object.defineProperty(Ue,"TransactionOnNetwork",{enumerable:!0,get:function(){return Ase.TransactionOnNetwork}});var pD=wy();Object.defineProperty(Ue,"DefinitionOfFungibleTokenOnNetwork",{enumerable:!0,get:function(){return pD.DefinitionOfFungibleTokenOnNetwork}});Object.defineProperty(Ue,"DefinitionOfTokenCollectionOnNetwork",{enumerable:!0,get:function(){return pD.DefinitionOfTokenCollectionOnNetwork}});var gD=Ay();Object.defineProperty(Ue,"FungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return gD.FungibleTokenOfAccountOnNetwork}});Object.defineProperty(Ue,"NonFungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return gD.NonFungibleTokenOfAccountOnNetwork}});var Ese=M3();Object.defineProperty(Ue,"NetworkConfig",{enumerable:!0,get:function(){return Ese.NetworkConfig}});var Sse=x3();Object.defineProperty(Ue,"NetworkGeneralStatistics",{enumerable:!0,get:function(){return Sse.NetworkGeneralStatistics}});var _se=O3();Object.defineProperty(Ue,"NetworkStake",{enumerable:!0,get:function(){return _se.NetworkStake}});var Tse=B3();Object.defineProperty(Ue,"NetworkStatus",{enumerable:!0,get:function(){return Tse.NetworkStatus}})});var $c=L(et=>{"use strict";h();var Ise=et&&et.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wt=et&&et.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ise(e,t,r)};Object.defineProperty(et,"__esModule",{value:!0});HM();Wt(Hl(),et);Wt(jM(),et);Wt(Nt(),et);Wt(U_(),et);Wt(Wp(),et);Wt(QM(),et);Wt(Ve(),et);Wt(WM(),et);Wt(YM(),et);Wt(XM(),et);Wt(ra(),et);Wt(Q1(),et);Wt(Vd(),et);Wt(ZM(),et);Wt(t7(),et);Wt(r7(),et);Wt(i7(),et);Wt(yi(),et);Wt(N_(),et);Wt(Sc(),et);Wt(Dn(),et);Wt(B1(),et);Wt(No(),et);Wt(W1(),et);Wt(v1(),et);Wt(D_(),et);Wt(fi(),et);Wt(mD(),et)});var yD=L(Oa=>{"use strict";h();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.ErrAccountNotConnected=Oa.ErrCannotSignSingleTransaction=Oa.Err=void 0;var s0=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Oa.Err=s0;var r6=class extends s0{constructor(){super("Cannot sign single transaction.")}};Oa.ErrCannotSignSingleTransaction=r6;var n6=class extends s0{constructor(){super("Account is not connected.")}};Oa.ErrAccountNotConnected=n6});var bD=L(Dy=>{"use strict";h();Object.defineProperty(Dy,"__esModule",{value:!0});Dy.Operation=void 0;var vD;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(vD||(Dy.Operation=vD={}))});var i6=L(ff=>{"use strict";h();var Yc=ff&&ff.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(ff,"__esModule",{value:!0});ff.ExtensionProvider=void 0;var wD=$c(),Cse=Dn(),AD=yD(),o0=bD(),a0=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Yc(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(){return Yc(this,arguments,void 0,function*(e={}){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(o0.Operation.Connect,n),this.account})}logout(){return Yc(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(o0.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 Yc(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!!this.account.address}getAccount(){return this.account}setAccount(e){this.account=e}signTransaction(e){return Yc(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new AD.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new AD.ErrAccountNotConnected}signTransactions(e){return Yc(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(o0.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>Cse.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Yc(this,void 0,void 0,function*(){var r;this.ensureConnected();let n={account:this.account.address,message:b.Buffer.from(e.data).toString()},s=(yield this.startBgrMsgChannel(o0.Operation.SignMessage,n)).signature,o=b.Buffer.from(s,"hex");return new wD.Message({data:b.Buffer.from(e.data),address:(r=e.address)!==null&&r!==void 0?r:wD.Address.fromBech32(this.account.address),signer:"extension",version:e.version,signature:o})})}cancelAction(){return this.startBgrMsgChannel(o0.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};ff.ExtensionProvider=a0;a0._instance=new a0});var df={};Zt(df,{__assign:()=>o6,__asyncDelegator:()=>kse,__asyncGenerator:()=>Use,__asyncValues:()=>Vse,__await:()=>c0,__awaiter:()=>Mse,__classPrivateFieldGet:()=>jse,__classPrivateFieldSet:()=>Qse,__createBinding:()=>Bse,__decorate:()=>Ose,__exportStar:()=>Lse,__extends:()=>xse,__generator:()=>Dse,__importDefault:()=>zse,__importStar:()=>Gse,__makeTemplateObject:()=>Hse,__metadata:()=>Rse,__param:()=>Pse,__read:()=>ID,__rest:()=>Nse,__spread:()=>Fse,__spreadArrays:()=>qse,__values:()=>a6});function xse(t,e){s6(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Nse(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;c--)(o=t[c])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Pse(t,e){return function(r,n){e(r,n,t)}}function Rse(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Mse(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})}function Dse(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(u){return function(f){return a([u,f])}}function a(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ID(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(c){o={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Fse(){for(var t=[],e=0;e1||c(S,I)})})}function c(S,I){try{a(n[S](I))}catch(N){p(s[0][3],N)}}function a(S){S.value instanceof c0?Promise.resolve(S.value.v).then(u,f):p(s[0][2],S)}function u(S){c("next",S)}function f(S){c("throw",S)}function p(S,I){S(I),s.shift(),s.length&&c(s[0][0],s[0][1])}}function kse(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:c0(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Vse(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof a6=="function"?a6(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,a){o=t[s](o),i(c,a,o.done,o.value)})}}function i(s,o,c,a){Promise.resolve(a).then(function(u){s({value:u,done:c})},o)}}function Hse(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Gse(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function zse(t){return t&&t.__esModule?t:{default:t}}function jse(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Qse(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var s6,o6,hf=pe(()=>{h();s6=function(t,e){return s6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},s6(t,e)};o6=function(){return o6=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";h();Object.defineProperty(qy,"__esModule",{value:!0});qy.delay=void 0;function Kse(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}qy.delay=Kse});var xD=L(pf=>{"use strict";h();Object.defineProperty(pf,"__esModule",{value:!0});pf.ONE_THOUSAND=pf.ONE_HUNDRED=void 0;pf.ONE_HUNDRED=100;pf.ONE_THOUSAND=1e3});var ND=L(fe=>{"use strict";h();Object.defineProperty(fe,"__esModule",{value:!0});fe.ONE_YEAR=fe.FOUR_WEEKS=fe.THREE_WEEKS=fe.TWO_WEEKS=fe.ONE_WEEK=fe.THIRTY_DAYS=fe.SEVEN_DAYS=fe.FIVE_DAYS=fe.THREE_DAYS=fe.ONE_DAY=fe.TWENTY_FOUR_HOURS=fe.TWELVE_HOURS=fe.SIX_HOURS=fe.THREE_HOURS=fe.ONE_HOUR=fe.SIXTY_MINUTES=fe.THIRTY_MINUTES=fe.TEN_MINUTES=fe.FIVE_MINUTES=fe.ONE_MINUTE=fe.SIXTY_SECONDS=fe.THIRTY_SECONDS=fe.TEN_SECONDS=fe.FIVE_SECONDS=fe.ONE_SECOND=void 0;fe.ONE_SECOND=1;fe.FIVE_SECONDS=5;fe.TEN_SECONDS=10;fe.THIRTY_SECONDS=30;fe.SIXTY_SECONDS=60;fe.ONE_MINUTE=fe.SIXTY_SECONDS;fe.FIVE_MINUTES=fe.ONE_MINUTE*5;fe.TEN_MINUTES=fe.ONE_MINUTE*10;fe.THIRTY_MINUTES=fe.ONE_MINUTE*30;fe.SIXTY_MINUTES=fe.ONE_MINUTE*60;fe.ONE_HOUR=fe.SIXTY_MINUTES;fe.THREE_HOURS=fe.ONE_HOUR*3;fe.SIX_HOURS=fe.ONE_HOUR*6;fe.TWELVE_HOURS=fe.ONE_HOUR*12;fe.TWENTY_FOUR_HOURS=fe.ONE_HOUR*24;fe.ONE_DAY=fe.TWENTY_FOUR_HOURS;fe.THREE_DAYS=fe.ONE_DAY*3;fe.FIVE_DAYS=fe.ONE_DAY*5;fe.SEVEN_DAYS=fe.ONE_DAY*7;fe.THIRTY_DAYS=fe.ONE_DAY*30;fe.ONE_WEEK=fe.SEVEN_DAYS;fe.TWO_WEEKS=fe.ONE_WEEK*2;fe.THREE_WEEKS=fe.ONE_WEEK*3;fe.FOUR_WEEKS=fe.ONE_WEEK*4;fe.ONE_YEAR=fe.ONE_DAY*365});var c6=L(Uy=>{"use strict";h();Object.defineProperty(Uy,"__esModule",{value:!0});var OD=(hf(),qe(df));OD.__exportStar(xD(),Uy);OD.__exportStar(ND(),Uy)});var RD=L(gf=>{"use strict";h();Object.defineProperty(gf,"__esModule",{value:!0});gf.fromMiliseconds=gf.toMiliseconds=void 0;var PD=c6();function Wse(t){return t*PD.ONE_THOUSAND}gf.toMiliseconds=Wse;function $se(t){return Math.floor(t/PD.ONE_THOUSAND)}gf.fromMiliseconds=$se});var DD=L(ky=>{"use strict";h();Object.defineProperty(ky,"__esModule",{value:!0});var MD=(hf(),qe(df));MD.__exportStar(CD(),ky);MD.__exportStar(RD(),ky)});var BD=L(u0=>{"use strict";h();Object.defineProperty(u0,"__esModule",{value:!0});u0.Watch=void 0;var Vy=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};u0.Watch=Vy;u0.default=Vy});var LD=L(Hy=>{"use strict";h();Object.defineProperty(Hy,"__esModule",{value:!0});Hy.IWatch=void 0;var u6=class{};Hy.IWatch=u6});var FD=L(l6=>{"use strict";h();Object.defineProperty(l6,"__esModule",{value:!0});var Yse=(hf(),qe(df));Yse.__exportStar(LD(),l6)});var yf=L(mf=>{"use strict";h();Object.defineProperty(mf,"__esModule",{value:!0});var Gy=(hf(),qe(df));Gy.__exportStar(DD(),mf);Gy.__exportStar(BD(),mf);Gy.__exportStar(FD(),mf);Gy.__exportStar(c6(),mf)});var l0,qD=pe(()=>{h();l0=class{}});var UD={};Zt(UD,{IEvents:()=>l0});var f6=pe(()=>{h();qD()});var HD={};Zt(HD,{HEARTBEAT_EVENTS:()=>VD,HEARTBEAT_INTERVAL:()=>d6,HeartBeat:()=>h6,IHeartBeat:()=>zy});var kD,jy,zy,d6,VD,h6,GD=pe(()=>{h();kD=ge(_o()),jy=ge(yf());f6();zy=class extends l0{constructor(e){super()}},d6=jy.FIVE_SECONDS,VD={pulse:"heartbeat_pulse"},h6=class t extends zy{constructor(e){super(e),this.events=new kD.EventEmitter,this.interval=d6,this.interval=e?.interval||d6}static async init(e){let r=new t(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,jy.toMiliseconds)(this.interval))}pulse(){this.events.emit(VD.pulse)}}});function eoe(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){toe(t);return}return e}function toe(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function f0(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Zse.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Jse.test(t)||Xse.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,eoe)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var Jse,Xse,Zse,zD=pe(()=>{h();Jse=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Xse=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Zse=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function roe(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Dr(t,...e){try{return roe(t(...e))}catch(r){return Promise.reject(r)}}function noe(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function ioe(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function d0(t){if(noe(t))return String(t);if(ioe(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return d0(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function jD(){if(typeof b.Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}function QD(t){if(typeof t=="string")return t;jD();let e=b.Buffer.from(t).toString("base64");return p6+e}function KD(t){return typeof t!="string"||!t.startsWith(p6)?t:(jD(),b.Buffer.from(t.slice(p6.length),"base64"))}function An(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WD(...t){return An(t.join(":"))}function h0(t){return t=An(t),t?t+":":""}var p6,$D=pe(()=>{h();p6="base64:"});function XD(t={}){let e={mounts:{"":t.driver||ooe()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(let f of e.mountpoints)if(u.startsWith(f))return{base:f,relativeKey:u.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:u,driver:e.mounts[""]}},n=(u,f)=>e.mountpoints.filter(p=>p.startsWith(u)||f&&u.startsWith(p)).map(p=>({relativeBase:u.length>p.length?u.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(u,f)=>{if(e.watching){f=An(f);for(let p of e.watchListeners)p(u,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let u in e.mounts)e.unwatch[u]=await YD(e.mounts[u],i,u)}},o=async()=>{if(e.watching){for(let u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},c=(u,f,p)=>{let S=new Map,I=N=>{let R=S.get(N.base);return R||(R={driver:N.driver,base:N.base,items:[]},S.set(N.base,R)),R};for(let N of u){let R=typeof N=="string",D=An(R?N:N.key),U=R?void 0:N.value,k=R||!N.options?f:{...f,...N.options},z=r(D);I(z).items.push({key:D,value:U,relativeKey:z.relativeKey,options:k})}return Promise.all([...S.values()].map(N=>p(N))).then(N=>N.flat())},a={hasItem(u,f={}){u=An(u);let{relativeKey:p,driver:S}=r(u);return Dr(S.hasItem,p,f)},getItem(u,f={}){u=An(u);let{relativeKey:p,driver:S}=r(u);return Dr(S.getItem,p,f).then(I=>f0(I))},getItems(u,f){return c(u,f,p=>p.driver.getItems?Dr(p.driver.getItems,p.items.map(S=>({key:S.relativeKey,options:S.options})),f).then(S=>S.map(I=>({key:WD(p.base,I.key),value:f0(I.value)}))):Promise.all(p.items.map(S=>Dr(p.driver.getItem,S.relativeKey,S.options).then(I=>({key:S.key,value:f0(I)})))))},getItemRaw(u,f={}){u=An(u);let{relativeKey:p,driver:S}=r(u);return S.getItemRaw?Dr(S.getItemRaw,p,f):Dr(S.getItem,p,f).then(I=>KD(I))},async setItem(u,f,p={}){if(f===void 0)return a.removeItem(u);u=An(u);let{relativeKey:S,driver:I}=r(u);I.setItem&&(await Dr(I.setItem,S,d0(f),p),I.watch||i("update",u))},async setItems(u,f){await c(u,f,async p=>{if(p.driver.setItems)return Dr(p.driver.setItems,p.items.map(S=>({key:S.relativeKey,value:d0(S.value),options:S.options})),f);p.driver.setItem&&await Promise.all(p.items.map(S=>Dr(p.driver.setItem,S.relativeKey,d0(S.value),S.options)))})},async setItemRaw(u,f,p={}){if(f===void 0)return a.removeItem(u,p);u=An(u);let{relativeKey:S,driver:I}=r(u);if(I.setItemRaw)await Dr(I.setItemRaw,S,f,p);else if(I.setItem)await Dr(I.setItem,S,QD(f),p);else return;I.watch||i("update",u)},async removeItem(u,f={}){typeof f=="boolean"&&(f={removeMeta:f}),u=An(u);let{relativeKey:p,driver:S}=r(u);S.removeItem&&(await Dr(S.removeItem,p,f),(f.removeMeta||f.removeMata)&&await Dr(S.removeItem,p+"$",f),S.watch||i("remove",u))},async getMeta(u,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),u=An(u);let{relativeKey:p,driver:S}=r(u),I=Object.create(null);if(S.getMeta&&Object.assign(I,await Dr(S.getMeta,p,f)),!f.nativeOnly){let N=await Dr(S.getItem,p+"$",f).then(R=>f0(R));N&&typeof N=="object"&&(typeof N.atime=="string"&&(N.atime=new Date(N.atime)),typeof N.mtime=="string"&&(N.mtime=new Date(N.mtime)),Object.assign(I,N))}return I},setMeta(u,f,p={}){return this.setItem(u+"$",f,p)},removeMeta(u,f={}){return this.removeItem(u+"$",f)},async getKeys(u,f={}){u=h0(u);let p=n(u,!0),S=[],I=[];for(let N of p){let R=await Dr(N.driver.getKeys,N.relativeBase,f);for(let D of R){let U=N.mountpoint+An(D);S.some(k=>U.startsWith(k))||I.push(U)}S=[N.mountpoint,...S.filter(D=>!D.startsWith(N.mountpoint))]}return u?I.filter(N=>N.startsWith(u)&&N[N.length-1]!=="$"):I.filter(N=>N[N.length-1]!=="$")},async clear(u,f={}){u=h0(u),await Promise.all(n(u,!1).map(async p=>{if(p.driver.clear)return Dr(p.driver.clear,p.relativeBase,f);if(p.driver.removeItem){let S=await p.driver.getKeys(p.relativeBase||"",f);return Promise.all(S.map(I=>p.driver.removeItem(I,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>JD(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,f){if(u=h0(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((p,S)=>S.length-p.length)),e.mounts[u]=f,e.watching&&Promise.resolve(YD(f,i,u)).then(p=>{e.unwatch[u]=p}).catch(console.error),a},async unmount(u,f=!0){u=h0(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u](),delete e.unwatch[u]),f&&await JD(e.mounts[u]),e.mountpoints=e.mountpoints.filter(p=>p!==u),delete e.mounts[u])},getMount(u=""){u=An(u)+":";let f=r(u);return{driver:f.driver,base:f.base}},getMounts(u="",f={}){return u=An(u),n(u,f.parents).map(S=>({driver:S.driver,base:S.mountpoint}))},keys:(u,f={})=>a.getKeys(u,f),get:(u,f={})=>a.getItem(u,f),set:(u,f,p={})=>a.setItem(u,f,p),has:(u,f={})=>a.hasItem(u,f),del:(u,f={})=>a.removeItem(u,f),remove:(u,f={})=>a.removeItem(u,f)};return a}function YD(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function JD(t){typeof t.dispose=="function"&&await Dr(t.dispose)}var soe,ooe,ZD=pe(()=>{h();zD();$D();soe="memory",ooe=()=>{let t=new Map;return{name:soe,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}}});function Jc(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function m6(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Jc(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function p0(){return g6||(g6=m6("keyval-store","keyval")),g6}function y6(t,e=p0()){return e("readonly",r=>Jc(r.get(t)))}function e9(t,e,r=p0()){return r("readwrite",n=>(n.put(e,t),Jc(n.transaction)))}function t9(t,e=p0()){return e("readwrite",r=>(r.delete(t),Jc(r.transaction)))}function r9(t=p0()){return t("readwrite",e=>(e.clear(),Jc(e.transaction)))}function aoe(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Jc(t.transaction)}function n9(t=p0()){return t("readonly",e=>{if(e.getAllKeys)return Jc(e.getAllKeys());let r=[];return aoe(e,n=>r.push(n.key)).then(()=>r)})}var g6,i9=pe(()=>{h()});var s9={};Zt(s9,{safeJsonParse:()=>Ra,safeJsonStringify:()=>ns});function Ra(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return uoe(t)}catch{return t}}function ns(t){return typeof t=="string"?t:coe(t)||""}var coe,uoe,vf=pe(()=>{h();coe=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),uoe=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var a9={};Zt(a9,{KeyValueStorage:()=>A6,default:()=>A6});function poe(t){var e;return[t[0],Ra((e=t[1])!=null?e:"")]}var loe,foe,doe,hoe,b6,v6,Qy,w6,goe,o9,moe,yoe,A6,c9=pe(()=>{h();ZD();i9();vf();loe="idb-keyval",foe=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=m6(t.dbName,t.storeName)),{name:loe,options:t,async hasItem(i){return!(typeof await y6(r(i),n)>"u")},async getItem(i){return await y6(r(i),n)??null},setItem(i,s){return e9(r(i),s,n)},removeItem(i){return t9(r(i),n)},getKeys(){return n9(n)},clear(){return r9(n)}}},doe="WALLET_CONNECT_V2_INDEXED_DB",hoe="keyvaluestorage",b6=class{constructor(){this.indexedDb=XD({driver:foe({dbName:doe,storeName:hoe})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,ns(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},v6=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Qy={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof v6<"u"&&v6.localStorage?Qy.exports=v6.localStorage:typeof window<"u"&&window.localStorage?Qy.exports=window.localStorage:Qy.exports=new e})();w6=class{constructor(){this.localStorage=Qy.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(poe)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Ra(r)}async setItem(e,r){this.localStorage.setItem(e,ns(r))}async removeItem(e){this.localStorage.removeItem(e)}},goe="wc_storage_version",o9=1,moe=async(t,e,r)=>{let n=goe,i=await e.getItem(n);if(i&&i>=o9){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let c=s.shift();if(!c)continue;let a=c.toLowerCase();if(a.includes("wc@")||a.includes("walletconnect")||a.includes("wc_")||a.includes("wallet_connect")){let u=await t.getItem(c);await e.setItem(c,u),o.push(c)}}await e.setItem(n,o9),r(e),yoe(t,o)},yoe=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},A6=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new w6;this.storage=e;try{let r=new b6;moe(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var l9=L((y5e,u9)=>{"use strict";h();function voe(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}u9.exports=boe;function boe(t,e,r){var n=r&&r.stringify||voe,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var c=1;c-1?p:0,t.charCodeAt(I+1)){case 100:case 102:if(f>=a||e[f]==null)break;p=a||e[f]==null)break;p=a||e[f]===void 0)break;p",p=I+2,I++;break}u+=n(e[f]),p=I+2,I++;break;case 115:if(f>=a)break;p{"use strict";h();var f9=l9();p9.exports=Vs;var g0=Noe().console||{},woe={mapHttpRequest:Ky,mapHttpResponse:Ky,wrapRequestSerializer:E6,wrapResponseSerializer:E6,wrapErrorSerializer:E6,req:Ky,res:Ky,err:Toe};function Aoe(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Vs(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||g0;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=Aoe(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let c=t.level||"info",a=Object.create(r);a.log||(a.log=m0),Object.defineProperty(a,"levelVal",{get:f}),Object.defineProperty(a,"level",{get:p,set:S});let u={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:Ioe(t)};a.levels=Vs.levels,a.level=c,a.setMaxListeners=a.getMaxListeners=a.emit=a.addListener=a.on=a.prependListener=a.once=a.prependOnceListener=a.removeListener=a.removeAllListeners=a.listeners=a.listenerCount=a.eventNames=a.write=a.flush=m0,a.serializers=n,a._serialize=i,a._stdErrSerialize=s,a.child=I,e&&(a._logEvent=S6());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function S(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,bf(u,a,"error","log"),bf(u,a,"fatal","error"),bf(u,a,"warn","error"),bf(u,a,"info","log"),bf(u,a,"debug","log"),bf(u,a,"trace","log")}function I(N,R){if(!N)throw new Error("missing bindings for child Pino");R=R||{},i&&N.serializers&&(R.serializers=N.serializers);let D=R.serializers;if(i&&D){var U=Object.assign({},n,D),k=t.browser.serialize===!0?Object.keys(U):i;delete N.serializers,Wy([N],k,U,this._stdErrSerialize)}function z(H){this._childLevel=(H._childLevel|0)+1,this.error=wf(H,N,"error"),this.fatal=wf(H,N,"fatal"),this.warn=wf(H,N,"warn"),this.info=wf(H,N,"info"),this.debug=wf(H,N,"debug"),this.trace=wf(H,N,"trace"),U&&(this.serializers=U,this._serialize=k),e&&(this._logEvent=S6([].concat(H._logEvent.bindings,N)))}return z.prototype=this,new z(this)}return a}Vs.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"}};Vs.stdSerializers=woe;Vs.stdTimeFunctions=Object.assign({},{nullTime:d9,epochTime:h9,unixTime:Coe,isoTime:xoe});function bf(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?m0:i[r]?i[r]:g0[r]||g0[n]||m0,Eoe(t,e,r)}function Eoe(t,e,r){!t.transmit&&e[r]===m0||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===g0?g0:this;for(var a=0;a-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function wf(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;iZy,PINO_CUSTOM_CONTEXT_KEY:()=>Af,PINO_LOGGER_DEFAULTS:()=>v9,formatChildLoggerContext:()=>E9,generateChildLogger:()=>Loe,generateClientLogger:()=>S9,generatePlatformLogger:()=>Foe,generateServerLogger:()=>_9,getBrowserLoggerContext:()=>b9,getDefaultLoggerOptions:()=>Boe,getLoggerContext:()=>A9,pino:()=>y9.default,setBrowserLoggerContext:()=>w9});function Boe(t){return Xy(Jy({},t),{level:t?.level||v9.level})}function b9(t,e=Af){return t[e]||""}function w9(t,e,r=Af){return t[r]=e,t}function A9(t,e=Af){let r="";return typeof t.bindings>"u"?r=b9(t,e):r=t.bindings().context||"",r}function E9(t,e,r=Af){let n=A9(t,r);return n.trim()?`${n}/${e}`:e}function Loe(t,e,r=Af){let n=E9(t,e,r),i=t.child({context:n});return w9(i,n,r)}function S9(t){var e,r;let n=new I6((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Ro.default)(Xy(Jy({},t.opts),{level:"trace",browser:Xy(Jy({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function _9(t){var e;let r=new C6((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Ro.default)(Xy(Jy({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function Foe(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?S9(t):_9(t)}var Ro,y9,v9,Af,Zy,T6,$y,Yy,I6,C6,Ooe,Poe,Roe,g9,Moe,Doe,m9,Jy,Xy,N6=pe(()=>{h();Ro=ge(_6()),y9=ge(_6());vf();v9={level:"info"},Af="custom_context",Zy=1e3*1024,T6=class{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},$y=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let r=new T6(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};let r=e.value;return e=e.next,{done:!1,value:r}}}}},Yy=class{constructor(e,r=Zy){this.level=e??"error",this.levelValue=Ro.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new $y(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Ro.levels.values.error?console.error(e):r===Ro.levels.values.warn?console.warn(e):r===Ro.levels.values.debug?console.debug(e):r===Ro.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(ns({timestamp:new Date().toISOString(),log:e}));let r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new $y(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let r=this.getLogArray();return r.push(ns({extraMetadata:e})),new Blob(r,{type:"application/json"})}},I6=class{constructor(e,r=Zy){this.baseChunkLogger=new Yy(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){let r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},C6=class{constructor(e,r=Zy){this.baseChunkLogger=new Yy(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}},Ooe=Object.defineProperty,Poe=Object.defineProperties,Roe=Object.getOwnPropertyDescriptors,g9=Object.getOwnPropertySymbols,Moe=Object.prototype.hasOwnProperty,Doe=Object.prototype.propertyIsEnumerable,m9=(t,e,r)=>e in t?Ooe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jy=(t,e)=>{for(var r in e||(e={}))Moe.call(e,r)&&m9(t,r,e[r]);if(g9)for(var r of g9(e))Doe.call(e,r)&&m9(t,r,e[r]);return t},Xy=(t,e)=>Poe(t,Roe(e))});var $6=L(Tr=>{"use strict";h();Object.defineProperty(Tr,"__esModule",{value:!0});var Ef=(f6(),qe(UD)),T9=_o();function qoe(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var Uoe=qoe(T9),O6=class extends Ef.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},P6=class{constructor(e,r,n){this.core=e,this.logger=r}},R6=class extends Ef.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},M6=class{constructor(e,r){this.logger=e,this.core=r}},D6=class extends Ef.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},B6=class extends Ef.IEvents{constructor(e){super()}},L6=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},F6=class{constructor(){this.map=new Map}},q6=class extends Ef.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},U6=class{constructor(e,r){this.core=e,this.logger=r}},k6=class extends Ef.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},V6=class{constructor(e,r){this.logger=e,this.core=r}},H6=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},G6=class{constructor(e,r){this.projectId=e,this.logger=r}},z6=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},j6=class extends Uoe.default{constructor(){super()}},Q6=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},K6=class extends T9.EventEmitter{constructor(){super()}},W6=class{constructor(e){this.client=e}};Tr.ICore=O6,Tr.ICrypto=P6,Tr.IEchoClient=G6,Tr.IEngine=W6,Tr.IEngineEvents=K6,Tr.IEventClient=z6,Tr.IExpirer=k6,Tr.IJsonRpcHistory=R6,Tr.IKeyChain=U6,Tr.IMessageTracker=M6,Tr.IPairing=V6,Tr.IPublisher=D6,Tr.IRelayer=B6,Tr.ISignClient=Q6,Tr.ISignClientEvents=j6,Tr.IStore=L6,Tr.ISubscriber=q6,Tr.ISubscriberTopicMap=F6,Tr.IVerify=H6});var C9=L(ev=>{"use strict";h();Object.defineProperty(ev,"__esModule",{value:!0});ev.BrowserRandomSource=void 0;var I9=65536,Y6=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";h();Object.defineProperty(J6,"__esModule",{value:!0});function koe(t){for(var e=0;e{h()});var x9=L(tv=>{"use strict";h();Object.defineProperty(tv,"__esModule",{value:!0});tv.NodeRandomSource=void 0;var Voe=Ci(),Z6=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Mp<"u"){let e=X6();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";h();Object.defineProperty(rv,"__esModule",{value:!0});rv.SystemRandomSource=void 0;var Hoe=C9(),Goe=x9(),eT=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Hoe.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Goe.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)}};rv.SystemRandomSource=eT});var O9=L(Jn=>{"use strict";h();Object.defineProperty(Jn,"__esModule",{value:!0});function zoe(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}Jn.mul=Math.imul||zoe;function joe(t,e){return t+e|0}Jn.add=joe;function Qoe(t,e){return t-e|0}Jn.sub=Qoe;function Koe(t,e){return t<>>32-e}Jn.rotl=Koe;function Woe(t,e){return t<<32-e|t>>>e}Jn.rotr=Woe;function $oe(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Jn.isInteger=Number.isInteger||$oe;Jn.MAX_SAFE_INTEGER=9007199254740991;Jn.isSafeInteger=function(t){return Jn.isInteger(t)&&t>=-Jn.MAX_SAFE_INTEGER&&t<=Jn.MAX_SAFE_INTEGER}});var Sf=L(We=>{"use strict";h();Object.defineProperty(We,"__esModule",{value:!0});var P9=O9();function Yoe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}We.readInt16BE=Yoe;function Joe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}We.readUint16BE=Joe;function Xoe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}We.readInt16LE=Xoe;function Zoe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}We.readUint16LE=Zoe;function R9(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}We.writeUint16BE=R9;We.writeInt16BE=R9;function M9(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}We.writeUint16LE=M9;We.writeInt16LE=M9;function tT(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}We.readInt32BE=tT;function rT(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}We.readUint32BE=rT;function nT(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}We.readInt32LE=nT;function iT(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}We.readUint32LE=iT;function nv(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}We.writeUint32BE=nv;We.writeInt32BE=nv;function iv(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}We.writeUint32LE=iv;We.writeInt32LE=iv;function eae(t,e){e===void 0&&(e=0);var r=tT(t,e),n=tT(t,e+4);return r*4294967296+n-(n>>31)*4294967296}We.readInt64BE=eae;function tae(t,e){e===void 0&&(e=0);var r=rT(t,e),n=rT(t,e+4);return r*4294967296+n}We.readUint64BE=tae;function rae(t,e){e===void 0&&(e=0);var r=nT(t,e),n=nT(t,e+4);return n*4294967296+r-(r>>31)*4294967296}We.readInt64LE=rae;function nae(t,e){e===void 0&&(e=0);var r=iT(t,e),n=iT(t,e+4);return n*4294967296+r}We.readUint64LE=nae;function D9(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),nv(t/4294967296>>>0,e,r),nv(t>>>0,e,r+4),e}We.writeUint64BE=D9;We.writeInt64BE=D9;function B9(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),iv(t>>>0,e,r),iv(t/4294967296>>>0,e,r+4),e}We.writeUint64LE=B9;We.writeInt64LE=B9;function iae(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}We.readUintBE=iae;function sae(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}We.writeUintBE=oae;function aae(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!P9.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";h();Object.defineProperty(hn,"__esModule",{value:!0});hn.randomStringForEntropy=hn.randomString=hn.randomUint32=hn.randomBytes=hn.defaultRandomSource=void 0;var mae=N9(),yae=Sf(),L9=Ci();hn.defaultRandomSource=new mae.SystemRandomSource;function sT(t,e=hn.defaultRandomSource){return e.randomBytes(t)}hn.randomBytes=sT;function vae(t=hn.defaultRandomSource){let e=sT(4,t),r=(0,yae.readUint32LE)(e);return(0,L9.wipe)(e),r}hn.randomUint32=vae;var F9="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function q9(t,e=F9,r=hn.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=sT(Math.ceil(t*256/s),r);for(let c=0;c0;c++){let a=o[c];a{"use strict";h();Object.defineProperty(Mo,"__esModule",{value:!0});var Tf=Sf(),_f=Ci();Mo.DIGEST_LENGTH=64;Mo.BLOCK_SIZE=128;var k9=function(){function t(){this.digestLength=Mo.DIGEST_LENGTH,this.blockSize=Mo.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){_f.wipe(this._buffer),_f.wipe(this._tempHi),_f.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(oT(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=oT(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){_f.wipe(e.stateHi),_f.wipe(e.stateLo),e.buffer&&_f.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Mo.SHA512=k9;var U9=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 oT(t,e,r,n,i,s,o){for(var c=r[0],a=r[1],u=r[2],f=r[3],p=r[4],S=r[5],I=r[6],N=r[7],R=n[0],D=n[1],U=n[2],k=n[3],z=n[4],H=n[5],F=n[6],V=n[7],q,C,B,x,g,v,l,d;o>=128;){for(var m=0;m<16;m++){var w=8*m+s;t[m]=Tf.readUint32BE(i,w),e[m]=Tf.readUint32BE(i,w+4)}for(var m=0;m<80;m++){var _=c,A=a,y=u,T=f,E=p,M=S,W=I,Y=N,P=R,G=D,Q=U,$=k,ee=z,ie=H,X=F,re=V;if(q=N,C=V,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=(p>>>14|z<<18)^(p>>>18|z<<14)^(z>>>9|p<<23),C=(z>>>14|p<<18)^(z>>>18|p<<14)^(p>>>9|z<<23),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=p&S^~p&I,C=z&H^~z&F,g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=U9[m*2],C=U9[m*2+1],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=t[m%16],C=e[m%16],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,B=l&65535|d<<16,x=g&65535|v<<16,q=B,C=x,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=(c>>>28|R<<4)^(R>>>2|c<<30)^(R>>>7|c<<25),C=(R>>>28|c<<4)^(c>>>2|R<<30)^(c>>>7|R<<25),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=c&a^c&u^a&u,C=R&D^R&U^D&U,g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,Y=l&65535|d<<16,re=g&65535|v<<16,q=T,C=$,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=B,C=x,g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,T=l&65535|d<<16,$=g&65535|v<<16,a=_,u=A,f=y,p=T,S=E,I=M,N=W,c=Y,D=P,U=G,k=Q,z=$,H=ee,F=ie,V=X,R=re,m%16===15)for(var w=0;w<16;w++)q=t[w],C=e[w],g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=t[(w+9)%16],C=e[(w+9)%16],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,B=t[(w+1)%16],x=e[(w+1)%16],q=(B>>>1|x<<31)^(B>>>8|x<<24)^B>>>7,C=(x>>>1|B<<31)^(x>>>8|B<<24)^(x>>>7|B<<25),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,B=t[(w+14)%16],x=e[(w+14)%16],q=(B>>>19|x<<13)^(x>>>29|B<<3)^B>>>6,C=(x>>>19|B<<13)^(B>>>29|x<<3)^(x>>>6|B<<26),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,t[w]=l&65535|d<<16,e[w]=g&65535|v<<16}q=c,C=R,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[0],C=n[0],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[0]=c=l&65535|d<<16,n[0]=R=g&65535|v<<16,q=a,C=D,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[1],C=n[1],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[1]=a=l&65535|d<<16,n[1]=D=g&65535|v<<16,q=u,C=U,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[2],C=n[2],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[2]=u=l&65535|d<<16,n[2]=U=g&65535|v<<16,q=f,C=k,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[3],C=n[3],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[3]=f=l&65535|d<<16,n[3]=k=g&65535|v<<16,q=p,C=z,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[4],C=n[4],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[4]=p=l&65535|d<<16,n[4]=z=g&65535|v<<16,q=S,C=H,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[5],C=n[5],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[5]=S=l&65535|d<<16,n[5]=H=g&65535|v<<16,q=I,C=F,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[6],C=n[6],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[6]=I=l&65535|d<<16,n[6]=F=g&65535|v<<16,q=N,C=V,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[7],C=n[7],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[7]=N=l&65535|d<<16,n[7]=V=g&65535|v<<16,s+=128,o-=128}return s}function wae(t){var e=new k9;e.update(t);var r=e.digest();return e.clean(),r}Mo.hash=wae});var tB=L(kt=>{"use strict";h();Object.defineProperty(kt,"__esModule",{value:!0});kt.convertSecretKeyToX25519=kt.convertPublicKeyToX25519=kt.verify=kt.sign=kt.extractPublicKeyFromSecretKey=kt.generateKeyPair=kt.generateKeyPairFromSeed=kt.SEED_LENGTH=kt.SECRET_KEY_LENGTH=kt.PUBLIC_KEY_LENGTH=kt.SIGNATURE_LENGTH=void 0;var Aae=y0(),v0=V9(),Q9=Ci();kt.SIGNATURE_LENGTH=64;kt.PUBLIC_KEY_LENGTH=32;kt.SECRET_KEY_LENGTH=64;kt.SEED_LENGTH=32;function Ae(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,K9(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function W9(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function z9(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return b0(r,t),b0(n,e),W9(r,n)}function $9(t){let e=new Uint8Array(32);return b0(e,t),e[0]&1}function Iae(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Xc(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function eu(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $t(t,e,r){let n,i,s=0,o=0,c=0,a=0,u=0,f=0,p=0,S=0,I=0,N=0,R=0,D=0,U=0,k=0,z=0,H=0,F=0,V=0,q=0,C=0,B=0,x=0,g=0,v=0,l=0,d=0,m=0,w=0,_=0,A=0,y=0,T=r[0],E=r[1],M=r[2],W=r[3],Y=r[4],P=r[5],G=r[6],Q=r[7],$=r[8],ee=r[9],ie=r[10],X=r[11],re=r[12],ae=r[13],Z=r[14],oe=r[15];n=e[0],s+=n*T,o+=n*E,c+=n*M,a+=n*W,u+=n*Y,f+=n*P,p+=n*G,S+=n*Q,I+=n*$,N+=n*ee,R+=n*ie,D+=n*X,U+=n*re,k+=n*ae,z+=n*Z,H+=n*oe,n=e[1],o+=n*T,c+=n*E,a+=n*M,u+=n*W,f+=n*Y,p+=n*P,S+=n*G,I+=n*Q,N+=n*$,R+=n*ee,D+=n*ie,U+=n*X,k+=n*re,z+=n*ae,H+=n*Z,F+=n*oe,n=e[2],c+=n*T,a+=n*E,u+=n*M,f+=n*W,p+=n*Y,S+=n*P,I+=n*G,N+=n*Q,R+=n*$,D+=n*ee,U+=n*ie,k+=n*X,z+=n*re,H+=n*ae,F+=n*Z,V+=n*oe,n=e[3],a+=n*T,u+=n*E,f+=n*M,p+=n*W,S+=n*Y,I+=n*P,N+=n*G,R+=n*Q,D+=n*$,U+=n*ee,k+=n*ie,z+=n*X,H+=n*re,F+=n*ae,V+=n*Z,q+=n*oe,n=e[4],u+=n*T,f+=n*E,p+=n*M,S+=n*W,I+=n*Y,N+=n*P,R+=n*G,D+=n*Q,U+=n*$,k+=n*ee,z+=n*ie,H+=n*X,F+=n*re,V+=n*ae,q+=n*Z,C+=n*oe,n=e[5],f+=n*T,p+=n*E,S+=n*M,I+=n*W,N+=n*Y,R+=n*P,D+=n*G,U+=n*Q,k+=n*$,z+=n*ee,H+=n*ie,F+=n*X,V+=n*re,q+=n*ae,C+=n*Z,B+=n*oe,n=e[6],p+=n*T,S+=n*E,I+=n*M,N+=n*W,R+=n*Y,D+=n*P,U+=n*G,k+=n*Q,z+=n*$,H+=n*ee,F+=n*ie,V+=n*X,q+=n*re,C+=n*ae,B+=n*Z,x+=n*oe,n=e[7],S+=n*T,I+=n*E,N+=n*M,R+=n*W,D+=n*Y,U+=n*P,k+=n*G,z+=n*Q,H+=n*$,F+=n*ee,V+=n*ie,q+=n*X,C+=n*re,B+=n*ae,x+=n*Z,g+=n*oe,n=e[8],I+=n*T,N+=n*E,R+=n*M,D+=n*W,U+=n*Y,k+=n*P,z+=n*G,H+=n*Q,F+=n*$,V+=n*ee,q+=n*ie,C+=n*X,B+=n*re,x+=n*ae,g+=n*Z,v+=n*oe,n=e[9],N+=n*T,R+=n*E,D+=n*M,U+=n*W,k+=n*Y,z+=n*P,H+=n*G,F+=n*Q,V+=n*$,q+=n*ee,C+=n*ie,B+=n*X,x+=n*re,g+=n*ae,v+=n*Z,l+=n*oe,n=e[10],R+=n*T,D+=n*E,U+=n*M,k+=n*W,z+=n*Y,H+=n*P,F+=n*G,V+=n*Q,q+=n*$,C+=n*ee,B+=n*ie,x+=n*X,g+=n*re,v+=n*ae,l+=n*Z,d+=n*oe,n=e[11],D+=n*T,U+=n*E,k+=n*M,z+=n*W,H+=n*Y,F+=n*P,V+=n*G,q+=n*Q,C+=n*$,B+=n*ee,x+=n*ie,g+=n*X,v+=n*re,l+=n*ae,d+=n*Z,m+=n*oe,n=e[12],U+=n*T,k+=n*E,z+=n*M,H+=n*W,F+=n*Y,V+=n*P,q+=n*G,C+=n*Q,B+=n*$,x+=n*ee,g+=n*ie,v+=n*X,l+=n*re,d+=n*ae,m+=n*Z,w+=n*oe,n=e[13],k+=n*T,z+=n*E,H+=n*M,F+=n*W,V+=n*Y,q+=n*P,C+=n*G,B+=n*Q,x+=n*$,g+=n*ee,v+=n*ie,l+=n*X,d+=n*re,m+=n*ae,w+=n*Z,_+=n*oe,n=e[14],z+=n*T,H+=n*E,F+=n*M,V+=n*W,q+=n*Y,C+=n*P,B+=n*G,x+=n*Q,g+=n*$,v+=n*ee,l+=n*ie,d+=n*X,m+=n*re,w+=n*ae,_+=n*Z,A+=n*oe,n=e[15],H+=n*T,F+=n*E,V+=n*M,q+=n*W,C+=n*Y,B+=n*P,x+=n*G,g+=n*Q,v+=n*$,l+=n*ee,d+=n*ie,m+=n*X,w+=n*re,_+=n*ae,A+=n*Z,y+=n*oe,s+=38*F,o+=38*V,c+=38*q,a+=38*C,u+=38*B,f+=38*x,p+=38*g,S+=38*v,I+=38*l,N+=38*d,R+=38*m,D+=38*w,U+=38*_,k+=38*A,z+=38*y,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=c,t[3]=a,t[4]=u,t[5]=f,t[6]=p,t[7]=S,t[8]=I,t[9]=N,t[10]=R,t[11]=D,t[12]=U,t[13]=k,t[14]=z,t[15]=H}function Zc(t,e){$t(t,e,e)}function Y9(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Zc(r,r),n!==2&&n!==4&&$t(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function Cae(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Zc(r,r),n!==1&&$t(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function lT(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),c=Ae(),a=Ae(),u=Ae(),f=Ae();eu(r,t[1],t[0]),eu(f,e[1],e[0]),$t(r,r,f),Xc(n,t[0],t[1]),Xc(f,e[0],e[1]),$t(n,n,f),$t(i,t[3],e[3]),$t(i,i,_ae),$t(s,t[2],e[2]),Xc(s,s,s),eu(o,n,r),eu(c,s,i),Xc(a,s,i),Xc(u,n,r),$t(t[0],o,c),$t(t[1],u,a),$t(t[2],a,c),$t(t[3],o,u)}function j9(t,e,r){for(let n=0;n<4;n++)K9(t[n],e[n],r)}function dT(t,e){let r=Ae(),n=Ae(),i=Ae();Y9(i,e[2]),$t(r,e[0],i),$t(n,e[1],i),b0(t,n),t[31]^=$9(r)<<7}function J9(t,e,r){Ma(t[0],uT),Ma(t[1],If),Ma(t[2],If),Ma(t[3],uT);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;j9(t,e,i),lT(e,t),lT(t,t),j9(t,e,i)}}function hT(t,e){let r=[Ae(),Ae(),Ae(),Ae()];Ma(r[0],H9),Ma(r[1],G9),Ma(r[2],If),$t(r[3],H9,G9),J9(t,r,e)}function X9(t){if(t.length!==kt.SEED_LENGTH)throw new Error(`ed25519: seed must be ${kt.SEED_LENGTH} bytes`);let e=(0,v0.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ae(),Ae(),Ae(),Ae()];hT(n,e),dT(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}kt.generateKeyPairFromSeed=X9;function xae(t){let e=(0,Aae.randomBytes)(32,t),r=X9(e);return(0,Q9.wipe)(e),r}kt.generateKeyPair=xae;function Nae(t){if(t.length!==kt.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${kt.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}kt.extractPublicKeyFromSecretKey=Nae;var cT=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 Z9(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*cT[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*cT[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function fT(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;Z9(t,e)}function Oae(t,e){let r=new Float64Array(64),n=[Ae(),Ae(),Ae(),Ae()],i=(0,v0.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new v0.SHA512;o.update(s.subarray(32)),o.update(e);let c=o.digest();o.clean(),fT(c),hT(n,c),dT(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let a=o.digest();fT(a);for(let u=0;u<32;u++)r[u]=c[u];for(let u=0;u<32;u++)for(let f=0;f<32;f++)r[u+f]+=a[u]*i[f];return Z9(s.subarray(32),r),s}kt.sign=Oae;function eB(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),c=Ae(),a=Ae();return Ma(t[2],If),Iae(t[1],e),Zc(i,t[1]),$t(s,i,Sae),eu(i,i,t[2]),Xc(s,t[2],s),Zc(o,s),Zc(c,o),$t(a,c,o),$t(r,a,i),$t(r,r,s),Cae(r,r),$t(r,r,i),$t(r,r,s),$t(r,r,s),$t(t[0],r,s),Zc(n,t[0]),$t(n,n,s),z9(n,i)&&$t(t[0],t[0],Tae),Zc(n,t[0]),$t(n,n,s),z9(n,i)?-1:($9(t[0])===e[31]>>7&&eu(t[0],uT,t[0]),$t(t[3],t[0],t[1]),0)}function Pae(t,e,r){let n=new Uint8Array(32),i=[Ae(),Ae(),Ae(),Ae()],s=[Ae(),Ae(),Ae(),Ae()];if(r.length!==kt.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${kt.SIGNATURE_LENGTH} bytes`);if(eB(s,t))return!1;let o=new v0.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let c=o.digest();return fT(c),J9(i,s,c),hT(s,r.subarray(32)),lT(i,s),dT(n,i),!W9(r,n)}kt.verify=Pae;function Rae(t){let e=[Ae(),Ae(),Ae(),Ae()];if(eB(e,t))throw new Error("Ed25519: invalid public key");let r=Ae(),n=Ae(),i=e[1];Xc(r,If,i),eu(n,If,i),Y9(n,n),$t(r,r,n);let s=new Uint8Array(32);return b0(s,r),s}kt.convertPublicKeyToX25519=Rae;function Mae(t){let e=(0,v0.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,Q9.wipe)(e),r}kt.convertSecretKeyToX25519=Mae});var sv,ov,tu,Cf,av,w0,cv,uv,lv,xf,fv,dv,rB,nB,hv=pe(()=>{h();sv="EdDSA",ov="JWT",tu=".",Cf="base64url",av="utf8",w0="utf8",cv=":",uv="did",lv="key",xf="base58btc",fv="z",dv="K36",rB=32,nB=32});function Nf(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}var pv=pe(()=>{h()});function gv(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Nf(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var pT=pe(()=>{h();pv()});function Dae(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,H=new Uint8Array(z);U!==k;){for(var F=N[U],V=0,q=z-1;(F!==0||V>>0,H[q]=F%c>>>0,F=F/c>>>0;if(F!==0)throw new Error("Non-zero carry");D=V,U++}for(var C=z-D;C!==z&&H[C]===0;)C++;for(var B=a.repeat(R);C>>0,z=new Uint8Array(k);N[R];){var H=r[N.charCodeAt(R)];if(H===255)return;for(var F=0,V=k-1;(H!==0||F>>0,z[V]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");U=F,R++}if(N[R]!==" "){for(var q=k-U;q!==k&&z[q]===0;)q++;for(var C=new Uint8Array(D+(k-q)),B=D;q!==k;)C[B++]=z[q++];return C}}}function I(N){var R=S(N);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:S,decode:I}}var Bae,Lae,iB,sB=pe(()=>{h();Bae=Dae,Lae=Bae,iB=Lae});var rCe,oB,Do,aB,cB,Da=pe(()=>{h();rCe=new Uint8Array(0),oB=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aB=t=>new TextEncoder().encode(t),cB=t=>new TextDecoder().decode(t)});var gT,mT,yT,lB,vT,Of,Ba,Fae,qae,gr,is=pe(()=>{h();sB();Da();gT=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},mT=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return lB(this,e)}},yT=class{constructor(e){this.decoders=e}or(e){return lB(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},lB=(t,e)=>new yT({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),vT=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new gT(e,r,n),this.decoder=new mT(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Of=({name:t,prefix:e,encode:r,decode:n})=>new vT(t,e,r,n),Ba=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=iB(r,e);return Of({prefix:t,name:e,encode:n,decode:s=>Do(i(s))})},Fae=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(c-=8,o[u++]=255&a>>c)}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return o},qae=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&c>>o];if(o&&(s+=e[i&c<Of({prefix:e,name:t,encode(i){return qae(i,n,r)},decode(i){return Fae(i,n,r,t)}})});var bT={};Zt(bT,{identity:()=>Uae});var Uae,fB=pe(()=>{h();is();Da();Uae=Of({prefix:"\0",name:"identity",encode:t=>cB(t),decode:t=>aB(t)})});var wT={};Zt(wT,{base2:()=>kae});var kae,dB=pe(()=>{h();is();kae=gr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var AT={};Zt(AT,{base8:()=>Vae});var Vae,hB=pe(()=>{h();is();Vae=gr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var ET={};Zt(ET,{base10:()=>Hae});var Hae,pB=pe(()=>{h();is();Hae=Ba({prefix:"9",name:"base10",alphabet:"0123456789"})});var ST={};Zt(ST,{base16:()=>Gae,base16upper:()=>zae});var Gae,zae,gB=pe(()=>{h();is();Gae=gr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),zae=gr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var _T={};Zt(_T,{base32:()=>Pf,base32hex:()=>Wae,base32hexpad:()=>Yae,base32hexpadupper:()=>Jae,base32hexupper:()=>$ae,base32pad:()=>Qae,base32padupper:()=>Kae,base32upper:()=>jae,base32z:()=>Xae});var Pf,jae,Qae,Kae,Wae,$ae,Yae,Jae,Xae,TT=pe(()=>{h();is();Pf=gr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),jae=gr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Qae=gr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Kae=gr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Wae=gr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$ae=gr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Yae=gr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Jae=gr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Xae=gr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var IT={};Zt(IT,{base36:()=>Zae,base36upper:()=>ece});var Zae,ece,mB=pe(()=>{h();is();Zae=Ba({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ece=Ba({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var CT={};Zt(CT,{base58btc:()=>Hs,base58flickr:()=>tce});var Hs,tce,xT=pe(()=>{h();is();Hs=Ba({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),tce=Ba({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var NT={};Zt(NT,{base64:()=>rce,base64pad:()=>nce,base64url:()=>ice,base64urlpad:()=>sce});var rce,nce,ice,sce,yB=pe(()=>{h();is();rce=gr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),nce=gr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ice=gr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),sce=gr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var OT={};Zt(OT,{base256emoji:()=>lce});function cce(t){return t.reduce((e,r)=>(e+=oce[r],e),"")}function uce(t){let e=[];for(let r of t){let n=ace[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var vB,oce,ace,lce,bB=pe(()=>{h();is();vB=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}"),oce=vB.reduce((t,e,r)=>(t[r]=e,t),[]),ace=vB.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);lce=Of({prefix:"\u{1F680}",name:"base256emoji",encode:cce,decode:uce})});function EB(t,e,r){e=e||[],r=r||0;for(var n=r;t>=pce;)e[r++]=t&255|wB,t/=128;for(;t&hce;)e[r++]=t&255|wB,t>>>=7;return e[r]=t|0,EB.bytes=r-n+1,e}function PT(t,n){var r=0,n=n||0,i=0,s=n,o,c=t.length;do{if(s>=c)throw PT.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&AB)<=mce);return PT.bytes=s-n,r}var fce,wB,dce,hce,pce,gce,mce,AB,yce,vce,bce,wce,Ace,Ece,Sce,_ce,Tce,Ice,Cce,xce,A0,SB=pe(()=>{h();fce=EB,wB=128,dce=127,hce=~dce,pce=Math.pow(2,31);gce=PT,mce=128,AB=127;yce=Math.pow(2,7),vce=Math.pow(2,14),bce=Math.pow(2,21),wce=Math.pow(2,28),Ace=Math.pow(2,35),Ece=Math.pow(2,42),Sce=Math.pow(2,49),_ce=Math.pow(2,56),Tce=Math.pow(2,63),Ice=function(t){return t{h();SB();E0=(t,e=0)=>[A0.decode(t,e),A0.decode.bytes],Rf=(t,e,r=0)=>(A0.encode(t,e,r),e),Mf=t=>A0.encodingLength(t)});var ru,_B,TB,Df,_0=pe(()=>{h();Da();yv();ru=(t,e)=>{let r=e.byteLength,n=Mf(t),i=n+Mf(r),s=new Uint8Array(i+r);return Rf(t,s,0),Rf(r,s,n),s.set(e,i),new Df(t,r,e,s)},_B=t=>{let e=Do(t),[r,n]=E0(e),[i,s]=E0(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Df(r,i,o,e)},TB=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&oB(t.bytes,e.bytes),Df=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var MT,RT,DT=pe(()=>{h();_0();MT=({name:t,code:e,encode:r})=>new RT(t,e,r),RT=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ru(this.code,r):r.then(n=>ru(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var BT={};Zt(BT,{sha256:()=>Nce,sha512:()=>Oce});var CB,Nce,Oce,xB=pe(()=>{h();DT();CB=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Nce=MT({name:"sha2-256",code:18,encode:CB("SHA-256")}),Oce=MT({name:"sha2-512",code:19,encode:CB("SHA-512")})});var LT={};Zt(LT,{identity:()=>Mce});var NB,Pce,OB,Rce,Mce,PB=pe(()=>{h();Da();_0();NB=0,Pce="identity",OB=Do,Rce=t=>ru(NB,OB(t)),Mce={code:NB,name:Pce,encode:OB,digest:Rce}});var RB=pe(()=>{h();Da()});var HCe,GCe,MB=pe(()=>{h();HCe=new TextEncoder,GCe=new TextDecoder});var wv,Lce,Fce,qce,T0,Uce,DB,BB,vv,bv,kce,Vce,Hce,LB=pe(()=>{h();yv();_0();xT();TT();Da();wv=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:bv,byteLength:bv,code:vv,version:vv,multihash:vv,bytes:vv,_baseCache:bv,asCID:bv})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==T0)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Uce)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ru(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&TB(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return Fce(r,i,e||Hs.encoder);default:return qce(r,i,e||Pf.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 Vce(/^0\.0/,Hce),!!(e&&(e[BB]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||DB(r,n,i.bytes))}else if(e!=null&&e[BB]===!0){let{version:r,multihash:n,code:i}=e,s=_B(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==T0)throw new Error(`Version 0 CID must use dag-pb (code: ${T0}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=DB(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,T0,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Do(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Df(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[p,S]=E0(e.subarray(r));return r+=S,p},i=n(),s=T0;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,c=n(),a=n(),u=r+a,f=u-o;return{version:i,codec:s,multihashCode:c,digestSize:a,multihashSize:f,size:u}}static parse(e,r){let[n,i]=Lce(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Lce=(t,e)=>{switch(t[0]){case"Q":{let r=e||Hs;return[Hs.prefix,r.decode(`${Hs.prefix}${t}`)]}case Hs.prefix:{let r=e||Hs;return[Hs.prefix,r.decode(t)]}case Pf.prefix:{let r=e||Pf;return[Pf.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Fce=(t,e,r)=>{let{prefix:n}=r;if(n!==Hs.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},qce=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},T0=112,Uce=18,DB=(t,e,r)=>{let n=Mf(t),i=n+Mf(e),s=new Uint8Array(i+r.byteLength);return Rf(t,s,0),Rf(e,s,n),s.set(r,i),s},BB=Symbol.for("@ipld/js-cid/CID"),vv={writable:!1,configurable:!1,enumerable:!0},bv={writable:!1,enumerable:!1,configurable:!1},kce="0.0.0-dev",Vce=(t,e)=>{if(t.test(kce))console.warn(e);else throw new Error(e)},Hce=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -34,31 +39,26 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var ZR=de(()=>{h();XR();_m();Bo();PI();Sh()});var MI,Obe,eB=de(()=>{h();CR();NR();xR();OR();DR();SI();PR();TI();RR();MR();jR();KR();WR();$R();ZR();MI={...yI,...wI,...vI,...AI,...EI,...bI,...II,..._I,...CI,...NI},Obe={...RI,...BI}});function rB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var tB,LI,UZ,xm,FI=de(()=>{h();eB();bm();tB=rB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),LI=rB("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=zc(t.length);for(let r=0;r{h();FI()});function ns(t,e="utf8"){let r=xm[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}var qI=de(()=>{h();FI()});function _h(t){return Po(Vs(ns(t,Gc),pm))}function Th(t){return Vs(ns(Si(t),pm),Gc)}function VI(t){let e=ns(Am,jc),r=vm+Vs(Sm([e,t]),jc);return[ym,wm,r].join(mm)}function kI(t){let[e,r,n]=t.split(mm);if(e!==ym||r!==wm)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==vm)throw new Error("Issuer must be a key in mulicodec format");let s=ns(n.slice(1),jc);if(Vs(s.slice(0,2),jc)!==Am)throw new Error('Issuer must be a public key with type "Ed25519"');let u=s.slice(2);if(u.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return u}function nB(t){return Vs(t,Gc)}function iB(t){return ns(t,Gc)}function HI(t){return ns([Th(t.header),Th(t.payload)].join(Ka),vh)}function qZ(t){let e=Vs(t,vh).split(Ka),r=_h(e[0]),n=_h(e[1]);return{header:r,payload:n}}function GI(t){return[Th(t.header),Th(t.payload),nB(t.signature)].join(Ka)}function jI(t){let e=t.split(Ka),r=_h(e[0]),n=_h(e[1]),i=iB(e[2]),s=ns(e.slice(0,2).join(Ka),vh);return{header:r,payload:n,signature:i,data:s}}var zI=de(()=>{h();hI();UI();qI();Nc();Em()});function VZ(t=(0,sB.randomBytes)(32)){return Jc.generateKeyPairFromSeed(t)}async function kZ(t,e,r,n,i=(0,oB.fromMiliseconds)(Date.now())){let s={alg:dm,typ:gm},o=VI(n.publicKey),u=i+r,a={iss:o,sub:t,aud:e,iat:i,exp:u},c=HI({header:s,payload:a}),f=Jc.sign(n.secretKey,c);return GI({header:s,payload:a,signature:f})}async function HZ(t){let{header:e,payload:r,data:n,signature:i}=jI(t);if(e.alg!==dm||e.typ!==gm)throw new Error("JWT must use EdDSA algorithm");let s=kI(r.iss);return Jc.verify(s,n,i)}var Jc,sB,oB,aB=de(()=>{h();Jc=ge(yR()),sB=ge(mh()),oB=ge(Bc());Em();zI()});var uB=de(()=>{h()});var cB={};Ot(cB,{DATA_ENCODING:()=>vh,DID_DELIMITER:()=>mm,DID_METHOD:()=>wm,DID_PREFIX:()=>ym,JSON_ENCODING:()=>pm,JWT_DELIMITER:()=>Ka,JWT_ENCODING:()=>Gc,JWT_IRIDIUM_ALG:()=>dm,JWT_IRIDIUM_TYP:()=>gm,KEY_PAIR_SEED_LENGTH:()=>vR,MULTICODEC_ED25519_BASE:()=>vm,MULTICODEC_ED25519_ENCODING:()=>jc,MULTICODEC_ED25519_HEADER:()=>Am,MULTICODEC_ED25519_LENGTH:()=>wR,decodeData:()=>qZ,decodeIss:()=>kI,decodeJSON:()=>_h,decodeJWT:()=>jI,decodeSig:()=>iB,encodeData:()=>HI,encodeIss:()=>VI,encodeJSON:()=>Th,encodeJWT:()=>GI,encodeSig:()=>nB,generateKeyPair:()=>VZ,signJWT:()=>kZ,verifyJWT:()=>HZ});var lB=de(()=>{h();aB();Em();uB();zI()});var bB=D(qt=>{"use strict";h();var fB=qt&&qt.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new wB:typeof navigator<"u"?QI(navigator.userAgent):EB()}qt.detect=QZ;function vB(t){return t!==""&&zZ.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KZ(t){var e=vB(t);return e?e[0]:null}qt.browserName=KZ;function QI(t){var e=vB(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new yB;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";h();Object.defineProperty(Rt,"__esModule",{value:!0});Rt.getLocalStorage=Rt.getLocalStorageOrThrow=Rt.getCrypto=Rt.getCryptoOrThrow=Rt.getLocation=Rt.getLocationOrThrow=Rt.getNavigator=Rt.getNavigatorOrThrow=Rt.getDocument=Rt.getDocumentOrThrow=Rt.getFromWindowOrThrow=Rt.getFromWindow=void 0;function $a(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Rt.getFromWindow=$a;function Xc(t){let e=$a(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Rt.getFromWindowOrThrow=Xc;function $Z(){return Xc("document")}Rt.getDocumentOrThrow=$Z;function YZ(){return $a("document")}Rt.getDocument=YZ;function JZ(){return Xc("navigator")}Rt.getNavigatorOrThrow=JZ;function XZ(){return $a("navigator")}Rt.getNavigator=XZ;function ZZ(){return Xc("location")}Rt.getLocationOrThrow=ZZ;function eee(){return $a("location")}Rt.getLocation=eee;function tee(){return Xc("crypto")}Rt.getCryptoOrThrow=tee;function ree(){return $a("crypto")}Rt.getCrypto=ree;function nee(){return Xc("localStorage")}Rt.getLocalStorageOrThrow=nee;function iee(){return $a("localStorage")}Rt.getLocalStorage=iee});var IB=D(Om=>{"use strict";h();Object.defineProperty(Om,"__esModule",{value:!0});Om.getWindowMetadata=void 0;var SB=KI();function see(){let t,e;try{t=SB.getDocumentOrThrow(),e=SB.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),w=[];for(let A=0;A-1){let P=_.getAttribute("href");if(P)if(P.toLowerCase().indexOf("https:")===-1&&P.toLowerCase().indexOf("http:")===-1&&P.indexOf("//")!==0){let V=e.protocol+"//"+e.host;if(P.indexOf("/")===0)V+=P;else{let U=e.pathname.split("/");U.pop();let Q=U.join("/");V+=Q+"/"+P}w.push(V)}else if(P.indexOf("//")===0){let V=e.protocol+P;w.push(V)}else w.push(P)}}return w}function n(...d){let w=t.getElementsByTagName("meta");for(let A=0;A_.getAttribute(P)).filter(P=>P?d.includes(P):!1);if(N.length&&N){let P=_.getAttribute("content");if(P)return P}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),u=s(),a=e.origin,c=r();return{description:u,url:a,icons:c,name:o}}Om.getWindowMetadata=see});var TB=D((hSe,_B)=>{"use strict";h();_B.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var DB=D((gSe,OB)=>{"use strict";h();var xB="%[a-f0-9]{2}",CB=new RegExp("("+xB+")|([^%]+?)","gi"),NB=new RegExp("("+xB+")+","gi");function WI(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],WI(r),WI(n))}function oee(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(CB)||[],r=1;r{"use strict";h();PB.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var MB=D((wSe,BB)=>{"use strict";h();BB.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";h();var uee=TB(),cee=DB(),FB=RB(),lee=MB(),fee=t=>t==null,$I=Symbol("encodeFragmentIdentifier");function hee(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[er(e,t),"[",i,"]"].join("")]:[...r,[er(e,t),"[",er(i,t),"]=",er(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[er(e,t),"[]"].join("")]:[...r,[er(e,t),"[]=",er(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[er(e,t),":list="].join("")]:[...r,[er(e,t),":list=",er(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[er(r,t),e,er(i,t)].join("")]:[[n,er(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,er(e,t)]:[...r,[er(e,t),"=",er(n,t)].join("")]}}function dee(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&ks(n,t).includes(t.arrayFormatSeparator);n=o?ks(n,t):n;let u=s||o?n.split(t.arrayFormatSeparator).map(a=>ks(a,t)):n===null?n:ks(n,t);i[r]=u};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ks(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(u=>ks(u,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function UB(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function er(t,e){return e.encode?e.strict?uee(t):encodeURIComponent(t):t}function ks(t,e){return e.decode?cee(t):t}function qB(t){return Array.isArray(t)?t.sort():typeof t=="object"?qB(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function VB(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function gee(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function kB(t){t=VB(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function LB(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function HB(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),UB(e.arrayFormatSeparator);let r=dee(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=FB(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ks(o,e),r(ks(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=LB(s[o],e);else n[i]=LB(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=qB(o):i[s]=o,i},Object.create(null))}sn.extract=kB;sn.parse=HB;sn.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),UB(e.arrayFormatSeparator);let r=o=>e.skipNull&&fee(t[o])||e.skipEmptyString&&t[o]==="",n=hee(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let u=t[o];return u===void 0?"":u===null?er(o,e):Array.isArray(u)?u.length===0&&e.arrayFormat==="bracket-separator"?er(o,e)+"[]":u.reduce(n(o),[]).join("&"):er(o,e)+"="+er(u,e)}).filter(o=>o.length>0).join("&")};sn.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=FB(t,"#");return Object.assign({url:r.split("?")[0]||"",query:HB(kB(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ks(n,e)}:{})};sn.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[$I]:!0},e);let r=VB(t.url).split("?")[0]||"",n=sn.extract(t.url),i=sn.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=sn.stringify(s,e);o&&(o=`?${o}`);let u=gee(t.url);return t.fragmentIdentifier&&(u=`#${e[$I]?er(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${u}`};sn.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[$I]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=sn.parseUrl(t,r);return sn.stringifyUrl({url:n,query:lee(i,e),fragmentIdentifier:s},r)};sn.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return sn.pick(t,n,r)}});var zB=D(Dm=>{"use strict";h();Object.defineProperty(Dm,"__esModule",{value:!0});var Lr=qc(),YI=Wn(),pee=20;function mee(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,u=r[3]<<24|r[2]<<16|r[1]<<8|r[0],a=r[7]<<24|r[6]<<16|r[5]<<8|r[4],c=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],w=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],_=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],P=e[7]<<24|e[6]<<16|e[5]<<8|e[4],V=e[11]<<24|e[10]<<16|e[9]<<8|e[8],U=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Q=n,L=i,k=s,H=o,q=u,v=a,C=c,R=f,F=d,B=w,l=A,g=_,y=N,E=P,I=V,T=U,M=0;M>>16|y<<16,F=F+y|0,q^=F,q=q>>>20|q<<12,L=L+v|0,E^=L,E=E>>>16|E<<16,B=B+E|0,v^=B,v=v>>>20|v<<12,k=k+C|0,I^=k,I=I>>>16|I<<16,l=l+I|0,C^=l,C=C>>>20|C<<12,H=H+R|0,T^=H,T=T>>>16|T<<16,g=g+T|0,R^=g,R=R>>>20|R<<12,k=k+C|0,I^=k,I=I>>>24|I<<8,l=l+I|0,C^=l,C=C>>>25|C<<7,H=H+R|0,T^=H,T=T>>>24|T<<8,g=g+T|0,R^=g,R=R>>>25|R<<7,L=L+v|0,E^=L,E=E>>>24|E<<8,B=B+E|0,v^=B,v=v>>>25|v<<7,Q=Q+q|0,y^=Q,y=y>>>24|y<<8,F=F+y|0,q^=F,q=q>>>25|q<<7,Q=Q+v|0,T^=Q,T=T>>>16|T<<16,l=l+T|0,v^=l,v=v>>>20|v<<12,L=L+C|0,y^=L,y=y>>>16|y<<16,g=g+y|0,C^=g,C=C>>>20|C<<12,k=k+R|0,E^=k,E=E>>>16|E<<16,F=F+E|0,R^=F,R=R>>>20|R<<12,H=H+q|0,I^=H,I=I>>>16|I<<16,B=B+I|0,q^=B,q=q>>>20|q<<12,k=k+R|0,E^=k,E=E>>>24|E<<8,F=F+E|0,R^=F,R=R>>>25|R<<7,H=H+q|0,I^=H,I=I>>>24|I<<8,B=B+I|0,q^=B,q=q>>>25|q<<7,L=L+C|0,y^=L,y=y>>>24|y<<8,g=g+y|0,C^=g,C=C>>>25|C<<7,Q=Q+v|0,T^=Q,T=T>>>24|T<<8,l=l+T|0,v^=l,v=v>>>25|v<<7;Lr.writeUint32LE(Q+n|0,t,0),Lr.writeUint32LE(L+i|0,t,4),Lr.writeUint32LE(k+s|0,t,8),Lr.writeUint32LE(H+o|0,t,12),Lr.writeUint32LE(q+u|0,t,16),Lr.writeUint32LE(v+a|0,t,20),Lr.writeUint32LE(C+c|0,t,24),Lr.writeUint32LE(R+f|0,t,28),Lr.writeUint32LE(F+d|0,t,32),Lr.writeUint32LE(B+w|0,t,36),Lr.writeUint32LE(l+A|0,t,40),Lr.writeUint32LE(g+_|0,t,44),Lr.writeUint32LE(y+N|0,t,48),Lr.writeUint32LE(E+P|0,t,52),Lr.writeUint32LE(I+V|0,t,56),Lr.writeUint32LE(T+U|0,t,60)}function jB(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var Pm=D(Zc=>{"use strict";h();Object.defineProperty(Zc,"__esModule",{value:!0});function vee(t,e,r){return~(t-1)&e|t-1&r}Zc.select=vee;function Aee(t,e){return(t|0)-(e|0)-1>>>31&1}Zc.lessOrEqual=Aee;function QB(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Zc.compare=QB;function Eee(t,e){return t.length===0||e.length===0?!1:QB(t,e)!==0}Zc.equal=Eee});var WB=D(Hs=>{"use strict";h();Object.defineProperty(Hs,"__esModule",{value:!0});var bee=Pm(),Rm=Wn();Hs.DIGEST_LENGTH=16;var KB=function(){function t(e){this.digestLength=Hs.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var u=e[10]|e[11]<<8;this._r[6]=(o>>>14|u<<2)&8191;var a=e[12]|e[13]<<8;this._r[7]=(u>>>11|a<<5)&8065;var c=e[14]|e[15]<<8;this._r[8]=(a>>>8|c<<8)&8191,this._r[9]=c>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],u=this._h[2],a=this._h[3],c=this._h[4],f=this._h[5],d=this._h[6],w=this._h[7],A=this._h[8],_=this._h[9],N=this._r[0],P=this._r[1],V=this._r[2],U=this._r[3],Q=this._r[4],L=this._r[5],k=this._r[6],H=this._r[7],q=this._r[8],v=this._r[9];n>=16;){var C=e[r+0]|e[r+1]<<8;s+=C&8191;var R=e[r+2]|e[r+3]<<8;o+=(C>>>13|R<<3)&8191;var F=e[r+4]|e[r+5]<<8;u+=(R>>>10|F<<6)&8191;var B=e[r+6]|e[r+7]<<8;a+=(F>>>7|B<<9)&8191;var l=e[r+8]|e[r+9]<<8;c+=(B>>>4|l<<12)&8191,f+=l>>>1&8191;var g=e[r+10]|e[r+11]<<8;d+=(l>>>14|g<<2)&8191;var y=e[r+12]|e[r+13]<<8;w+=(g>>>11|y<<5)&8191;var E=e[r+14]|e[r+15]<<8;A+=(y>>>8|E<<8)&8191,_+=E>>>5|i;var I=0,T=I;T+=s*N,T+=o*(5*v),T+=u*(5*q),T+=a*(5*H),T+=c*(5*k),I=T>>>13,T&=8191,T+=f*(5*L),T+=d*(5*Q),T+=w*(5*U),T+=A*(5*V),T+=_*(5*P),I+=T>>>13,T&=8191;var M=I;M+=s*P,M+=o*N,M+=u*(5*v),M+=a*(5*q),M+=c*(5*H),I=M>>>13,M&=8191,M+=f*(5*k),M+=d*(5*L),M+=w*(5*Q),M+=A*(5*U),M+=_*(5*V),I+=M>>>13,M&=8191;var x=I;x+=s*V,x+=o*P,x+=u*N,x+=a*(5*v),x+=c*(5*q),I=x>>>13,x&=8191,x+=f*(5*H),x+=d*(5*k),x+=w*(5*L),x+=A*(5*Q),x+=_*(5*U),I+=x>>>13,x&=8191;var m=I;m+=s*U,m+=o*V,m+=u*P,m+=a*N,m+=c*(5*v),I=m>>>13,m&=8191,m+=f*(5*q),m+=d*(5*H),m+=w*(5*k),m+=A*(5*L),m+=_*(5*Q),I+=m>>>13,m&=8191;var O=I;O+=s*Q,O+=o*U,O+=u*V,O+=a*P,O+=c*N,I=O>>>13,O&=8191,O+=f*(5*v),O+=d*(5*q),O+=w*(5*H),O+=A*(5*k),O+=_*(5*L),I+=O>>>13,O&=8191;var Y=I;Y+=s*L,Y+=o*Q,Y+=u*U,Y+=a*V,Y+=c*P,I=Y>>>13,Y&=8191,Y+=f*N,Y+=d*(5*v),Y+=w*(5*q),Y+=A*(5*H),Y+=_*(5*k),I+=Y>>>13,Y&=8191;var $=I;$+=s*k,$+=o*L,$+=u*Q,$+=a*U,$+=c*V,I=$>>>13,$&=8191,$+=f*P,$+=d*N,$+=w*(5*v),$+=A*(5*q),$+=_*(5*H),I+=$>>>13,$&=8191;var b=I;b+=s*H,b+=o*k,b+=u*L,b+=a*Q,b+=c*U,I=b>>>13,b&=8191,b+=f*V,b+=d*P,b+=w*N,b+=A*(5*v),b+=_*(5*q),I+=b>>>13,b&=8191;var j=I;j+=s*q,j+=o*H,j+=u*k,j+=a*L,j+=c*Q,I=j>>>13,j&=8191,j+=f*U,j+=d*V,j+=w*P,j+=A*N,j+=_*(5*v),I+=j>>>13,j&=8191;var z=I;z+=s*v,z+=o*q,z+=u*H,z+=a*k,z+=c*L,I=z>>>13,z&=8191,z+=f*Q,z+=d*U,z+=w*V,z+=A*P,z+=_*N,I+=z>>>13,z&=8191,I=(I<<2)+I|0,I=I+T|0,T=I&8191,I=I>>>13,M+=I,s=T,o=M,u=x,a=m,c=O,f=Y,d=$,w=b,A=j,_=z,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=u,this._h[3]=a,this._h[4]=c,this._h[5]=f,this._h[6]=d,this._h[7]=w,this._h[8]=A,this._h[9]=_},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,u;if(this._leftover){for(u=this._leftover,this._buffer[u++]=1;u<16;u++)this._buffer[u]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,u=2;u<10;u++)this._h[u]+=i,i=this._h[u]>>>13,this._h[u]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,u=1;u<10;u++)n[u]=this._h[u]+i,i=n[u]>>>13,n[u]&=8191;for(n[9]-=8192,s=(i^1)-1,u=0;u<10;u++)n[u]&=s;for(s=~s,u=0;u<10;u++)this._h[u]=this._h[u]&s|n[u];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,u=1;u<8;u++)o=(this._h[u]+this._pad[u]|0)+(o>>>16)|0,this._h[u]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";h();Object.defineProperty(Gs,"__esModule",{value:!0});var Bm=zB(),_ee=WB(),Ch=Wn(),$B=qc(),Tee=Pm();Gs.KEY_LENGTH=32;Gs.NONCE_LENGTH=12;Gs.TAG_LENGTH=16;var YB=new Uint8Array(16),Cee=function(){function t(e){if(this.nonceLength=Gs.NONCE_LENGTH,this.tagLength=Gs.TAG_LENGTH,e.length!==Gs.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);Bm.stream(this._key,s,o,4);var u=r.length+this.tagLength,a;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");a=i}else a=new Uint8Array(u);return Bm.streamXOR(this._key,s,r,a,4),this._authenticate(a.subarray(a.length-this.tagLength,a.length),o,a.subarray(0,a.length-this.tagLength),n),Ch.wipe(s),a},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(YB.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(YB.subarray(n.length%16));var o=new Uint8Array(8);i&&$B.writeUint64LE(i.length,o),s.update(o),$B.writeUint64LE(n.length,o),s.update(o);for(var u=s.digest(),a=0;a{"use strict";h();Object.defineProperty(JI,"__esModule",{value:!0});function Nee(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}JI.isSerializableHash=Nee});var eM=D(Nh=>{"use strict";h();Object.defineProperty(Nh,"__esModule",{value:!0});var is=XB(),xee=Pm(),Oee=Wn(),ZB=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";h();Object.defineProperty(XI,"__esModule",{value:!0});var tM=eM(),rM=Wn(),Pee=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=tM.hmac(this._hash,n,r);this._hmac=new tM.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";h();Object.defineProperty(Lo,"__esModule",{value:!0});var Lm=qc(),Mm=Wn();Lo.DIGEST_LENGTH=32;Lo.BLOCK_SIZE=64;var iM=function(){function t(){this.digestLength=Lo.DIGEST_LENGTH,this.blockSize=Lo.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Mm.wipe(this._buffer),Mm.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(ZI(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=ZI(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var u=n+1;u0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Mm.wipe(e.state),e.buffer&&Mm.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Lo.SHA256=iM;var Ree=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 ZI(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],u=e[2],a=e[3],c=e[4],f=e[5],d=e[6],w=e[7],A=0;A<16;A++){var _=n+A*4;t[A]=Lm.readUint32BE(r,_)}for(var A=16;A<64;A++){var N=t[A-2],P=(N>>>17|N<<15)^(N>>>19|N<<13)^N>>>10;N=t[A-15];var V=(N>>>7|N<<25)^(N>>>18|N<<14)^N>>>3;t[A]=(P+t[A-7]|0)+(V+t[A-16]|0)}for(var A=0;A<64;A++){var P=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&d)|0)+(w+(Ree[A]+t[A]|0)|0)|0,V=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&u^o&u)|0;w=d,d=f,f=c,c=a+P|0,a=u,u=o,o=s,s=P+V|0}e[0]+=s,e[1]+=o,e[2]+=u,e[3]+=a,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=w,n+=64,i-=64}return n}function Bee(t){var e=new iM;e.update(t);var r=e.digest();return e.clean(),r}Lo.hash=Bee});var cM=D(zt=>{"use strict";h();Object.defineProperty(zt,"__esModule",{value:!0});zt.sharedKey=zt.generateKeyPair=zt.generateKeyPairFromSeed=zt.scalarMultBase=zt.scalarMult=zt.SHARED_KEY_LENGTH=zt.SECRET_KEY_LENGTH=zt.PUBLIC_KEY_LENGTH=void 0;var Mee=mh(),Lee=Wn();zt.PUBLIC_KEY_LENGTH=32;zt.SECRET_KEY_LENGTH=32;zt.SHARED_KEY_LENGTH=32;function ss(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,xh(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function qee(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fm(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Um(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function js(t,e,r){let n,i,s=0,o=0,u=0,a=0,c=0,f=0,d=0,w=0,A=0,_=0,N=0,P=0,V=0,U=0,Q=0,L=0,k=0,H=0,q=0,v=0,C=0,R=0,F=0,B=0,l=0,g=0,y=0,E=0,I=0,T=0,M=0,x=r[0],m=r[1],O=r[2],Y=r[3],$=r[4],b=r[5],j=r[6],z=r[7],W=r[8],ie=r[9],te=r[10],ee=r[11],se=r[12],oe=r[13],J=r[14],ue=r[15];n=e[0],s+=n*x,o+=n*m,u+=n*O,a+=n*Y,c+=n*$,f+=n*b,d+=n*j,w+=n*z,A+=n*W,_+=n*ie,N+=n*te,P+=n*ee,V+=n*se,U+=n*oe,Q+=n*J,L+=n*ue,n=e[1],o+=n*x,u+=n*m,a+=n*O,c+=n*Y,f+=n*$,d+=n*b,w+=n*j,A+=n*z,_+=n*W,N+=n*ie,P+=n*te,V+=n*ee,U+=n*se,Q+=n*oe,L+=n*J,k+=n*ue,n=e[2],u+=n*x,a+=n*m,c+=n*O,f+=n*Y,d+=n*$,w+=n*b,A+=n*j,_+=n*z,N+=n*W,P+=n*ie,V+=n*te,U+=n*ee,Q+=n*se,L+=n*oe,k+=n*J,H+=n*ue,n=e[3],a+=n*x,c+=n*m,f+=n*O,d+=n*Y,w+=n*$,A+=n*b,_+=n*j,N+=n*z,P+=n*W,V+=n*ie,U+=n*te,Q+=n*ee,L+=n*se,k+=n*oe,H+=n*J,q+=n*ue,n=e[4],c+=n*x,f+=n*m,d+=n*O,w+=n*Y,A+=n*$,_+=n*b,N+=n*j,P+=n*z,V+=n*W,U+=n*ie,Q+=n*te,L+=n*ee,k+=n*se,H+=n*oe,q+=n*J,v+=n*ue,n=e[5],f+=n*x,d+=n*m,w+=n*O,A+=n*Y,_+=n*$,N+=n*b,P+=n*j,V+=n*z,U+=n*W,Q+=n*ie,L+=n*te,k+=n*ee,H+=n*se,q+=n*oe,v+=n*J,C+=n*ue,n=e[6],d+=n*x,w+=n*m,A+=n*O,_+=n*Y,N+=n*$,P+=n*b,V+=n*j,U+=n*z,Q+=n*W,L+=n*ie,k+=n*te,H+=n*ee,q+=n*se,v+=n*oe,C+=n*J,R+=n*ue,n=e[7],w+=n*x,A+=n*m,_+=n*O,N+=n*Y,P+=n*$,V+=n*b,U+=n*j,Q+=n*z,L+=n*W,k+=n*ie,H+=n*te,q+=n*ee,v+=n*se,C+=n*oe,R+=n*J,F+=n*ue,n=e[8],A+=n*x,_+=n*m,N+=n*O,P+=n*Y,V+=n*$,U+=n*b,Q+=n*j,L+=n*z,k+=n*W,H+=n*ie,q+=n*te,v+=n*ee,C+=n*se,R+=n*oe,F+=n*J,B+=n*ue,n=e[9],_+=n*x,N+=n*m,P+=n*O,V+=n*Y,U+=n*$,Q+=n*b,L+=n*j,k+=n*z,H+=n*W,q+=n*ie,v+=n*te,C+=n*ee,R+=n*se,F+=n*oe,B+=n*J,l+=n*ue,n=e[10],N+=n*x,P+=n*m,V+=n*O,U+=n*Y,Q+=n*$,L+=n*b,k+=n*j,H+=n*z,q+=n*W,v+=n*ie,C+=n*te,R+=n*ee,F+=n*se,B+=n*oe,l+=n*J,g+=n*ue,n=e[11],P+=n*x,V+=n*m,U+=n*O,Q+=n*Y,L+=n*$,k+=n*b,H+=n*j,q+=n*z,v+=n*W,C+=n*ie,R+=n*te,F+=n*ee,B+=n*se,l+=n*oe,g+=n*J,y+=n*ue,n=e[12],V+=n*x,U+=n*m,Q+=n*O,L+=n*Y,k+=n*$,H+=n*b,q+=n*j,v+=n*z,C+=n*W,R+=n*ie,F+=n*te,B+=n*ee,l+=n*se,g+=n*oe,y+=n*J,E+=n*ue,n=e[13],U+=n*x,Q+=n*m,L+=n*O,k+=n*Y,H+=n*$,q+=n*b,v+=n*j,C+=n*z,R+=n*W,F+=n*ie,B+=n*te,l+=n*ee,g+=n*se,y+=n*oe,E+=n*J,I+=n*ue,n=e[14],Q+=n*x,L+=n*m,k+=n*O,H+=n*Y,q+=n*$,v+=n*b,C+=n*j,R+=n*z,F+=n*W,B+=n*ie,l+=n*te,g+=n*ee,y+=n*se,E+=n*oe,I+=n*J,T+=n*ue,n=e[15],L+=n*x,k+=n*m,H+=n*O,q+=n*Y,v+=n*$,C+=n*b,R+=n*j,F+=n*z,B+=n*W,l+=n*ie,g+=n*te,y+=n*ee,E+=n*se,I+=n*oe,T+=n*J,M+=n*ue,s+=38*k,o+=38*H,u+=38*q,a+=38*v,c+=38*C,f+=38*R,d+=38*F,w+=38*B,A+=38*l,_+=38*g,N+=38*y,P+=38*E,V+=38*I,U+=38*T,Q+=38*M,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=u,t[3]=a,t[4]=c,t[5]=f,t[6]=d,t[7]=w,t[8]=A,t[9]=_,t[10]=N,t[11]=P,t[12]=V,t[13]=U,t[14]=Q,t[15]=L}function Oh(t,e){js(t,e,e)}function Vee(t,e){let r=ss();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)Oh(r,r),n!==2&&n!==4&&js(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function t_(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=ss(),s=ss(),o=ss(),u=ss(),a=ss(),c=ss();for(let A=0;A<31;A++)r[A]=t[A];r[31]=t[31]&127|64,r[0]&=248,qee(n,e);for(let A=0;A<16;A++)s[A]=n[A];i[0]=u[0]=1;for(let A=254;A>=0;--A){let _=r[A>>>3]>>>(A&7)&1;xh(i,s,_),xh(o,u,_),Fm(a,i,o),Um(i,i,o),Fm(o,s,u),Um(s,s,u),Oh(u,a),Oh(c,i),js(i,o,i),js(o,s,a),Fm(a,i,o),Um(i,i,o),Oh(s,i),Um(o,u,c),js(i,o,Fee),Fm(i,i,u),js(o,o,i),js(i,u,c),js(u,s,n),Oh(s,a),xh(i,s,_),xh(o,u,_)}for(let A=0;A<16;A++)n[A+16]=i[A],n[A+32]=o[A],n[A+48]=s[A],n[A+64]=u[A];let f=n.subarray(32),d=n.subarray(16);Vee(f,f),js(d,d,f);let w=new Uint8Array(32);return Uee(w,d),w}zt.scalarMult=t_;function aM(t){return t_(t,oM)}zt.scalarMultBase=aM;function uM(t){if(t.length!==zt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${zt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:aM(e),secretKey:e}}zt.generateKeyPairFromSeed=uM;function kee(t){let e=(0,Mee.randomBytes)(32,t),r=uM(e);return(0,Lee.wipe)(e),r}zt.generateKeyPair=kee;function Hee(t,e,r=!1){if(t.length!==zt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==zt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=t_(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{h()});function hM(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{h()});function gM(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=zc(t.length);for(let n=0;n{h();bm()});var r_={};Ot(r_,{compare:()=>lM,concat:()=>Sm,equals:()=>hM,fromString:()=>ns,toString:()=>Vs,xor:()=>gM});var n_=de(()=>{h();fM();hI();dM();qI();UI();pM()});var mM={};Ot(mM,{RELAY_JSONRPC:()=>ete,isPublishMethod:()=>o_,isPublishParams:()=>a_,isPublishRequest:()=>Kee,isSubscribeMethod:()=>i_,isSubscribeParams:()=>s_,isSubscribeRequest:()=>Qee,isSubscriptionMethod:()=>l_,isSubscriptionParams:()=>f_,isSubscriptionRequest:()=>$ee,isUnsubscribeMethod:()=>u_,isUnsubscribeParams:()=>c_,isUnsubscribeRequest:()=>Wee,parsePublishRequest:()=>Jee,parseSubscribeRequest:()=>Yee,parseSubscriptionRequest:()=>Zee,parseUnsubscribeRequest:()=>Xee});function Ya(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function Gee(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function jee(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function zee(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function qm(t,e,r){return(r.length?zee(t,e.length):jee(t,e.length))?Gee(t,e):!1}function Vm(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}function Qee(t){return i_(t.method)&&s_(t.params)}function i_(t){return Vm(t,"subscribe")}function s_(t){return qm(t,["topic"],[])}function Kee(t){return o_(t.method)&&a_(t.params)}function o_(t){return Vm(t,"publish")}function a_(t){return qm(t,["message","topic","ttl"],["prompt","tag"])}function Wee(t){return u_(t.method)&&c_(t.params)}function u_(t){return Vm(t,"unsubscribe")}function c_(t){return qm(t,["id","topic"],[])}function $ee(t){return l_(t.method)&&f_(t.params)}function l_(t){return Vm(t,"subscription")}function f_(t){return qm(t,["id","data"],[])}function Yee(t){if(!i_(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!s_(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Ya(e,"topic"),e}function Jee(t){if(!o_(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!a_(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Ya(e,"topic"),Ya(e,"message"),Ya(e,"ttl","number"),e}function Xee(t){if(!u_(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!c_(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Ya(e,"id"),e}function Zee(t){if(!l_(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!f_(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Ya(e,"id"),Ya(e,"data"),e}var ete,yM=de(()=>{h();ete={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}}});var jh=D(K=>{"use strict";h();Object.defineProperty(K,"__esModule",{value:!0});var tte=bB(),tl=Bc(),sl=KI(),rte=IB(),nte=GB(),JM=JB(),ite=nM(),XM=mh(),U_=sM(),ste=cM(),Vt=(n_(),xe(r_)),ote=(yM(),xe(mM));function ZM(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var $m=ZM(nte),e4=ZM(ste),ny=":";function t4(t){let[e,r]=t.split(ny);return{namespace:e,reference:r}}function r4(t){let{namespace:e,reference:r}=t;return[e,r].join(ny)}function q_(t){let[e,r,n]=t.split(ny);return{namespace:e,reference:r,address:n}}function n4(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(ny)}function V_(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function i4(t){let{address:e}=q_(t);return e}function s4(t){let{namespace:e,reference:r}=q_(t);return r4({namespace:e,reference:r})}function ate(t,e){let{namespace:r,reference:n}=t4(e);return n4({namespace:r,reference:n,address:t})}function ute(t){return V_(t,i4)}function o4(t){return V_(t,s4)}function cte(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function lte(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...o4(i.accounts))}),r}function fte(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...iy(n,i))}),r}function iy(t,e){return t.includes(":")?[t]:e.chains||[]}var hte=Object.defineProperty,wM=Object.getOwnPropertySymbols,dte=Object.prototype.hasOwnProperty,gte=Object.prototype.propertyIsEnumerable,vM=(t,e,r)=>e in t?hte(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AM=(t,e)=>{for(var r in e||(e={}))dte.call(e,r)&&vM(t,r,e[r]);if(wM)for(var r of wM(e))gte.call(e,r)&&vM(t,r,e[r]);return t},a4="ReactNative",zr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Ym=" ",pte=":",u4="/",k_=2,mte=1e3,c4="js";function H_(){return typeof S.default<"u"&&typeof S.default.versions<"u"&&typeof S.default.versions.node<"u"}function ul(){return!sl.getDocument()&&!!sl.getNavigator()&&navigator.product===a4}function Vh(){return!H_()&&!!sl.getNavigator()&&!!sl.getDocument()}function Za(){return ul()?zr.reactNative:H_()?zr.node:Vh()?zr.browser:zr.unknown}function yte(){var t;try{return ul()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function l4(t,e){let r=$m.parse(t);return r=AM(AM({},r),e),t=$m.stringify(r),t}function wte(){return rte.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function vte(t,e){var r;let n=Za(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=sl.getLocation())==null?void 0:r.host)||"unknown"),i}function f4(){if(Za()===zr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=tte.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function h4(){var t;let e=Za();return e===zr.browser?[e,((t=sl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function d4(t,e,r){let n=f4(),i=h4();return[[t,e].join("-"),[c4,r].join("-"),n,i].join("/")}function Ate({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:u}){let a=r.split("?"),c=d4(t,e,n),f={auth:i,ua:c,projectId:s,useOnCloseEvent:o||void 0,origin:u||void 0},d=l4(a[1]||"",f);return a[0]+"?"+d}function Ete(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function bte(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function g4(t,e=k_){return p4(t.split(u4),e)}function Ste(t){return g4(t).join(Ym)}function Vo(t,e){return t.filter(r=>e.includes(r)).length===t.length}function p4(t,e=k_){return t.slice(Math.max(t.length-e,0))}function Ite(t){return Object.fromEntries(t.entries())}function _te(t){return new Map(Object.entries(t))}function Tte(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Cte=t=>t;function m4(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function Nte(t){return t.split(Ym).map(e=>m4(e)).join(Ym)}function xte(t=tl.FIVE_MINUTES,e){let r=tl.toMiliseconds(t||tl.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,u)=>{s=setTimeout(()=>{u(new Error(e))},r),n=o,i=u})}}function Ote(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function G_(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Dte(t){return G_("topic",t)}function Pte(t){return G_("id",t)}function Rte(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Bte(t,e){return tl.fromMiliseconds((e||Date.now())+tl.toMiliseconds(t))}function Mte(t){return Date.now()>=tl.toMiliseconds(t)}function Lte(t,e){return`${t}${e?`:${e}`:""}`}function Ys(t=[],e=[]){return[...new Set([...t,...e])]}async function Fte({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=Za();o===zr.browser?s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===zr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function Ute(t,e){try{return await t.getItem(e)||(Vh()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}function C_(t,e){return t.filter(r=>e.includes(r))}var y4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qte(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var w4={exports:{}};(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof S.default=="object"&&S.default.versions&&S.default.versions.node;o?i=y4:s&&(i=self);var u=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],w=[1,256,65536,16777216],A=[6,1536,393216,100663296],_=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],P=[224,256,384,512],V=[128,256],U=["hex","buffer","arrayBuffer","array","digest"],Q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(b){return Object.prototype.toString.call(b)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(b){return typeof b=="object"&&b.buffer&&b.buffer.constructor===ArrayBuffer});for(var L=function(b,j,z){return function(W){return new O(b,j,b).update(W)[z]()}},k=function(b,j,z){return function(W,ie){return new O(b,j,ie).update(W)[z]()}},H=function(b,j,z){return function(W,ie,te,ee){return g["cshake"+b].update(W,ie,te,ee)[z]()}},q=function(b,j,z){return function(W,ie,te,ee){return g["kmac"+b].update(W,ie,te,ee)[z]()}},v=function(b,j,z,W){for(var ie=0;ie>5,this.byteCount=this.blockCount<<2,this.outputBlocks=z>>5,this.extraBytes=(z&31)>>3;for(var W=0;W<50;++W)this.s[W]=0}O.prototype.update=function(b){if(this.finalized)throw new Error(r);var j,z=typeof b;if(z!=="string"){if(z==="object"){if(b===null)throw new Error(e);if(a&&b.constructor===ArrayBuffer)b=new Uint8Array(b);else if(!Array.isArray(b)&&(!a||!ArrayBuffer.isView(b)))throw new Error(e)}else throw new Error(e);j=!0}for(var W=this.blocks,ie=this.byteCount,te=b.length,ee=this.blockCount,se=0,oe=this.s,J,ue;se>2]|=b[se]<<_[J++&3];else for(J=this.start;se>2]|=ue<<_[J++&3]:ue<2048?(W[J>>2]|=(192|ue>>6)<<_[J++&3],W[J>>2]|=(128|ue&63)<<_[J++&3]):ue<55296||ue>=57344?(W[J>>2]|=(224|ue>>12)<<_[J++&3],W[J>>2]|=(128|ue>>6&63)<<_[J++&3],W[J>>2]|=(128|ue&63)<<_[J++&3]):(ue=65536+((ue&1023)<<10|b.charCodeAt(++se)&1023),W[J>>2]|=(240|ue>>18)<<_[J++&3],W[J>>2]|=(128|ue>>12&63)<<_[J++&3],W[J>>2]|=(128|ue>>6&63)<<_[J++&3],W[J>>2]|=(128|ue&63)<<_[J++&3]);if(this.lastByteIndex=J,J>=ie){for(this.start=J-ie,this.block=W[ee],J=0;J>8,z=b&255;z>0;)ie.unshift(z),b=b>>8,z=b&255,++W;return j?ie.push(W):ie.unshift(W),this.update(ie),ie.length},O.prototype.encodeString=function(b){var j,z=typeof b;if(z!=="string"){if(z==="object"){if(b===null)throw new Error(e);if(a&&b.constructor===ArrayBuffer)b=new Uint8Array(b);else if(!Array.isArray(b)&&(!a||!ArrayBuffer.isView(b)))throw new Error(e)}else throw new Error(e);j=!0}var W=0,ie=b.length;if(j)W=ie;else for(var te=0;te=57344?W+=3:(ee=65536+((ee&1023)<<10|b.charCodeAt(++te)&1023),W+=4)}return W+=this.encode(W*8),this.update(b),W},O.prototype.bytepad=function(b,j){for(var z=this.encode(j),W=0;W>2]|=this.padding[j&3],this.lastByteIndex===this.byteCount)for(b[0]=b[z],j=1;j>4&15]+c[se&15]+c[se>>12&15]+c[se>>8&15]+c[se>>20&15]+c[se>>16&15]+c[se>>28&15]+c[se>>24&15];te%b===0&&($(j),ie=0)}return W&&(se=j[ie],ee+=c[se>>4&15]+c[se&15],W>1&&(ee+=c[se>>12&15]+c[se>>8&15]),W>2&&(ee+=c[se>>20&15]+c[se>>16&15])),ee},O.prototype.arrayBuffer=function(){this.finalize();var b=this.blockCount,j=this.s,z=this.outputBlocks,W=this.extraBytes,ie=0,te=0,ee=this.outputBits>>3,se;W?se=new ArrayBuffer(z+1<<2):se=new ArrayBuffer(ee);for(var oe=new Uint32Array(se);te>8&255,ee[se+2]=oe>>16&255,ee[se+3]=oe>>24&255;te%b===0&&$(j)}return W&&(se=te<<2,oe=j[ie],ee[se]=oe&255,W>1&&(ee[se+1]=oe>>8&255),W>2&&(ee[se+2]=oe>>16&255)),ee};function Y(b,j,z){O.call(this,b,j,z)}Y.prototype=new O,Y.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var $=function(b){var j,z,W,ie,te,ee,se,oe,J,ue,vt,At,Pi,Et,bt,Ri,St,It,Bi,_t,Tt,Mi,Ke,We,si,$e,Ye,oi,Je,Xe,ai,Ze,et,ui,tt,rt,ci,nt,it,li,st,ot,fi,at,ut,hi,ct,lt,di,ft,ht,gi,dt,gt,pi,pt,mt,An,En,bn,Sn,In,_n;for(W=0;W<48;W+=2)ie=b[0]^b[10]^b[20]^b[30]^b[40],te=b[1]^b[11]^b[21]^b[31]^b[41],ee=b[2]^b[12]^b[22]^b[32]^b[42],se=b[3]^b[13]^b[23]^b[33]^b[43],oe=b[4]^b[14]^b[24]^b[34]^b[44],J=b[5]^b[15]^b[25]^b[35]^b[45],ue=b[6]^b[16]^b[26]^b[36]^b[46],vt=b[7]^b[17]^b[27]^b[37]^b[47],At=b[8]^b[18]^b[28]^b[38]^b[48],Pi=b[9]^b[19]^b[29]^b[39]^b[49],j=At^(ee<<1|se>>>31),z=Pi^(se<<1|ee>>>31),b[0]^=j,b[1]^=z,b[10]^=j,b[11]^=z,b[20]^=j,b[21]^=z,b[30]^=j,b[31]^=z,b[40]^=j,b[41]^=z,j=ie^(oe<<1|J>>>31),z=te^(J<<1|oe>>>31),b[2]^=j,b[3]^=z,b[12]^=j,b[13]^=z,b[22]^=j,b[23]^=z,b[32]^=j,b[33]^=z,b[42]^=j,b[43]^=z,j=ee^(ue<<1|vt>>>31),z=se^(vt<<1|ue>>>31),b[4]^=j,b[5]^=z,b[14]^=j,b[15]^=z,b[24]^=j,b[25]^=z,b[34]^=j,b[35]^=z,b[44]^=j,b[45]^=z,j=oe^(At<<1|Pi>>>31),z=J^(Pi<<1|At>>>31),b[6]^=j,b[7]^=z,b[16]^=j,b[17]^=z,b[26]^=j,b[27]^=z,b[36]^=j,b[37]^=z,b[46]^=j,b[47]^=z,j=ue^(ie<<1|te>>>31),z=vt^(te<<1|ie>>>31),b[8]^=j,b[9]^=z,b[18]^=j,b[19]^=z,b[28]^=j,b[29]^=z,b[38]^=j,b[39]^=z,b[48]^=j,b[49]^=z,Et=b[0],bt=b[1],hi=b[11]<<4|b[10]>>>28,ct=b[10]<<4|b[11]>>>28,oi=b[20]<<3|b[21]>>>29,Je=b[21]<<3|b[20]>>>29,bn=b[31]<<9|b[30]>>>23,Sn=b[30]<<9|b[31]>>>23,ot=b[40]<<18|b[41]>>>14,fi=b[41]<<18|b[40]>>>14,ui=b[2]<<1|b[3]>>>31,tt=b[3]<<1|b[2]>>>31,Ri=b[13]<<12|b[12]>>>20,St=b[12]<<12|b[13]>>>20,lt=b[22]<<10|b[23]>>>22,di=b[23]<<10|b[22]>>>22,Xe=b[33]<<13|b[32]>>>19,ai=b[32]<<13|b[33]>>>19,In=b[42]<<2|b[43]>>>30,_n=b[43]<<2|b[42]>>>30,gt=b[5]<<30|b[4]>>>2,pi=b[4]<<30|b[5]>>>2,rt=b[14]<<6|b[15]>>>26,ci=b[15]<<6|b[14]>>>26,It=b[25]<<11|b[24]>>>21,Bi=b[24]<<11|b[25]>>>21,ft=b[34]<<15|b[35]>>>17,ht=b[35]<<15|b[34]>>>17,Ze=b[45]<<29|b[44]>>>3,et=b[44]<<29|b[45]>>>3,We=b[6]<<28|b[7]>>>4,si=b[7]<<28|b[6]>>>4,pt=b[17]<<23|b[16]>>>9,mt=b[16]<<23|b[17]>>>9,nt=b[26]<<25|b[27]>>>7,it=b[27]<<25|b[26]>>>7,_t=b[36]<<21|b[37]>>>11,Tt=b[37]<<21|b[36]>>>11,gi=b[47]<<24|b[46]>>>8,dt=b[46]<<24|b[47]>>>8,at=b[8]<<27|b[9]>>>5,ut=b[9]<<27|b[8]>>>5,$e=b[18]<<20|b[19]>>>12,Ye=b[19]<<20|b[18]>>>12,An=b[29]<<7|b[28]>>>25,En=b[28]<<7|b[29]>>>25,li=b[38]<<8|b[39]>>>24,st=b[39]<<8|b[38]>>>24,Mi=b[48]<<14|b[49]>>>18,Ke=b[49]<<14|b[48]>>>18,b[0]=Et^~Ri&It,b[1]=bt^~St&Bi,b[10]=We^~$e&oi,b[11]=si^~Ye&Je,b[20]=ui^~rt&nt,b[21]=tt^~ci&it,b[30]=at^~hi<,b[31]=ut^~ct&di,b[40]=gt^~pt&An,b[41]=pi^~mt&En,b[2]=Ri^~It&_t,b[3]=St^~Bi&Tt,b[12]=$e^~oi&Xe,b[13]=Ye^~Je&ai,b[22]=rt^~nt&li,b[23]=ci^~it&st,b[32]=hi^~lt&ft,b[33]=ct^~di&ht,b[42]=pt^~An&bn,b[43]=mt^~En&Sn,b[4]=It^~_t&Mi,b[5]=Bi^~Tt&Ke,b[14]=oi^~Xe&Ze,b[15]=Je^~ai&et,b[24]=nt^~li&ot,b[25]=it^~st&fi,b[34]=lt^~ft&gi,b[35]=di^~ht&dt,b[44]=An^~bn&In,b[45]=En^~Sn&_n,b[6]=_t^~Mi&Et,b[7]=Tt^~Ke&bt,b[16]=Xe^~Ze&We,b[17]=ai^~et&si,b[26]=li^~ot&ui,b[27]=st^~fi&tt,b[36]=ft^~gi&at,b[37]=ht^~dt&ut,b[46]=bn^~In>,b[47]=Sn^~_n&pi,b[8]=Mi^~Et&Ri,b[9]=Ke^~bt&St,b[18]=Ze^~We&$e,b[19]=et^~si&Ye,b[28]=ot^~ui&rt,b[29]=fi^~tt&ci,b[38]=gi^~at&hi,b[39]=dt^~ut&ct,b[48]=In^~gt&pt,b[49]=_n^~pi&mt,b[0]^=N[W],b[1]^=N[W+1]};if(u)t.exports=g;else for(E=0;E{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var IM=Hte(),N_;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(N_||(N_={}));var Ti;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ti||(Ti={}));var _M="0123456789abcdef",kt=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let n=e.toLowerCase();Qm[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(SM>Qm[n])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,n){if(bM)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(a=>{let c=n[a];try{if(c instanceof Uint8Array){let f="";for(let d=0;d>4],f+=_M[c[d]&15];i.push(a+"=Uint8Array(0x"+f+")")}else i.push(a+"="+JSON.stringify(c))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);let s=e,o="";switch(r){case Ti.NUMERIC_FAULT:{o="NUMERIC_FAULT";let a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":o+="-"+a;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Ti.CALL_EXCEPTION:case Ti.INSUFFICIENT_FUNDS:case Ti.MISSING_NEW:case Ti.NONCE_EXPIRED:case Ti.REPLACEMENT_UNDERPRICED:case Ti.TRANSACTION_REPLACED:case Ti.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let u=new Error(e);return u.reason=s,u.code=r,Object.keys(n).forEach(function(a){u[a]=n[a]}),u}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){IM&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:IM})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return h_||(h_=new t(kte)),h_}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),EM){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}bM=!!e,EM=!!r}static setLogLevel(e){let r=Qm[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}SM=r}static from(e){return new t(e)}};kt.errors=Ti,kt.levels=N_;var Gte="bytes/5.7.0",tr=new kt(Gte);function v4(t){return!!t.toHexString}function rl(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return rl(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function jte(t){return pn(t)&&!(t.length%2)||cl(t)}function TM(t){return typeof t=="number"&&t==t&&t%1===0}function cl(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!TM(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Qt(t,e){if(e||(e={}),typeof t=="number"){tr.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),rl(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),v4(t)&&(t=t.toHexString()),pn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":tr.throwArgumentError("hex data is odd-length","value",t));let n=[];for(let i=0;iQt(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),rl(n)}function Qte(t,e){t=Qt(t),t.length>e&&tr.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),rl(r)}function pn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var d_="0123456789abcdef";function Gr(t,e){if(e||(e={}),typeof t=="number"){tr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=d_[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),v4(t))return t.toHexString();if(pn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":tr.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(cl(t)){let r="0x";for(let n=0;n>4]+d_[i&15]}return r}return tr.throwArgumentError("invalid hexlify value","value",t)}function Kte(t){if(typeof t!="string")t=Gr(t);else if(!pn(t)||t.length%2)return null;return(t.length-2)/2}function CM(t,e,r){return typeof t!="string"?t=Gr(t):(!pn(t)||t.length%2)&&tr.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function fs(t,e){for(typeof t!="string"?t=Gr(t):pn(t)||tr.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&tr.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function A4(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(jte(t)){let r=Qt(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Gr(r.slice(0,32)),e.s=Gr(r.slice(32,64))):r.length===65?(e.r=Gr(r.slice(0,32)),e.s=Gr(r.slice(32,64)),e.v=r[64]):tr.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:tr.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Gr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let i=Qte(Qt(e._vs),32);e._vs=Gr(i);let s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&tr.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;let o=Gr(i);e.s==null?e.s=o:e.s!==o&&tr.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?tr.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&tr.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pn(e.r)?tr.throwArgumentError("signature missing or invalid r","signature",t):e.r=fs(e.r,32),e.s==null||!pn(e.s)?tr.throwArgumentError("signature missing or invalid s","signature",t):e.s=fs(e.s,32);let r=Qt(e.s);r[0]>=128&&tr.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let n=Gr(r);e._vs&&(pn(e._vs)||tr.throwArgumentError("signature invalid _vs","signature",t),e._vs=fs(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&tr.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function j_(t){return"0x"+Vte.keccak_256(Qt(t))}var E4={exports:{}},Wte={},$te=Object.freeze({__proto__:null,default:Wte}),Yte=qte($te);(function(t){(function(e,r){function n(l,g){if(!l)throw new Error(g||"Assertion failed")}function i(l,g){l.super_=g;var y=function(){};y.prototype=g.prototype,l.prototype=new y,l.prototype.constructor=l}function s(l,g,y){if(s.isBN(l))return l;this.negative=0,this.words=null,this.length=0,this.red=null,l!==null&&((g==="le"||g==="be")&&(y=g,g=10),this._init(l||0,g||10,y||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Yte.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,g){return l.cmp(g)>0?l:g},s.min=function(l,g){return l.cmp(g)<0?l:g},s.prototype._init=function(l,g,y){if(typeof l=="number")return this._initNumber(l,g,y);if(typeof l=="object")return this._initArray(l,g,y);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),l=l.toString().replace(/\s+/g,"");var E=0;l[0]==="-"&&(E++,this.negative=1),E=0;E-=3)T=l[E]|l[E-1]<<8|l[E-2]<<16,this.words[I]|=T<>>26-M&67108863,M+=24,M>=26&&(M-=26,I++);else if(y==="le")for(E=0,I=0;E>>26-M&67108863,M+=24,M>=26&&(M-=26,I++);return this._strip()};function u(l,g){var y=l.charCodeAt(g);if(y>=48&&y<=57)return y-48;if(y>=65&&y<=70)return y-55;if(y>=97&&y<=102)return y-87;n(!1,"Invalid character in "+l)}function a(l,g,y){var E=u(l,y);return y-1>=g&&(E|=u(l,y-1)<<4),E}s.prototype._parseHex=function(l,g,y){this.length=Math.ceil((l.length-g)/6),this.words=new Array(this.length);for(var E=0;E=g;E-=2)M=a(l,g,E)<=18?(I-=18,T+=1,this.words[T]|=M>>>26):I+=8;else{var x=l.length-g;for(E=x%2===0?g+1:g;E=18?(I-=18,T+=1,this.words[T]|=M>>>26):I+=8}this._strip()};function c(l,g,y,E){for(var I=0,T=0,M=Math.min(l.length,y),x=g;x=49?T=m-49+10:m>=17?T=m-17+10:T=m,n(m>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{s.prototype.inspect=d}else s.prototype.inspect=d;function d(){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"],A=[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],_=[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];s.prototype.toString=function(l,g){l=l||10,g=g|0||1;var y;if(l===16||l==="hex"){y="";for(var E=0,I=0,T=0;T>>24-E&16777215,E+=2,E>=26&&(E-=26,T--),I!==0||T!==this.length-1?y=w[6-x.length]+x+y:y=x+y}for(I!==0&&(y=I.toString(16)+y);y.length%g!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(l===(l|0)&&l>=2&&l<=36){var m=A[l],O=_[l];y="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var $=Y.modrn(O).toString(l);Y=Y.idivn(O),Y.isZero()?y=$+y:y=w[m-$.length]+$+y}for(this.isZero()&&(y="0"+y);y.length%g!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(l,g){return this.toArrayLike(o,l,g)}),s.prototype.toArray=function(l,g){return this.toArrayLike(Array,l,g)};var N=function(l,g){return l.allocUnsafe?l.allocUnsafe(g):new l(g)};s.prototype.toArrayLike=function(l,g,y){this._strip();var E=this.byteLength(),I=y||Math.max(1,E);n(E<=I,"byte array longer than desired length"),n(I>0,"Requested array length <= 0");var T=N(l,I),M=g==="le"?"LE":"BE";return this["_toArrayLike"+M](T,E),T},s.prototype._toArrayLikeLE=function(l,g){for(var y=0,E=0,I=0,T=0;I>8&255),y>16&255),T===6?(y>24&255),E=0,T=0):(E=M>>>24,T+=2)}if(y=0&&(l[y--]=M>>8&255),y>=0&&(l[y--]=M>>16&255),T===6?(y>=0&&(l[y--]=M>>24&255),E=0,T=0):(E=M>>>24,T+=2)}if(y>=0)for(l[y--]=E;y>=0;)l[y--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var g=l,y=0;return g>=4096&&(y+=13,g>>>=13),g>=64&&(y+=7,g>>>=7),g>=8&&(y+=4,g>>>=4),g>=2&&(y+=2,g>>>=2),y+g},s.prototype._zeroBits=function(l){if(l===0)return 26;var g=l,y=0;return g&8191||(y+=13,g>>>=13),g&127||(y+=7,g>>>=7),g&15||(y+=4,g>>>=4),g&3||(y+=2,g>>>=2),g&1||y++,y},s.prototype.bitLength=function(){var l=this.words[this.length-1],g=this._countBits(l);return(this.length-1)*26+g};function P(l){for(var g=new Array(l.bitLength()),y=0;y>>I&1}return g}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,g=0;gl.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var g;this.length>l.length?g=l:g=this;for(var y=0;yl.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var g,y;this.length>l.length?(g=this,y=l):(g=l,y=this);for(var E=0;El.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){n(typeof l=="number"&&l>=0);var g=Math.ceil(l/26)|0,y=l%26;this._expand(g),y>0&&g--;for(var E=0;E0&&(this.words[E]=~this.words[E]&67108863>>26-y),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,g){n(typeof l=="number"&&l>=0);var y=l/26|0,E=l%26;return this._expand(y+1),g?this.words[y]=this.words[y]|1<l.length?(y=this,E=l):(y=l,E=this);for(var I=0,T=0;T>>26;for(;I!==0&&T>>26;if(this.length=y.length,I!==0)this.words[this.length]=I,this.length++;else if(y!==this)for(;Tl.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var g=this.iadd(l);return l.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var y=this.cmp(l);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,I;y>0?(E=this,I=l):(E=l,I=this);for(var T=0,M=0;M>26,this.words[M]=g&67108863;for(;T!==0&&M>26,this.words[M]=g&67108863;if(T===0&&M>>26,$=m&67108863,b=Math.min(O,g.length-1),j=Math.max(0,O-l.length+1);j<=b;j++){var z=O-j|0;I=l.words[z]|0,T=g.words[j]|0,M=I*T+$,Y+=M/67108864|0,$=M&67108863}y.words[O]=$|0,m=Y|0}return m!==0?y.words[O]=m|0:y.length--,y._strip()}var U=function(l,g,y){var E=l.words,I=g.words,T=y.words,M=0,x,m,O,Y=E[0]|0,$=Y&8191,b=Y>>>13,j=E[1]|0,z=j&8191,W=j>>>13,ie=E[2]|0,te=ie&8191,ee=ie>>>13,se=E[3]|0,oe=se&8191,J=se>>>13,ue=E[4]|0,vt=ue&8191,At=ue>>>13,Pi=E[5]|0,Et=Pi&8191,bt=Pi>>>13,Ri=E[6]|0,St=Ri&8191,It=Ri>>>13,Bi=E[7]|0,_t=Bi&8191,Tt=Bi>>>13,Mi=E[8]|0,Ke=Mi&8191,We=Mi>>>13,si=E[9]|0,$e=si&8191,Ye=si>>>13,oi=I[0]|0,Je=oi&8191,Xe=oi>>>13,ai=I[1]|0,Ze=ai&8191,et=ai>>>13,ui=I[2]|0,tt=ui&8191,rt=ui>>>13,ci=I[3]|0,nt=ci&8191,it=ci>>>13,li=I[4]|0,st=li&8191,ot=li>>>13,fi=I[5]|0,at=fi&8191,ut=fi>>>13,hi=I[6]|0,ct=hi&8191,lt=hi>>>13,di=I[7]|0,ft=di&8191,ht=di>>>13,gi=I[8]|0,dt=gi&8191,gt=gi>>>13,pi=I[9]|0,pt=pi&8191,mt=pi>>>13;y.negative=l.negative^g.negative,y.length=19,x=Math.imul($,Je),m=Math.imul($,Xe),m=m+Math.imul(b,Je)|0,O=Math.imul(b,Xe);var An=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(An>>>26)|0,An&=67108863,x=Math.imul(z,Je),m=Math.imul(z,Xe),m=m+Math.imul(W,Je)|0,O=Math.imul(W,Xe),x=x+Math.imul($,Ze)|0,m=m+Math.imul($,et)|0,m=m+Math.imul(b,Ze)|0,O=O+Math.imul(b,et)|0;var En=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(En>>>26)|0,En&=67108863,x=Math.imul(te,Je),m=Math.imul(te,Xe),m=m+Math.imul(ee,Je)|0,O=Math.imul(ee,Xe),x=x+Math.imul(z,Ze)|0,m=m+Math.imul(z,et)|0,m=m+Math.imul(W,Ze)|0,O=O+Math.imul(W,et)|0,x=x+Math.imul($,tt)|0,m=m+Math.imul($,rt)|0,m=m+Math.imul(b,tt)|0,O=O+Math.imul(b,rt)|0;var bn=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(bn>>>26)|0,bn&=67108863,x=Math.imul(oe,Je),m=Math.imul(oe,Xe),m=m+Math.imul(J,Je)|0,O=Math.imul(J,Xe),x=x+Math.imul(te,Ze)|0,m=m+Math.imul(te,et)|0,m=m+Math.imul(ee,Ze)|0,O=O+Math.imul(ee,et)|0,x=x+Math.imul(z,tt)|0,m=m+Math.imul(z,rt)|0,m=m+Math.imul(W,tt)|0,O=O+Math.imul(W,rt)|0,x=x+Math.imul($,nt)|0,m=m+Math.imul($,it)|0,m=m+Math.imul(b,nt)|0,O=O+Math.imul(b,it)|0;var Sn=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,x=Math.imul(vt,Je),m=Math.imul(vt,Xe),m=m+Math.imul(At,Je)|0,O=Math.imul(At,Xe),x=x+Math.imul(oe,Ze)|0,m=m+Math.imul(oe,et)|0,m=m+Math.imul(J,Ze)|0,O=O+Math.imul(J,et)|0,x=x+Math.imul(te,tt)|0,m=m+Math.imul(te,rt)|0,m=m+Math.imul(ee,tt)|0,O=O+Math.imul(ee,rt)|0,x=x+Math.imul(z,nt)|0,m=m+Math.imul(z,it)|0,m=m+Math.imul(W,nt)|0,O=O+Math.imul(W,it)|0,x=x+Math.imul($,st)|0,m=m+Math.imul($,ot)|0,m=m+Math.imul(b,st)|0,O=O+Math.imul(b,ot)|0;var In=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(In>>>26)|0,In&=67108863,x=Math.imul(Et,Je),m=Math.imul(Et,Xe),m=m+Math.imul(bt,Je)|0,O=Math.imul(bt,Xe),x=x+Math.imul(vt,Ze)|0,m=m+Math.imul(vt,et)|0,m=m+Math.imul(At,Ze)|0,O=O+Math.imul(At,et)|0,x=x+Math.imul(oe,tt)|0,m=m+Math.imul(oe,rt)|0,m=m+Math.imul(J,tt)|0,O=O+Math.imul(J,rt)|0,x=x+Math.imul(te,nt)|0,m=m+Math.imul(te,it)|0,m=m+Math.imul(ee,nt)|0,O=O+Math.imul(ee,it)|0,x=x+Math.imul(z,st)|0,m=m+Math.imul(z,ot)|0,m=m+Math.imul(W,st)|0,O=O+Math.imul(W,ot)|0,x=x+Math.imul($,at)|0,m=m+Math.imul($,ut)|0,m=m+Math.imul(b,at)|0,O=O+Math.imul(b,ut)|0;var _n=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(_n>>>26)|0,_n&=67108863,x=Math.imul(St,Je),m=Math.imul(St,Xe),m=m+Math.imul(It,Je)|0,O=Math.imul(It,Xe),x=x+Math.imul(Et,Ze)|0,m=m+Math.imul(Et,et)|0,m=m+Math.imul(bt,Ze)|0,O=O+Math.imul(bt,et)|0,x=x+Math.imul(vt,tt)|0,m=m+Math.imul(vt,rt)|0,m=m+Math.imul(At,tt)|0,O=O+Math.imul(At,rt)|0,x=x+Math.imul(oe,nt)|0,m=m+Math.imul(oe,it)|0,m=m+Math.imul(J,nt)|0,O=O+Math.imul(J,it)|0,x=x+Math.imul(te,st)|0,m=m+Math.imul(te,ot)|0,m=m+Math.imul(ee,st)|0,O=O+Math.imul(ee,ot)|0,x=x+Math.imul(z,at)|0,m=m+Math.imul(z,ut)|0,m=m+Math.imul(W,at)|0,O=O+Math.imul(W,ut)|0,x=x+Math.imul($,ct)|0,m=m+Math.imul($,lt)|0,m=m+Math.imul(b,ct)|0,O=O+Math.imul(b,lt)|0;var la=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(la>>>26)|0,la&=67108863,x=Math.imul(_t,Je),m=Math.imul(_t,Xe),m=m+Math.imul(Tt,Je)|0,O=Math.imul(Tt,Xe),x=x+Math.imul(St,Ze)|0,m=m+Math.imul(St,et)|0,m=m+Math.imul(It,Ze)|0,O=O+Math.imul(It,et)|0,x=x+Math.imul(Et,tt)|0,m=m+Math.imul(Et,rt)|0,m=m+Math.imul(bt,tt)|0,O=O+Math.imul(bt,rt)|0,x=x+Math.imul(vt,nt)|0,m=m+Math.imul(vt,it)|0,m=m+Math.imul(At,nt)|0,O=O+Math.imul(At,it)|0,x=x+Math.imul(oe,st)|0,m=m+Math.imul(oe,ot)|0,m=m+Math.imul(J,st)|0,O=O+Math.imul(J,ot)|0,x=x+Math.imul(te,at)|0,m=m+Math.imul(te,ut)|0,m=m+Math.imul(ee,at)|0,O=O+Math.imul(ee,ut)|0,x=x+Math.imul(z,ct)|0,m=m+Math.imul(z,lt)|0,m=m+Math.imul(W,ct)|0,O=O+Math.imul(W,lt)|0,x=x+Math.imul($,ft)|0,m=m+Math.imul($,ht)|0,m=m+Math.imul(b,ft)|0,O=O+Math.imul(b,ht)|0;var fa=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(fa>>>26)|0,fa&=67108863,x=Math.imul(Ke,Je),m=Math.imul(Ke,Xe),m=m+Math.imul(We,Je)|0,O=Math.imul(We,Xe),x=x+Math.imul(_t,Ze)|0,m=m+Math.imul(_t,et)|0,m=m+Math.imul(Tt,Ze)|0,O=O+Math.imul(Tt,et)|0,x=x+Math.imul(St,tt)|0,m=m+Math.imul(St,rt)|0,m=m+Math.imul(It,tt)|0,O=O+Math.imul(It,rt)|0,x=x+Math.imul(Et,nt)|0,m=m+Math.imul(Et,it)|0,m=m+Math.imul(bt,nt)|0,O=O+Math.imul(bt,it)|0,x=x+Math.imul(vt,st)|0,m=m+Math.imul(vt,ot)|0,m=m+Math.imul(At,st)|0,O=O+Math.imul(At,ot)|0,x=x+Math.imul(oe,at)|0,m=m+Math.imul(oe,ut)|0,m=m+Math.imul(J,at)|0,O=O+Math.imul(J,ut)|0,x=x+Math.imul(te,ct)|0,m=m+Math.imul(te,lt)|0,m=m+Math.imul(ee,ct)|0,O=O+Math.imul(ee,lt)|0,x=x+Math.imul(z,ft)|0,m=m+Math.imul(z,ht)|0,m=m+Math.imul(W,ft)|0,O=O+Math.imul(W,ht)|0,x=x+Math.imul($,dt)|0,m=m+Math.imul($,gt)|0,m=m+Math.imul(b,dt)|0,O=O+Math.imul(b,gt)|0;var ha=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ha>>>26)|0,ha&=67108863,x=Math.imul($e,Je),m=Math.imul($e,Xe),m=m+Math.imul(Ye,Je)|0,O=Math.imul(Ye,Xe),x=x+Math.imul(Ke,Ze)|0,m=m+Math.imul(Ke,et)|0,m=m+Math.imul(We,Ze)|0,O=O+Math.imul(We,et)|0,x=x+Math.imul(_t,tt)|0,m=m+Math.imul(_t,rt)|0,m=m+Math.imul(Tt,tt)|0,O=O+Math.imul(Tt,rt)|0,x=x+Math.imul(St,nt)|0,m=m+Math.imul(St,it)|0,m=m+Math.imul(It,nt)|0,O=O+Math.imul(It,it)|0,x=x+Math.imul(Et,st)|0,m=m+Math.imul(Et,ot)|0,m=m+Math.imul(bt,st)|0,O=O+Math.imul(bt,ot)|0,x=x+Math.imul(vt,at)|0,m=m+Math.imul(vt,ut)|0,m=m+Math.imul(At,at)|0,O=O+Math.imul(At,ut)|0,x=x+Math.imul(oe,ct)|0,m=m+Math.imul(oe,lt)|0,m=m+Math.imul(J,ct)|0,O=O+Math.imul(J,lt)|0,x=x+Math.imul(te,ft)|0,m=m+Math.imul(te,ht)|0,m=m+Math.imul(ee,ft)|0,O=O+Math.imul(ee,ht)|0,x=x+Math.imul(z,dt)|0,m=m+Math.imul(z,gt)|0,m=m+Math.imul(W,dt)|0,O=O+Math.imul(W,gt)|0,x=x+Math.imul($,pt)|0,m=m+Math.imul($,mt)|0,m=m+Math.imul(b,pt)|0,O=O+Math.imul(b,mt)|0;var da=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(da>>>26)|0,da&=67108863,x=Math.imul($e,Ze),m=Math.imul($e,et),m=m+Math.imul(Ye,Ze)|0,O=Math.imul(Ye,et),x=x+Math.imul(Ke,tt)|0,m=m+Math.imul(Ke,rt)|0,m=m+Math.imul(We,tt)|0,O=O+Math.imul(We,rt)|0,x=x+Math.imul(_t,nt)|0,m=m+Math.imul(_t,it)|0,m=m+Math.imul(Tt,nt)|0,O=O+Math.imul(Tt,it)|0,x=x+Math.imul(St,st)|0,m=m+Math.imul(St,ot)|0,m=m+Math.imul(It,st)|0,O=O+Math.imul(It,ot)|0,x=x+Math.imul(Et,at)|0,m=m+Math.imul(Et,ut)|0,m=m+Math.imul(bt,at)|0,O=O+Math.imul(bt,ut)|0,x=x+Math.imul(vt,ct)|0,m=m+Math.imul(vt,lt)|0,m=m+Math.imul(At,ct)|0,O=O+Math.imul(At,lt)|0,x=x+Math.imul(oe,ft)|0,m=m+Math.imul(oe,ht)|0,m=m+Math.imul(J,ft)|0,O=O+Math.imul(J,ht)|0,x=x+Math.imul(te,dt)|0,m=m+Math.imul(te,gt)|0,m=m+Math.imul(ee,dt)|0,O=O+Math.imul(ee,gt)|0,x=x+Math.imul(z,pt)|0,m=m+Math.imul(z,mt)|0,m=m+Math.imul(W,pt)|0,O=O+Math.imul(W,mt)|0;var ga=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ga>>>26)|0,ga&=67108863,x=Math.imul($e,tt),m=Math.imul($e,rt),m=m+Math.imul(Ye,tt)|0,O=Math.imul(Ye,rt),x=x+Math.imul(Ke,nt)|0,m=m+Math.imul(Ke,it)|0,m=m+Math.imul(We,nt)|0,O=O+Math.imul(We,it)|0,x=x+Math.imul(_t,st)|0,m=m+Math.imul(_t,ot)|0,m=m+Math.imul(Tt,st)|0,O=O+Math.imul(Tt,ot)|0,x=x+Math.imul(St,at)|0,m=m+Math.imul(St,ut)|0,m=m+Math.imul(It,at)|0,O=O+Math.imul(It,ut)|0,x=x+Math.imul(Et,ct)|0,m=m+Math.imul(Et,lt)|0,m=m+Math.imul(bt,ct)|0,O=O+Math.imul(bt,lt)|0,x=x+Math.imul(vt,ft)|0,m=m+Math.imul(vt,ht)|0,m=m+Math.imul(At,ft)|0,O=O+Math.imul(At,ht)|0,x=x+Math.imul(oe,dt)|0,m=m+Math.imul(oe,gt)|0,m=m+Math.imul(J,dt)|0,O=O+Math.imul(J,gt)|0,x=x+Math.imul(te,pt)|0,m=m+Math.imul(te,mt)|0,m=m+Math.imul(ee,pt)|0,O=O+Math.imul(ee,mt)|0;var pa=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(pa>>>26)|0,pa&=67108863,x=Math.imul($e,nt),m=Math.imul($e,it),m=m+Math.imul(Ye,nt)|0,O=Math.imul(Ye,it),x=x+Math.imul(Ke,st)|0,m=m+Math.imul(Ke,ot)|0,m=m+Math.imul(We,st)|0,O=O+Math.imul(We,ot)|0,x=x+Math.imul(_t,at)|0,m=m+Math.imul(_t,ut)|0,m=m+Math.imul(Tt,at)|0,O=O+Math.imul(Tt,ut)|0,x=x+Math.imul(St,ct)|0,m=m+Math.imul(St,lt)|0,m=m+Math.imul(It,ct)|0,O=O+Math.imul(It,lt)|0,x=x+Math.imul(Et,ft)|0,m=m+Math.imul(Et,ht)|0,m=m+Math.imul(bt,ft)|0,O=O+Math.imul(bt,ht)|0,x=x+Math.imul(vt,dt)|0,m=m+Math.imul(vt,gt)|0,m=m+Math.imul(At,dt)|0,O=O+Math.imul(At,gt)|0,x=x+Math.imul(oe,pt)|0,m=m+Math.imul(oe,mt)|0,m=m+Math.imul(J,pt)|0,O=O+Math.imul(J,mt)|0;var ma=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ma>>>26)|0,ma&=67108863,x=Math.imul($e,st),m=Math.imul($e,ot),m=m+Math.imul(Ye,st)|0,O=Math.imul(Ye,ot),x=x+Math.imul(Ke,at)|0,m=m+Math.imul(Ke,ut)|0,m=m+Math.imul(We,at)|0,O=O+Math.imul(We,ut)|0,x=x+Math.imul(_t,ct)|0,m=m+Math.imul(_t,lt)|0,m=m+Math.imul(Tt,ct)|0,O=O+Math.imul(Tt,lt)|0,x=x+Math.imul(St,ft)|0,m=m+Math.imul(St,ht)|0,m=m+Math.imul(It,ft)|0,O=O+Math.imul(It,ht)|0,x=x+Math.imul(Et,dt)|0,m=m+Math.imul(Et,gt)|0,m=m+Math.imul(bt,dt)|0,O=O+Math.imul(bt,gt)|0,x=x+Math.imul(vt,pt)|0,m=m+Math.imul(vt,mt)|0,m=m+Math.imul(At,pt)|0,O=O+Math.imul(At,mt)|0;var ya=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ya>>>26)|0,ya&=67108863,x=Math.imul($e,at),m=Math.imul($e,ut),m=m+Math.imul(Ye,at)|0,O=Math.imul(Ye,ut),x=x+Math.imul(Ke,ct)|0,m=m+Math.imul(Ke,lt)|0,m=m+Math.imul(We,ct)|0,O=O+Math.imul(We,lt)|0,x=x+Math.imul(_t,ft)|0,m=m+Math.imul(_t,ht)|0,m=m+Math.imul(Tt,ft)|0,O=O+Math.imul(Tt,ht)|0,x=x+Math.imul(St,dt)|0,m=m+Math.imul(St,gt)|0,m=m+Math.imul(It,dt)|0,O=O+Math.imul(It,gt)|0,x=x+Math.imul(Et,pt)|0,m=m+Math.imul(Et,mt)|0,m=m+Math.imul(bt,pt)|0,O=O+Math.imul(bt,mt)|0;var wa=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(wa>>>26)|0,wa&=67108863,x=Math.imul($e,ct),m=Math.imul($e,lt),m=m+Math.imul(Ye,ct)|0,O=Math.imul(Ye,lt),x=x+Math.imul(Ke,ft)|0,m=m+Math.imul(Ke,ht)|0,m=m+Math.imul(We,ft)|0,O=O+Math.imul(We,ht)|0,x=x+Math.imul(_t,dt)|0,m=m+Math.imul(_t,gt)|0,m=m+Math.imul(Tt,dt)|0,O=O+Math.imul(Tt,gt)|0,x=x+Math.imul(St,pt)|0,m=m+Math.imul(St,mt)|0,m=m+Math.imul(It,pt)|0,O=O+Math.imul(It,mt)|0;var ww=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ww>>>26)|0,ww&=67108863,x=Math.imul($e,ft),m=Math.imul($e,ht),m=m+Math.imul(Ye,ft)|0,O=Math.imul(Ye,ht),x=x+Math.imul(Ke,dt)|0,m=m+Math.imul(Ke,gt)|0,m=m+Math.imul(We,dt)|0,O=O+Math.imul(We,gt)|0,x=x+Math.imul(_t,pt)|0,m=m+Math.imul(_t,mt)|0,m=m+Math.imul(Tt,pt)|0,O=O+Math.imul(Tt,mt)|0;var vw=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(vw>>>26)|0,vw&=67108863,x=Math.imul($e,dt),m=Math.imul($e,gt),m=m+Math.imul(Ye,dt)|0,O=Math.imul(Ye,gt),x=x+Math.imul(Ke,pt)|0,m=m+Math.imul(Ke,mt)|0,m=m+Math.imul(We,pt)|0,O=O+Math.imul(We,mt)|0;var Aw=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(Aw>>>26)|0,Aw&=67108863,x=Math.imul($e,pt),m=Math.imul($e,mt),m=m+Math.imul(Ye,pt)|0,O=Math.imul(Ye,mt);var Ew=(M+x|0)+((m&8191)<<13)|0;return M=(O+(m>>>13)|0)+(Ew>>>26)|0,Ew&=67108863,T[0]=An,T[1]=En,T[2]=bn,T[3]=Sn,T[4]=In,T[5]=_n,T[6]=la,T[7]=fa,T[8]=ha,T[9]=da,T[10]=ga,T[11]=pa,T[12]=ma,T[13]=ya,T[14]=wa,T[15]=ww,T[16]=vw,T[17]=Aw,T[18]=Ew,M!==0&&(T[19]=M,y.length++),y};Math.imul||(U=V);function Q(l,g,y){y.negative=g.negative^l.negative,y.length=l.length+g.length;for(var E=0,I=0,T=0;T>>26)|0,I+=M>>>26,M&=67108863}y.words[T]=x,E=M,M=I}return E!==0?y.words[T]=E:y.length--,y._strip()}function L(l,g,y){return Q(l,g,y)}s.prototype.mulTo=function(l,g){var y,E=this.length+l.length;return this.length===10&&l.length===10?y=U(this,l,g):E<63?y=V(this,l,g):E<1024?y=Q(this,l,g):y=L(this,l,g),y},s.prototype.mul=function(l){var g=new s(null);return g.words=new Array(this.length+l.length),this.mulTo(l,g)},s.prototype.mulf=function(l){var g=new s(null);return g.words=new Array(this.length+l.length),L(this,l,g)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var g=l<0;g&&(l=-l),n(typeof l=="number"),n(l<67108864);for(var y=0,E=0;E>=26,y+=I/67108864|0,y+=T>>>26,this.words[E]=T&67108863}return y!==0&&(this.words[E]=y,this.length++),g?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var g=P(l);if(g.length===0)return new s(1);for(var y=this,E=0;E=0);var g=l%26,y=(l-g)/26,E=67108863>>>26-g<<26-g,I;if(g!==0){var T=0;for(I=0;I>>26-g}T&&(this.words[I]=T,this.length++)}if(y!==0){for(I=this.length-1;I>=0;I--)this.words[I+y]=this.words[I];for(I=0;I=0);var E;g?E=(g-g%26)/26:E=0;var I=l%26,T=Math.min((l-I)/26,this.length),M=67108863^67108863>>>I<T)for(this.length-=T,m=0;m=0&&(O!==0||m>=E);m--){var Y=this.words[m]|0;this.words[m]=O<<26-I|Y>>>I,O=Y&M}return x&&O!==0&&(x.words[x.length++]=O),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,g,y){return n(this.negative===0),this.iushrn(l,g,y)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){n(typeof l=="number"&&l>=0);var g=l%26,y=(l-g)/26,E=1<=0);var g=l%26,y=(l-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(g!==0&&y++,this.length=Math.min(y,this.length),g!==0){var E=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(l){if(n(typeof l=="number"),n(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(x/67108864|0),this.words[I+y]=T&67108863}for(;I>26,this.words[I+y]=T&67108863;if(M===0)return this._strip();for(n(M===-1),M=0,I=0;I>26,this.words[I]=T&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,g){var y=this.length-l.length,E=this.clone(),I=l,T=I.words[I.length-1]|0,M=this._countBits(T);y=26-M,y!==0&&(I=I.ushln(y),E.iushln(y),T=I.words[I.length-1]|0);var x=E.length-I.length,m;if(g!=="mod"){m=new s(null),m.length=x+1,m.words=new Array(m.length);for(var O=0;O=0;$--){var b=(E.words[I.length+$]|0)*67108864+(E.words[I.length+$-1]|0);for(b=Math.min(b/T|0,67108863),E._ishlnsubmul(I,b,$);E.negative!==0;)b--,E.negative=0,E._ishlnsubmul(I,1,$),E.isZero()||(E.negative^=1);m&&(m.words[$]=b)}return m&&m._strip(),E._strip(),g!=="div"&&y!==0&&E.iushrn(y),{div:m||null,mod:E}},s.prototype.divmod=function(l,g,y){if(n(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var E,I,T;return this.negative!==0&&l.negative===0?(T=this.neg().divmod(l,g),g!=="mod"&&(E=T.div.neg()),g!=="div"&&(I=T.mod.neg(),y&&I.negative!==0&&I.iadd(l)),{div:E,mod:I}):this.negative===0&&l.negative!==0?(T=this.divmod(l.neg(),g),g!=="mod"&&(E=T.div.neg()),{div:E,mod:T.mod}):this.negative&l.negative?(T=this.neg().divmod(l.neg(),g),g!=="div"&&(I=T.mod.neg(),y&&I.negative!==0&&I.isub(l)),{div:T.div,mod:I}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?g==="div"?{div:this.divn(l.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,g)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var g=this.divmod(l);if(g.mod.isZero())return g.div;var y=g.div.negative!==0?g.mod.isub(l):g.mod,E=l.ushrn(1),I=l.andln(1),T=y.cmp(E);return T<0||I===1&&T===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(l){var g=l<0;g&&(l=-l),n(l<=67108863);for(var y=(1<<26)%l,E=0,I=this.length-1;I>=0;I--)E=(y*E+(this.words[I]|0))%l;return g?-E:E},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var g=l<0;g&&(l=-l),n(l<=67108863);for(var y=0,E=this.length-1;E>=0;E--){var I=(this.words[E]|0)+y*67108864;this.words[E]=I/l|0,y=I%l}return this._strip(),g?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){n(l.negative===0),n(!l.isZero());var g=this,y=l.clone();g.negative!==0?g=g.umod(l):g=g.clone();for(var E=new s(1),I=new s(0),T=new s(0),M=new s(1),x=0;g.isEven()&&y.isEven();)g.iushrn(1),y.iushrn(1),++x;for(var m=y.clone(),O=g.clone();!g.isZero();){for(var Y=0,$=1;!(g.words[0]&$)&&Y<26;++Y,$<<=1);if(Y>0)for(g.iushrn(Y);Y-- >0;)(E.isOdd()||I.isOdd())&&(E.iadd(m),I.isub(O)),E.iushrn(1),I.iushrn(1);for(var b=0,j=1;!(y.words[0]&j)&&b<26;++b,j<<=1);if(b>0)for(y.iushrn(b);b-- >0;)(T.isOdd()||M.isOdd())&&(T.iadd(m),M.isub(O)),T.iushrn(1),M.iushrn(1);g.cmp(y)>=0?(g.isub(y),E.isub(T),I.isub(M)):(y.isub(g),T.isub(E),M.isub(I))}return{a:T,b:M,gcd:y.iushln(x)}},s.prototype._invmp=function(l){n(l.negative===0),n(!l.isZero());var g=this,y=l.clone();g.negative!==0?g=g.umod(l):g=g.clone();for(var E=new s(1),I=new s(0),T=y.clone();g.cmpn(1)>0&&y.cmpn(1)>0;){for(var M=0,x=1;!(g.words[0]&x)&&M<26;++M,x<<=1);if(M>0)for(g.iushrn(M);M-- >0;)E.isOdd()&&E.iadd(T),E.iushrn(1);for(var m=0,O=1;!(y.words[0]&O)&&m<26;++m,O<<=1);if(m>0)for(y.iushrn(m);m-- >0;)I.isOdd()&&I.iadd(T),I.iushrn(1);g.cmp(y)>=0?(g.isub(y),E.isub(I)):(y.isub(g),I.isub(E))}var Y;return g.cmpn(1)===0?Y=E:Y=I,Y.cmpn(0)<0&&Y.iadd(l),Y},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var g=this.clone(),y=l.clone();g.negative=0,y.negative=0;for(var E=0;g.isEven()&&y.isEven();E++)g.iushrn(1),y.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;y.isEven();)y.iushrn(1);var I=g.cmp(y);if(I<0){var T=g;g=y,y=T}else if(I===0||y.cmpn(1)===0)break;g.isub(y)}while(!0);return y.iushln(E)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){n(typeof l=="number");var g=l%26,y=(l-g)/26,E=1<>>26,M&=67108863,this.words[T]=M}return I!==0&&(this.words[T]=I,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var g=l<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var y;if(this.length>1)y=1;else{g&&(l=-l),n(l<=67108863,"Number is too big");var E=this.words[0]|0;y=E===l?0:El.length)return 1;if(this.length=0;y--){var E=this.words[y]|0,I=l.words[y]|0;if(E!==I){EI&&(g=1);break}}return g},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new F(l)},s.prototype.toRed=function(l){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return n(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return n(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var k={k256:null,p224:null,p192:null,p25519:null};function H(l,g){this.name=l,this.p=new s(g,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}H.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},H.prototype.ireduce=function(l){var g=l,y;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),y=g.bitLength();while(y>this.n);var E=y0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},H.prototype.split=function(l,g){l.iushrn(this.n,0,g)},H.prototype.imulK=function(l){return l.imul(this.k)};function q(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,H),q.prototype.split=function(l,g){for(var y=4194303,E=Math.min(l.length,9),I=0;I>>22,T=M}T>>>=22,l.words[I-10]=T,T===0&&l.length>10?l.length-=10:l.length-=9},q.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var g=0,y=0;y>>=26,l.words[y]=I,g=E}return g!==0&&(l.words[l.length++]=g),l},s._prime=function(l){if(k[l])return k[l];var g;if(l==="k256")g=new q;else if(l==="p224")g=new v;else if(l==="p192")g=new C;else if(l==="p25519")g=new R;else throw new Error("Unknown prime "+l);return k[l]=g,g};function F(l){if(typeof l=="string"){var g=s._prime(l);this.m=g.p,this.prime=g}else n(l.gtn(1),"modulus must be greater than 1"),this.m=l,this.prime=null}F.prototype._verify1=function(l){n(l.negative===0,"red works only with positives"),n(l.red,"red works only with red numbers")},F.prototype._verify2=function(l,g){n((l.negative|g.negative)===0,"red works only with positives"),n(l.red&&l.red===g.red,"red works only with red numbers")},F.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(f(l,l.umod(this.m)._forceRed(this)),l)},F.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},F.prototype.add=function(l,g){this._verify2(l,g);var y=l.add(g);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},F.prototype.iadd=function(l,g){this._verify2(l,g);var y=l.iadd(g);return y.cmp(this.m)>=0&&y.isub(this.m),y},F.prototype.sub=function(l,g){this._verify2(l,g);var y=l.sub(g);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},F.prototype.isub=function(l,g){this._verify2(l,g);var y=l.isub(g);return y.cmpn(0)<0&&y.iadd(this.m),y},F.prototype.shl=function(l,g){return this._verify1(l),this.imod(l.ushln(g))},F.prototype.imul=function(l,g){return this._verify2(l,g),this.imod(l.imul(g))},F.prototype.mul=function(l,g){return this._verify2(l,g),this.imod(l.mul(g))},F.prototype.isqr=function(l){return this.imul(l,l.clone())},F.prototype.sqr=function(l){return this.mul(l,l)},F.prototype.sqrt=function(l){if(l.isZero())return l.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var y=this.m.add(new s(1)).iushrn(2);return this.pow(l,y)}for(var E=this.m.subn(1),I=0;!E.isZero()&&E.andln(1)===0;)I++,E.iushrn(1);n(!E.isZero());var T=new s(1).toRed(this),M=T.redNeg(),x=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new s(2*m*m).toRed(this);this.pow(m,x).cmp(M)!==0;)m.redIAdd(M);for(var O=this.pow(m,E),Y=this.pow(l,E.addn(1).iushrn(1)),$=this.pow(l,E),b=I;$.cmp(T)!==0;){for(var j=$,z=0;j.cmp(T)!==0;z++)j=j.redSqr();n(z=0;I--){for(var O=g.words[I],Y=m-1;Y>=0;Y--){var $=O>>Y&1;if(T!==E[0]&&(T=this.sqr(T)),$===0&&M===0){x=0;continue}M<<=1,M|=$,x++,!(x!==y&&(I!==0||Y!==0))&&(T=this.mul(T,E[M]),x=0,M=0)}m=26}return T},F.prototype.convertTo=function(l){var g=l.umod(this.m);return g===l?g.clone():g},F.prototype.convertFrom=function(l){var g=l.clone();return g.red=null,g},s.mont=function(l){return new B(l)};function B(l){F.call(this,l),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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(B,F),B.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},B.prototype.convertFrom=function(l){var g=this.imod(l.mul(this.rinv));return g.red=null,g},B.prototype.imul=function(l,g){if(l.isZero()||g.isZero())return l.words[0]=0,l.length=1,l;var y=l.imul(g),E=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=y.isub(E).iushrn(this.shift),T=I;return I.cmp(this.m)>=0?T=I.isub(this.m):I.cmpn(0)<0&&(T=I.iadd(this.m)),T._forceRed(this)},B.prototype.mul=function(l,g){if(l.isZero()||g.isZero())return new s(0)._forceRed(this);var y=l.mul(g),E=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=y.isub(E).iushrn(this.shift),T=I;return I.cmp(this.m)>=0?T=I.isub(this.m):I.cmpn(0)<0&&(T=I.iadd(this.m)),T._forceRed(this)},B.prototype.invm=function(l){var g=this.imod(l._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,y4)})(E4);var Se=E4.exports,b4="bignumber/5.7.0",Jm=Se.BN,Qs=new kt(b4),g_={},NM=9007199254740991;function Jte(t){return t!=null&&(Nr.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||pn(t)||typeof t=="bigint"||cl(t))}var xM=!1,Nr=class t{constructor(e,r){e!==g_&&Qs.throwError("cannot call constructor directly; use BigNumber.from",kt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return on(De(this).fromTwos(e))}toTwos(e){return on(De(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return on(De(this).add(De(e)))}sub(e){return on(De(this).sub(De(e)))}div(e){return t.from(e).isZero()&&$n("division-by-zero","div"),on(De(this).div(De(e)))}mul(e){return on(De(this).mul(De(e)))}mod(e){let r=De(e);return r.isNeg()&&$n("division-by-zero","mod"),on(De(this).umod(r))}pow(e){let r=De(e);return r.isNeg()&&$n("negative-power","pow"),on(De(this).pow(r))}and(e){let r=De(e);return(this.isNegative()||r.isNeg())&&$n("unbound-bitwise-result","and"),on(De(this).and(r))}or(e){let r=De(e);return(this.isNegative()||r.isNeg())&&$n("unbound-bitwise-result","or"),on(De(this).or(r))}xor(e){let r=De(e);return(this.isNegative()||r.isNeg())&&$n("unbound-bitwise-result","xor"),on(De(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&$n("negative-width","mask"),on(De(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&$n("negative-width","shl"),on(De(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&$n("negative-width","shr"),on(De(this).shrn(e))}eq(e){return De(this).eq(De(e))}lt(e){return De(this).lt(De(e))}lte(e){return De(this).lte(De(e))}gt(e){return De(this).gt(De(e))}gte(e){return De(this).gte(De(e))}isNegative(){return this._hex[0]==="-"}isZero(){return De(this).isZero()}toNumber(){try{return De(this).toNumber()}catch{$n("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Qs.throwError("this platform does not support BigInt",kt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?xM||(xM=!0,Qs.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Qs.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",kt.errors.UNEXPECTED_ARGUMENT,{}):Qs.throwError("BigNumber.toString does not accept parameters",kt.errors.UNEXPECTED_ARGUMENT,{})),De(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(g_,Uh(e)):e.match(/^-?[0-9]+$/)?new t(g_,Uh(new Jm(e))):Qs.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&$n("underflow","BigNumber.from",e),(e>=NM||e<=-NM)&&$n("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(cl(r))return t.from(Gr(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return t.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pn(n)||n[0]==="-"&&pn(n.substring(1))))return t.from(n)}return Qs.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function Uh(t){if(typeof t!="string")return Uh(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Qs.throwArgumentError("invalid hex","value",t),t=Uh(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function on(t){return Nr.from(Uh(t))}function De(t){let e=Nr.from(t).toHexString();return e[0]==="-"?new Jm("-"+e.substring(3),16):new Jm(e.substring(2),16)}function $n(t,e,r){let n={fault:t,operation:e};return r!=null&&(n.value=r),Qs.throwError(t,kt.errors.NUMERIC_FAULT,n)}function Xte(t){return new Jm(t,36).toString(16)}var jr=new kt(b4),Mh={},S4=Nr.from(0),I4=Nr.from(-1);function _4(t,e,r,n){let i={fault:e,operation:r};return n!==void 0&&(i.value=n),jr.throwError(t,kt.errors.NUMERIC_FAULT,i)}var Lh="0";for(;Lh.length<256;)Lh+=Lh;function z_(t){if(typeof t!="number")try{t=Nr.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Lh.substring(0,t):jr.throwArgumentError("invalid decimal size","decimals",t)}function p_(t,e){e==null&&(e=0);let r=z_(e);t=Nr.from(t);let n=t.lt(S4);n&&(t=t.mul(I4));let i=t.mod(r).toString();for(;i.length2&&jr.throwArgumentError("too many decimal points","value",t);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&_4("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.lengthe[o]==null?a:(typeof e[o]!==u&&jr.throwArgumentError("invalid fixed format ("+o+" not "+u+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&jr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&jr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(Mh,r,n,i)}},Xm=class t{constructor(e,r,n,i){e!==Mh&&jr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",kt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&jr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(OM.toFormat(r.format))),r}ceiling(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(OM.toFormat(r.format))),r}round(e){e==null&&(e=0);let r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&jr.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;let n=t.from("1"+Lh.substring(0,e),this.format),i=Zte.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&jr.throwArgumentError("invalid byte width","width",e);let r=Nr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return fs(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return t.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!Jte(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),t.fromString(p_(e,r),Fh.from(n))}static fromString(e,r){r==null&&(r="fixed");let n=Fh.from(r),i=zs(e,n.decimals);!n.signed&&i.lt(S4)&&_4("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=fs(s,n.width/8));let o=p_(i,n.decimals);return new t(Mh,s,o,n)}static fromBytes(e,r){r==null&&(r="fixed");let n=Fh.from(r);if(Qt(e).length>n.width/8)throw new Error("overflow");let i=Nr.from(e);n.signed&&(i=i.fromTwos(n.width));let s=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=p_(i,n.decimals);return new t(Mh,s,o,n)}static from(e,r){if(typeof e=="string")return t.fromString(e,r);if(cl(e))return t.fromBytes(e,r);try{return t.fromValue(e,0,r)}catch(n){if(n.code!==kt.errors.INVALID_ARGUMENT)throw n}return jr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}},OM=Xm.from(1),Zte=Xm.from("0.5"),ere="strings/5.7.0",T4=new kt(ere),Zm;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Zm||(Zm={}));var nl;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(nl||(nl={}));function tre(t,e,r,n,i){return T4.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function C4(t,e,r,n,i){if(t===nl.BAD_PREFIX||t===nl.UNEXPECTED_CONTINUE){let s=0;for(let o=e+1;o>6===2;o++)s++;return s}return t===nl.OVERRUN?r.length-e-1:0}function rre(t,e,r,n,i){return t===nl.OVERLONG?(n.push(i),0):(n.push(65533),C4(t,e,r))}Object.freeze({error:tre,ignore:C4,replace:rre});function m_(t,e=Zm.current){e!=Zm.current&&(T4.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;let s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return Qt(r)}function nre(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function DM(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}DM("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),y_("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),y_("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),y_("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",nre),DM("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");var N4="hash/5.7.0";function ire(t){t=atob(t);let e=[];for(let r=0;r0&&Array.isArray(u)?i(u,o-1):r.push(u)})};return i(t,e),r}function sre(t){let e={};for(let r=0;r>--a&1}let d=31,w=Math.pow(2,d),A=w>>>1,_=A>>1,N=w-1,P=0;for(let k=0;k1;){let R=H+q>>>1;k>>1|f(),v=v<<1^A,C=(C^A)<<1|A|1;U=v,Q=1+C-v}let L=n-4;return V.map(k=>{switch(k-L){case 3:return L+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return L+256+(t[u++]<<8|t[u++]);case 1:return L+t[u++];default:return k-1}})}function are(t){let e=0;return()=>t[e++]}function ure(t){return are(ore(t))}function cre(t){return t&1?~t>>1:t>>1}function lre(t,e){let r=Array(t);for(let n=0;ne[o]):r}function hre(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(gre(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(pre(r,t))}return sre(x4(e))}function dre(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function O4(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[o].push(s));return n}function gre(t,e){let r=1+e(),n=e(),i=dre(e),s=O4(i.length,1+t,e);return x4(s.map((o,u)=>{let a=o[0],c=o.slice(1);return Array(i[u]).fill(void 0).map((f,d)=>{let w=d*n;return[a+d*r,c.map(A=>A+w)]})}))}function pre(t,e){let r=1+e();return O4(r,1+t,e).map(n=>[n[0],n.slice(1)])}function mre(t){let e=ey(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let c=ey(t,e);if(c.length==0)break;n.push({set:new Set(c),node:r()})}n.sort((c,f)=>f.set.size-c.set.size);let i=t(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let u=i==1,a=i==2;return{branches:n,valid:s,fe0f:o,save:u,check:a}}}function yre(){return ure(ire("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}var km=yre();new Set(ey(km)),new Set(ey(km)),hre(km),mre(km),new kt(N4);var wre=new Uint8Array(32);wre.fill(0);var vre=`Ethereum Signed Message: -`;function D4(t){return typeof t=="string"&&(t=m_(t)),j_(zte([m_(vre),m_(String(t.length)),t]))}var Are="rlp/5.7.0";new kt(Are);var Ere="address/5.7.0",Bh=new kt(Ere);function RM(t){pn(t,20)||Bh.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);let n=Qt(j_(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}var bre=9007199254740991;function Sre(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var Q_={};for(let t=0;t<10;t++)Q_[String(t)]=String(t);for(let t=0;t<26;t++)Q_[String.fromCharCode(65+t)]=String(10+t);var BM=Math.floor(Sre(bre));function Ire(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Q_[n]).join("");for(;e.length>=BM;){let n=e.substring(0,BM);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function _re(t){let e=null;if(typeof t!="string"&&Bh.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=RM(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Bh.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Ire(t)&&Bh.throwArgumentError("bad icap checksum","address",t),e=Xte(t.substring(4));e.length<40;)e="0"+e;e=RM("0x"+e)}else Bh.throwArgumentError("invalid address","address",t);return e}var Tre="properties/5.7.0";new kt(Tre);function Dh(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new kt(N4);var Cre=new Uint8Array(32);Cre.fill(0),Nr.from(-1);var Nre=Nr.from(0),xre=Nr.from(1);Nr.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),fs(xre.toHexString(),32),fs(Nre.toHexString(),32);var os={},Pe={},kh=P4;function P4(t,e){if(!t)throw new Error(e||"Assertion failed")}P4.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var x_={exports:{}};typeof Object.create=="function"?x_.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:x_.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var Ore=kh,Dre=x_.exports;Pe.inherits=Dre;function Pre(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function Rre(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):Pre(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Pe.htonl=R4;function Mre(t,e){for(var r="",n=0;n>>0}return s}Pe.join32=Lre;function Fre(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Pe.split32=Fre;function Ure(t,e){return t>>>e|t<<32-e}Pe.rotr32=Ure;function qre(t,e){return t<>>32-e}Pe.rotl32=qre;function Vre(t,e){return t+e>>>0}Pe.sum32=Vre;function kre(t,e,r){return t+e+r>>>0}Pe.sum32_3=kre;function Hre(t,e,r,n){return t+e+r+n>>>0}Pe.sum32_4=Hre;function Gre(t,e,r,n,i){return t+e+r+n+i>>>0}Pe.sum32_5=Gre;function jre(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,u=(o>>0,t[e+1]=o}Pe.sum64=jre;function zre(t,e,r,n){var i=e+n>>>0,s=(i>>0}Pe.sum64_hi=zre;function Qre(t,e,r,n){var i=e+n;return i>>>0}Pe.sum64_lo=Qre;function Kre(t,e,r,n,i,s,o,u){var a=0,c=e;c=c+n>>>0,a+=c>>0,a+=c>>0,a+=c>>0}Pe.sum64_4_hi=Kre;function Wre(t,e,r,n,i,s,o,u){var a=e+n+s+u;return a>>>0}Pe.sum64_4_lo=Wre;function $re(t,e,r,n,i,s,o,u,a,c){var f=0,d=e;d=d+n>>>0,f+=d>>0,f+=d>>0,f+=d>>0,f+=d>>0}Pe.sum64_5_hi=$re;function Yre(t,e,r,n,i,s,o,u,a,c){var f=e+n+s+u+c;return f>>>0}Pe.sum64_5_lo=Yre;function Jre(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Pe.rotr64_hi=Jre;function Xre(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pe.rotr64_lo=Xre;function Zre(t,e,r){return t>>>r}Pe.shr64_hi=Zre;function ene(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pe.shr64_lo=ene;var ll={},MM=Pe,tne=kh;function Hm(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}ll.BlockHash=Hm,Hm.prototype.update=function(t,e){if(t=MM.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=MM.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s>>3}ms.g0_256=one;function ane(t){return hs(t,17)^hs(t,19)^t>>>10}ms.g1_256=ane;var ol=Pe,une=ll,cne=ms,w_=ol.rotl32,Ph=ol.sum32,lne=ol.sum32_5,fne=cne.ft_1,q4=une.BlockHash,hne=[1518500249,1859775393,2400959708,3395469782];function us(){if(!(this instanceof us))return new us;q4.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ol.inherits(us,q4);var dne=us;us.blockSize=512,us.outSize=160,us.hmacStrength=80,us.padLength=64,us.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=new this.Hash().update(t).digest()),eie(t.length<=this.blockSize);for(var e=t.length;e>8,w=f&255;d?a.push(d,w):a.push(w)}return a}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var u="",a=0;a(w>>1)-1?N=(w>>1)-P:N=P,A.isubn(N)):N=0,d[_]=N,A.iushrn(1)}return d}r.getNAF=n;function i(a,c){var f=[[],[]];a=a.clone(),c=c.clone();for(var d=0,w=0,A;a.cmpn(-d)>0||c.cmpn(-w)>0;){var _=a.andln(3)+d&3,N=c.andln(3)+w&3;_===3&&(_=-1),N===3&&(N=-1);var P;_&1?(A=a.andln(7)+d&7,(A===3||A===5)&&N===2?P=-_:P=_):P=0,f[0].push(P);var V;N&1?(A=c.andln(7)+w&7,(A===3||A===5)&&_===2?V=-N:V=N):V=0,f[1].push(V),2*d===P+1&&(d=1-d),2*w===V+1&&(w=1-w),a.iushrn(1),c.iushrn(1)}return f}r.getJSF=i;function s(a,c,f){var d="_"+c;a.prototype[c]=function(){return this[d]!==void 0?this[d]:this[d]=f.call(this)}}r.cachedProperty=s;function o(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=o;function u(a){return new Se(a,"hex","le")}r.intFromLE=u}),jm=mn.getNAF,nie=mn.getJSF,ty=mn.assert;function Uo(t,e){this.type=t,this.p=new Se(e.p,16),this.red=e.prime?Se.red(e.prime):Se.mont(this.p),this.zero=new Se(0).toRed(this.red),this.one=new Se(1).toRed(this.red),this.two=new Se(2).toRed(this.red),this.n=e.n&&new Se(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var eu=Uo;Uo.prototype.point=function(){throw new Error("Not implemented")},Uo.prototype.validate=function(){throw new Error("Not implemented")},Uo.prototype._fixedNafMul=function(t,e){ty(t.precomputed);var r=t._getDoubles(),n=jm(e,1,this._bitLength),i=(1<=o;a--)u=(u<<1)+n[a];s.push(u)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;u--){for(var a=0;u>=0&&s[u]===0;u--)a++;if(u>=0&&a++,o=o.dblp(a),u<0)break;var c=s[u];ty(c!==0),t.type==="affine"?c>0?o=o.mixedAdd(i[c-1>>1]):o=o.mixedAdd(i[-c-1>>1].neg()):c>0?o=o.add(i[c-1>>1]):o=o.add(i[-c-1>>1].neg())}return t.type==="affine"?o.toP():o},Uo.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,o=this._wnafT2,u=this._wnafT3,a=0,c,f,d;for(c=0;c=1;c-=2){var A=c-1,_=c;if(s[A]!==1||s[_]!==1){u[A]=jm(r[A],s[A],this._bitLength),u[_]=jm(r[_],s[_],this._bitLength),a=Math.max(u[A].length,a),a=Math.max(u[_].length,a);continue}var N=[e[A],null,null,e[_]];e[A].y.cmp(e[_].y)===0?(N[1]=e[A].add(e[_]),N[2]=e[A].toJ().mixedAdd(e[_].neg())):e[A].y.cmp(e[_].y.redNeg())===0?(N[1]=e[A].toJ().mixedAdd(e[_]),N[2]=e[A].add(e[_].neg())):(N[1]=e[A].toJ().mixedAdd(e[_]),N[2]=e[A].toJ().mixedAdd(e[_].neg()));var P=[-3,-1,-5,-7,0,7,5,1,3],V=nie(r[A],r[_]);for(a=Math.max(V[0].length,a),u[A]=new Array(a),u[_]=new Array(a),f=0;f=0;c--){for(var H=0;c>=0;){var q=!0;for(f=0;f=0&&H++,L=L.dblp(H),c<0)break;for(f=0;f0?d=o[f][v-1>>1]:v<0&&(d=o[f][-v-1>>1].neg()),d.type==="affine"?L=L.mixedAdd(d):L=L.add(d))}}for(c=0;c=Math.ceil((t.bitLength()+1)/e.step):!1},Yn.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(w=a,A=c),f.negative&&(f=f.neg(),d=d.neg()),w.negative&&(w=w.neg(),A=A.neg()),[{a:f,b:d},{a:w,b:A}]},Xn.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),u=s.mul(n.a),a=i.mul(r.b),c=s.mul(n.b),f=t.sub(o).sub(u),d=a.add(c).neg();return{k1:f,k2:d}},Xn.prototype.pointFromX=function(t,e){t=new Se(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Xn.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Xn.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},Er.prototype.isInfinity=function(){return this.inf},Er.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Er.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},Er.prototype.getX=function(){return this.x.fromRed()},Er.prototype.getY=function(){return this.y.fromRed()},Er.prototype.mul=function(t){return t=new Se(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Er.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Er.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Er.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},Er.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},Er.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Cr(t,e,r,n){eu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Se(0)):(this.x=new Se(e,16),this.y=new Se(r,16),this.z=new Se(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}W_(Cr,eu.BasePoint),Xn.prototype.jpoint=function(t,e,r){return new Cr(this,t,e,r)},Cr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Cr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Cr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),u=n.redSub(i),a=s.redSub(o);if(u.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=u.redSqr(),f=c.redMul(u),d=n.redMul(c),w=a.redSqr().redIAdd(f).redISub(d).redISub(d),A=a.redMul(d.redISub(w)).redISub(s.redMul(f)),_=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(w,A,_)},Cr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),u=i.redSub(s);if(o.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var a=o.redSqr(),c=a.redMul(o),f=r.redMul(a),d=u.redSqr().redIAdd(c).redISub(f).redISub(f),w=u.redMul(f.redISub(d)).redISub(i.redMul(c)),A=this.z.redMul(o);return this.curve.jpoint(d,w,A)},Cr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Cr.prototype.inspect=function(){return this.isInfinity()?"":""},Cr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Km=hl(function(t,e){var r=e;r.base=eu,r.short=sie,r.mont=null,r.edwards=null}),Wm=hl(function(t,e){var r=e,n=mn.assert;function i(u){u.type==="short"?this.curve=new Km.short(u):u.type==="edwards"?this.curve=new Km.edwards(u):this.curve=new Km.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(u,a){Object.defineProperty(r,u,{configurable:!0,enumerable:!0,get:function(){var c=new i(a);return Object.defineProperty(r,u,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:os.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:os.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:os.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:os.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:os.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:os.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:os.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:os.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function qo(t){if(!(this instanceof qo))return new qo(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ni.toArray(t.entropy,t.entropyEnc||"hex"),r=Ni.toArray(t.nonce,t.nonceEnc||"hex"),n=Ni.toArray(t.pers,t.persEnc||"hex");K_(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var qM=qo;qo.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},qo.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=Ni.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var oie=mn.assert;function sy(t,e){if(t instanceof sy)return t;this._importDER(t,e)||(oie(t.r&&t.s,"Signature without r or s"),this.r=new Se(t.r,16),this.s=new Se(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var zm=sy;function aie(){this.place=0}function S_(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function VM(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}sy.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=VM(e),r=VM(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];I_(n,e.length),n=n.concat(e),n.push(2),I_(n,r.length);var i=n.concat(r),s=[48];return I_(s,i.length),s=s.concat(i),mn.encode(s,t)};var uie=function(){throw new Error("unsupported")},J4=mn.assert;function Jn(t){if(!(this instanceof Jn))return new Jn(t);typeof t=="string"&&(J4(Object.prototype.hasOwnProperty.call(Wm,t),"Unknown curve "+t),t=Wm[t]),t instanceof Wm.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var cie=Jn;Jn.prototype.keyPair=function(t){return new b_(this,t)},Jn.prototype.keyFromPrivate=function(t,e){return b_.fromPrivate(this,t,e)},Jn.prototype.keyFromPublic=function(t,e){return b_.fromPublic(this,t,e)},Jn.prototype.genKeyPair=function(t){t||(t={});for(var e=new qM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||uie(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Se(2));;){var i=new Se(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Jn.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Jn.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new Se(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),o=t.toArray("be",i),u=new qM({hash:this.hash,entropy:s,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),a=this.n.sub(new Se(1)),c=0;;c++){var f=n.k?n.k(c):new Se(u.generate(this.n.byteLength()));if(f=this._truncateToN(f,!0),!(f.cmpn(1)<=0||f.cmp(a)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var w=d.getX(),A=w.umod(this.n);if(A.cmpn(0)!==0){var _=f.invm(this.n).mul(A.mul(e.getPrivate()).iadd(t));if(_=_.umod(this.n),_.cmpn(0)!==0){var N=(d.getY().isOdd()?1:0)|(w.cmp(A)!==0?2:0);return n.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),N^=1),new zm({r:A,s:_,recoveryParam:N})}}}}}},Jn.prototype.verify=function(t,e,r,n){t=this._truncateToN(new Se(t,16)),r=this.keyFromPublic(r,n),e=new zm(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o=s.invm(this.n),u=o.mul(t).umod(this.n),a=o.mul(i).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(u,r.getPublic(),a),c.isInfinity()?!1:c.eqXToP(i)):(c=this.g.mulAdd(u,r.getPublic(),a),c.isInfinity()?!1:c.getX().umod(this.n).cmp(i)===0)},Jn.prototype.recoverPubKey=function(t,e,r,n){J4((3&r)===r,"The recovery param is more than two bits"),e=new zm(e,n);var i=this.n,s=new Se(t),o=e.r,u=e.s,a=r&1,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),a):o=this.curve.pointFromX(o,a);var f=e.r.invm(i),d=i.sub(s).mul(f).umod(i),w=u.mul(f).umod(i);return this.g.mulAdd(d,o,w)},Jn.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new zm(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var lie=hl(function(t,e){var r=e;r.version="6.5.4",r.utils=mn,r.rand=function(){throw new Error("unsupported")},r.curve=Km,r.curves=Wm,r.ec=cie,r.eddsa=null}),fie=lie.ec,hie="signing-key/5.7.0",P_=new kt(hie),__=null;function ls(){return __||(__=new fie("secp256k1")),__}var R_=class{constructor(e){Dh(this,"curve","secp256k1"),Dh(this,"privateKey",Gr(e)),Kte(this.privateKey)!==32&&P_.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let r=ls().keyFromPrivate(Qt(this.privateKey));Dh(this,"publicKey","0x"+r.getPublic(!1,"hex")),Dh(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),Dh(this,"_isSigningKey",!0)}_addPoint(e){let r=ls().keyFromPublic(Qt(this.publicKey)),n=ls().keyFromPublic(Qt(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){let r=ls().keyFromPrivate(Qt(this.privateKey)),n=Qt(e);n.length!==32&&P_.throwArgumentError("bad digest length","digest",e);let i=r.sign(n,{canonical:!0});return A4({recoveryParam:i.recoveryParam,r:fs("0x"+i.r.toString(16),32),s:fs("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let r=ls().keyFromPrivate(Qt(this.privateKey)),n=ls().keyFromPublic(Qt(X4(e)));return fs("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};function die(t,e){let r=A4(e),n={r:Qt(r.r),s:Qt(r.s)};return"0x"+ls().recoverPubKey(Qt(t),n,r.recoveryParam).encode("hex",!1)}function X4(t,e){let r=Qt(t);if(r.length===32){let n=new R_(r);return e?"0x"+ls().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?Gr(r):"0x"+ls().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+ls().keyFromPublic(r).getPublic(!0,"hex"):Gr(r)}return P_.throwArgumentError("invalid public or private key","key","[REDACTED]")}var gie="transactions/5.7.0";new kt(gie);var kM;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(kM||(kM={}));function pie(t){let e=X4(t);return _re(CM(j_(CM(e,1)),12))}function mie(t,e){return pie(die(Qt(t),e))}var yie="https://rpc.walletconnect.com/v1";async function Z4(t,e,r,n,i,s){switch(r.t){case"eip191":return e5(t,e,r.s);case"eip1271":return await t5(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function e5(t,e,r){return mie(D4(e),r).toLowerCase()===t.toLowerCase()}async function t5(t,e,r,n,i,s){try{let o="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",c=r.substring(2),f=D4(e).substring(2),d=o+f+u+a+c,w=await fetch(`${s||yie}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:wie(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:d},"latest"]})}),{result:A}=await w.json();return A?A.slice(0,o.length).toLowerCase()===o.toLowerCase():!1}catch(o){return console.error("isValidEip1271Signature: ",o),!1}}function wie(){return Date.now()+Math.floor(Math.random()*1e3)}var vie=Object.defineProperty,Aie=Object.defineProperties,Eie=Object.getOwnPropertyDescriptors,HM=Object.getOwnPropertySymbols,bie=Object.prototype.hasOwnProperty,Sie=Object.prototype.propertyIsEnumerable,GM=(t,e,r)=>e in t?vie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$_=(t,e)=>{for(var r in e||(e={}))bie.call(e,r)&&GM(t,r,e[r]);if(HM)for(var r of HM(e))Sie.call(e,r)&&GM(t,r,e[r]);return t},r5=(t,e)=>Aie(t,Eie(e)),Iie="did:pkh:",oy=t=>t?.split(":"),Y_=t=>{let e=t&&oy(t);if(e)return t.includes(Iie)?e[3]:e[1]},_ie=t=>{let e=t&&oy(t);if(e)return e[2]+":"+e[3]},J_=t=>{let e=t&&oy(t);if(e)return e.pop()};async function Tie(t){let{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n5(i,i.iss),o=J_(i.iss);return await Z4(o,s,n,Y_(i.iss),r)}var n5=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=J_(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0,s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,u=`Chain ID: ${Y_(e)}`,a=`Nonce: ${t.nonce}`,c=`Issued At: ${t.iat}`,f=t.resources?`Resources:${t.resources.map(w=>` -- ${w}`).join("")}`:void 0,d=uy(t.resources);if(d){let w=Ho(d);i=eT(i,w)}return[r,n,"",i,"",s,o,u,a,c,f].filter(w=>w!=null).join(` -`)};function Cie(t,e,r){return r.includes("did:pkh:")||(r=`did:pkh:${r}`),{h:{t:"caip122"},p:{iss:r,domain:t.domain,aud:t.aud,version:t.version,nonce:t.nonce,iat:t.iat,statement:t.statement,requestId:t.requestId,resources:t.resources,nbf:t.nbf,exp:t.exp},s:e}}function Nie(t){var e;let{authPayload:r,chains:n,methods:i}=t,s=r.statement||"";if(!(n!=null&&n.length))return r;let o=r.chains,u=C_(o,n);if(!(u!=null&&u.length))throw new Error("No supported chains");let a=i5(r.resources);if(!a)return r;ps(a);let c=s5(a,"eip155"),f=r?.resources||[];if(c!=null&&c.length){let d=o5(c),w=C_(d,i);if(!(w!=null&&w.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(d)}, supported: ${JSON.stringify(i)}`);let A=X_("request",w,{chains:u}),_=l5(a,"eip155",A);f=((e=r?.resources)==null?void 0:e.slice(0,-1))||[],f.push(ay(_))}return r5($_({},r),{statement:h5(s,uy(f)),chains:u,resources:r!=null&&r.resources||f.length>0?f:void 0})}function i5(t){let e=uy(t);if(e&&Z_(e))return Ho(e)}function xie(t,e){var r;return(r=t?.att)==null?void 0:r.hasOwnProperty(e)}function s5(t,e){var r,n;return(r=t?.att)!=null&&r[e]?Object.keys((n=t?.att)==null?void 0:n[e]):[]}function Oie(t){return t?.map(e=>Object.keys(e))||[]}function o5(t){return t?.map(e=>{var r;return(r=e.split("/"))==null?void 0:r[1]})||[]}function a5(t){return p.Buffer.from(JSON.stringify(t)).toString("base64")}function u5(t){return JSON.parse(p.Buffer.from(t,"base64").toString("utf-8"))}function ps(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");let e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{let n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{let s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function c5(t,e,r,n={}){return r?.sort((i,s)=>i.localeCompare(s)),{att:{[t]:X_(e,r,n)}}}function l5(t,e,r){var n;return t.att[e]=$_({},r),((n=Object.keys(t.att))==null?void 0:n.sort((i,s)=>i.localeCompare(s))).reduce((i,s)=>(i.att[s]=t.att[s],i),{att:{}})}function X_(t,e,r={}){e=e?.sort((i,s)=>i.localeCompare(s));let n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function ay(t){return ps(t),`urn:recap:${a5(t).replace(/=/g,"")}`}function Ho(t){let e=u5(t.replace("urn:recap:",""));return ps(e),e}function Die(t,e,r){let n=c5(t,e,r);return ay(n)}function Z_(t){return t&&t.includes("urn:recap:")}function Pie(t,e){let r=Ho(t),n=Ho(e),i=f5(r,n);return ay(i)}function f5(t,e){ps(t),ps(e);let r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((u,a)=>u.localeCompare(a)).forEach(u=>{var a,c;n.att[i]=r5($_({},n.att[i]),{[u]:((a=t.att[i])==null?void 0:a[u])||((c=e.att[i])==null?void 0:c[u])})})}),n}function eT(t="",e){ps(e);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;let n=[],i=0;Object.keys(e.att).forEach(u=>{let a=Object.keys(e.att[u]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));a.sort((d,w)=>d.action.localeCompare(w.action));let c={};a.forEach(d=>{c[d.ability]||(c[d.ability]=[]),c[d.ability].push(d.action)});let f=Object.keys(c).map(d=>(i++,`(${i}) '${d}': '${c[d].join("', '")}' for '${u}'.`));n.push(f.join(", ").replace(".,","."))});let s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function Rie(t){var e;let r=Ho(t);ps(r);let n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function Bie(t){let e=Ho(t);ps(e);let r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function h5(t,e){if(!e)return t;let r=Ho(e);return ps(r),eT(t,r)}function uy(t){if(!t)return;let e=t?.[t.length-1];return Z_(e)?e:void 0}var tT="base10",Qr="base16",ry="base64pad",cy="utf8",rT=0,dl=1,Mie=0,jM=1,B_=12,nT=32;function Lie(){let t=e4.generateKeyPair();return{privateKey:Vt.toString(t.secretKey,Qr),publicKey:Vt.toString(t.publicKey,Qr)}}function Fie(){let t=XM.randomBytes(nT);return Vt.toString(t,Qr)}function Uie(t,e){let r=e4.sharedKey(Vt.fromString(t,Qr),Vt.fromString(e,Qr),!0),n=new ite.HKDF(U_.SHA256,r).expand(nT);return Vt.toString(n,Qr)}function qie(t){let e=U_.hash(Vt.fromString(t,Qr));return Vt.toString(e,Qr)}function Vie(t){let e=U_.hash(Vt.fromString(t,cy));return Vt.toString(e,Qr)}function d5(t){return Vt.fromString(`${t}`,tT)}function Hh(t){return Number(Vt.toString(t,tT))}function kie(t){let e=d5(typeof t.type<"u"?t.type:rT);if(Hh(e)===dl&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?Vt.fromString(t.senderPublicKey,Qr):void 0,n=typeof t.iv<"u"?Vt.fromString(t.iv,Qr):XM.randomBytes(B_),i=new JM.ChaCha20Poly1305(Vt.fromString(t.symKey,Qr)).seal(n,Vt.fromString(t.message,cy));return g5({type:e,sealed:i,iv:n,senderPublicKey:r})}function Hie(t){let e=new JM.ChaCha20Poly1305(Vt.fromString(t.symKey,Qr)),{sealed:r,iv:n}=iT(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Vt.toString(i,cy)}function g5(t){if(Hh(t.type)===dl){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Vt.toString(Vt.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),ry)}return Vt.toString(Vt.concat([t.type,t.iv,t.sealed]),ry)}function iT(t){let e=Vt.fromString(t,ry),r=e.slice(Mie,jM),n=jM;if(Hh(r)===dl){let u=n+nT,a=u+B_,c=e.slice(n,u),f=e.slice(u,a),d=e.slice(a);return{type:r,sealed:d,iv:f,senderPublicKey:c}}let i=n+B_,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function Gie(t,e){let r=iT(t);return p5({type:Hh(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Vt.toString(r.senderPublicKey,Qr):void 0,receiverPublicKey:e?.receiverPublicKey})}function p5(t){let e=t?.type||rT;if(e===dl){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function jie(t){return t.type===dl&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var m5="irn";function zie(t){return t?.relay||{protocol:m5}}function Qie(t){let e=ote.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Kie=Object.defineProperty,Wie=Object.defineProperties,$ie=Object.getOwnPropertyDescriptors,zM=Object.getOwnPropertySymbols,Yie=Object.prototype.hasOwnProperty,Jie=Object.prototype.propertyIsEnumerable,QM=(t,e,r)=>e in t?Kie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KM=(t,e)=>{for(var r in e||(e={}))Yie.call(e,r)&&QM(t,r,e[r]);if(zM)for(var r of zM(e))Jie.call(e,r)&&QM(t,r,e[r]);return t},Xie=(t,e)=>Wie(t,$ie(e));function y5(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function Zie(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=$m.parse(s),u=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:w5(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:y5(o),methods:u,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function w5(t){return t.startsWith("//")?t.substring(2):t}function v5(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function ese(t){return`${t.protocol}:${t.topic}@${t.version}?`+$m.stringify(KM(Xie(KM({symKey:t.symKey},v5(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}var tse=Object.defineProperty,rse=Object.defineProperties,nse=Object.getOwnPropertyDescriptors,WM=Object.getOwnPropertySymbols,ise=Object.prototype.hasOwnProperty,sse=Object.prototype.propertyIsEnumerable,$M=(t,e,r)=>e in t?tse(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ose=(t,e)=>{for(var r in e||(e={}))ise.call(e,r)&&$M(t,r,e[r]);if(WM)for(var r of WM(e))sse.call(e,r)&&$M(t,r,e[r]);return t},ase=(t,e)=>rse(t,nse(e));function tu(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function A5(t){let e=[];return Object.values(t).forEach(r=>{e.push(...tu(r.accounts))}),e}function E5(t,e){let r=[];return Object.values(t).forEach(n=>{tu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function b5(t,e){let r=[];return Object.values(t).forEach(n=>{tu(n.accounts).includes(e)&&r.push(...n.events)}),r}function use(t,e){let r=R5(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function cse(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=M_(e),s=M_(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,d=n[c].methods,w=n[c].events,A=n[c].accounts;f.forEach(_=>{if(!A.some(N=>N.includes(_)))throw new Error(`No accounts provided for chain ${_} in namespace ${c}`)}),o[c]={chains:f,methods:d,events:w,accounts:A}});let u=M5(e,o,"approve()");if(u)throw new Error(u.message);let a={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(_=>{var N,P;return(P=(N=i[c])==null?void 0:N.chains)==null?void 0:P.includes(_)}),d=n[c].methods.filter(_=>{var N,P;return(P=(N=i[c])==null?void 0:N.methods)==null?void 0:P.includes(_)}),w=n[c].events.filter(_=>{var N,P;return(P=(N=i[c])==null?void 0:N.events)==null?void 0:P.includes(_)}),A=f.map(_=>n[c].accounts.filter(N=>N.includes(`${_}:`))).flat();a[c]={chains:f,methods:d,events:w,accounts:A}}),Object.keys(s).forEach(c=>{var f,d,w,A,_,N;if(!n[c])return;let P=(d=(f=s[c])==null?void 0:f.chains)==null?void 0:d.filter(L=>n[c].chains.includes(L)),V=n[c].methods.filter(L=>{var k,H;return(H=(k=s[c])==null?void 0:k.methods)==null?void 0:H.includes(L)}),U=n[c].events.filter(L=>{var k,H;return(H=(k=s[c])==null?void 0:k.events)==null?void 0:H.includes(L)}),Q=P?.map(L=>n[c].accounts.filter(k=>k.includes(`${L}:`))).flat();a[c]={chains:Ys((w=a[c])==null?void 0:w.chains,P),methods:Ys((A=a[c])==null?void 0:A.methods,V),events:Ys((_=a[c])==null?void 0:_.events,U),accounts:Ys((N=a[c])==null?void 0:N.accounts,Q)}}),a)}function sT(t){return t.includes(":")}function S5(t){return sT(t)?t.split(":")[0]:t}function M_(t){var e,r,n;let i={};if(!ly(t))return i;for(let[s,o]of Object.entries(t)){let u=sT(s)?[s]:o.chains,a=o.methods||[],c=o.events||[],f=S5(s);i[f]=ase(ose({},i[f]),{chains:Ys(u,(e=i[f])==null?void 0:e.chains),methods:Ys(a,(r=i[f])==null?void 0:r.methods),events:Ys(c,(n=i[f])==null?void 0:n.events)})}return i}function I5(t){let e={};return t?.forEach(r=>{let[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function lse(t,e){e=e.map(n=>n.replace("did:pkh:",""));let r=I5(e);for(let[n,i]of Object.entries(r))i.methods?i.methods=Ys(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}var _5={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}},T5={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 $s(t,e){let{message:r,code:n}=T5[t];return{message:e?`${r} ${e}`:r,code:n}}function Xa(t,e){let{message:r,code:n}=_5[t];return{message:e?`${r} ${e}`:r,code:n}}function Gh(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function ly(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function ko(t){return typeof t>"u"}function yn(t,e){return e&&ko(t)?!0:typeof t=="string"&&!!t.trim().length}function fy(t,e){return e&&ko(t)?!0:typeof t=="number"&&!isNaN(t)}function fse(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Vo(i,n)?(n.forEach(o=>{let{accounts:u,methods:a,events:c}=t.namespaces[o],f=tu(u),d=r[o];(!Vo(iy(o,d),f)||!Vo(d.methods,a)||!Vo(d.events,c))&&(s=!1)}),s):!1}function qh(t){return yn(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function C5(t){if(yn(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&qh(r)}}return!1}function hse(t){if(yn(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function dse(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function gse(t){return t?.topic}function pse(t,e){let r=null;return yn(t?.publicKey,!1)||(r=$s("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function L_(t){let e=!0;return Gh(t)?t.length&&(e=t.every(r=>yn(r,!1))):e=!1,e}function N5(t,e,r){let n=null;return Gh(e)&&e.length?e.forEach(i=>{n||qh(i)||(n=Xa("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):qh(t)||(n=Xa("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function x5(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=N5(i,iy(i,s),`${e} ${r}`);o&&(n=o)}),n}function O5(t,e){let r=null;return Gh(t)?t.forEach(n=>{r||C5(n)||(r=Xa("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Xa("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function D5(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=O5(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function P5(t,e){let r=null;return L_(t?.methods)?L_(t?.events)||(r=Xa("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Xa("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function oT(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=P5(n,`${e}, namespace`);i&&(r=i)}),r}function mse(t,e,r){let n=null;if(t&&ly(t)){let i=oT(t,e);i&&(n=i);let s=x5(t,e,r);s&&(n=s)}else n=$s("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function R5(t,e){let r=null;if(t&&ly(t)){let n=oT(t,e);n&&(r=n);let i=D5(t,e);i&&(r=i)}else r=$s("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function B5(t){return yn(t.protocol,!0)}function yse(t,e){let r=!1;return e&&!t?r=!0:t&&Gh(t)&&t.length&&t.forEach(n=>{r=B5(n)}),r}function wse(t){return typeof t=="number"}function vse(t){return typeof t<"u"&&typeof t!==null}function Ase(t){return!(!t||typeof t!="object"||!t.code||!fy(t.code,!1)||!t.message||!yn(t.message,!1))}function Ese(t){return!(ko(t)||!yn(t.method,!1))}function bse(t){return!(ko(t)||ko(t.result)&&ko(t.error)||!fy(t.id,!1)||!yn(t.jsonrpc,!1))}function Sse(t){return!(ko(t)||!yn(t.name,!1))}function Ise(t,e){return!(!qh(e)||!A5(t).includes(e))}function _se(t,e,r){return yn(r,!1)?E5(t,e).includes(r):!1}function Tse(t,e,r){return yn(r,!1)?b5(t,e).includes(r):!1}function M5(t,e,r){let n=null,i=Cse(t),s=Nse(e),o=Object.keys(i),u=Object.keys(s),a=YM(Object.keys(t)),c=YM(Object.keys(e)),f=a.filter(d=>!c.includes(d));return f.length&&(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`});var FB=pe(()=>{h();LB();yv();Da();DT();_0()});var FT,exe,qB=pe(()=>{h();fB();dB();hB();pB();gB();TT();mB();xT();yB();bB();xB();PB();RB();MB();FB();FT={...bT,...wT,...AT,...ET,...ST,..._T,...IT,...CT,...NT,...OT},exe={...BT,...LT}});function kB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var UB,qT,Gce,Av,UT=pe(()=>{h();qB();pv();UB=kB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),qT=kB("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Nf(t.length);for(let r=0;r{h();UT()});function Gs(t,e="utf8"){let r=Av[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}var VT=pe(()=>{h();UT()});function I0(t){return Ra(Bo(Gs(t,Cf),av))}function C0(t){return Bo(Gs(ns(t),av),Cf)}function HT(t){let e=Gs(dv,xf),r=fv+Bo(gv([e,t]),xf);return[uv,lv,r].join(cv)}function GT(t){let[e,r,n]=t.split(cv);if(e!==uv||r!==lv)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==fv)throw new Error("Issuer must be a key in mulicodec format");let s=Gs(n.slice(1),xf);if(Bo(s.slice(0,2),xf)!==dv)throw new Error('Issuer must be a public key with type "Ed25519"');let c=s.slice(2);if(c.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return c}function VB(t){return Bo(t,Cf)}function HB(t){return Gs(t,Cf)}function zT(t){return Gs([C0(t.header),C0(t.payload)].join(tu),w0)}function zce(t){let e=Bo(t,w0).split(tu),r=I0(e[0]),n=I0(e[1]);return{header:r,payload:n}}function jT(t){return[C0(t.header),C0(t.payload),VB(t.signature)].join(tu)}function QT(t){let e=t.split(tu),r=I0(e[0]),n=I0(e[1]),i=HB(e[2]),s=Gs(e.slice(0,2).join(tu),w0);return{header:r,payload:n,signature:i,data:s}}var KT=pe(()=>{h();pT();kT();VT();vf();hv()});function jce(t=(0,GB.randomBytes)(32)){return Bf.generateKeyPairFromSeed(t)}async function Qce(t,e,r,n,i=(0,zB.fromMiliseconds)(Date.now())){let s={alg:sv,typ:ov},o=HT(n.publicKey),c=i+r,a={iss:o,sub:t,aud:e,iat:i,exp:c},u=zT({header:s,payload:a}),f=Bf.sign(n.secretKey,u);return jT({header:s,payload:a,signature:f})}async function Kce(t){let{header:e,payload:r,data:n,signature:i}=QT(t);if(e.alg!==sv||e.typ!==ov)throw new Error("JWT must use EdDSA algorithm");let s=GT(r.iss);return Bf.verify(s,n,i)}var Bf,GB,zB,jB=pe(()=>{h();Bf=ge(tB()),GB=ge(y0()),zB=ge(yf());hv();KT()});var QB=pe(()=>{h()});var WT={};Zt(WT,{DATA_ENCODING:()=>w0,DID_DELIMITER:()=>cv,DID_METHOD:()=>lv,DID_PREFIX:()=>uv,JSON_ENCODING:()=>av,JWT_DELIMITER:()=>tu,JWT_ENCODING:()=>Cf,JWT_IRIDIUM_ALG:()=>sv,JWT_IRIDIUM_TYP:()=>ov,KEY_PAIR_SEED_LENGTH:()=>nB,MULTICODEC_ED25519_BASE:()=>fv,MULTICODEC_ED25519_ENCODING:()=>xf,MULTICODEC_ED25519_HEADER:()=>dv,MULTICODEC_ED25519_LENGTH:()=>rB,decodeData:()=>zce,decodeIss:()=>GT,decodeJSON:()=>I0,decodeJWT:()=>QT,decodeSig:()=>HB,encodeData:()=>zT,encodeIss:()=>HT,encodeJSON:()=>C0,encodeJWT:()=>jT,encodeSig:()=>VB,generateKeyPair:()=>jce,signJWT:()=>Qce,verifyJWT:()=>Kce});var $T=pe(()=>{h();jB();hv();QB();KT()});var iL=L(ur=>{"use strict";h();var KB=ur&&ur.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new eL:typeof navigator<"u"?YT(navigator.userAgent):nL()}ur.detect=Jce;function tL(t){return t!==""&&Yce.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Xce(t){var e=tL(t);return e?e[0]:null}ur.browserName=Xce;function YT(t){var e=tL(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new ZB;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";h();Object.defineProperty(rr,"__esModule",{value:!0});rr.getLocalStorage=rr.getLocalStorageOrThrow=rr.getCrypto=rr.getCryptoOrThrow=rr.getLocation=rr.getLocationOrThrow=rr.getNavigator=rr.getNavigatorOrThrow=rr.getDocument=rr.getDocumentOrThrow=rr.getFromWindowOrThrow=rr.getFromWindow=void 0;function nu(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}rr.getFromWindow=nu;function Lf(t){let e=nu(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}rr.getFromWindowOrThrow=Lf;function eue(){return Lf("document")}rr.getDocumentOrThrow=eue;function tue(){return nu("document")}rr.getDocument=tue;function rue(){return Lf("navigator")}rr.getNavigatorOrThrow=rue;function nue(){return nu("navigator")}rr.getNavigator=nue;function iue(){return Lf("location")}rr.getLocationOrThrow=iue;function sue(){return nu("location")}rr.getLocation=sue;function oue(){return Lf("crypto")}rr.getCryptoOrThrow=oue;function aue(){return nu("crypto")}rr.getCrypto=aue;function cue(){return Lf("localStorage")}rr.getLocalStorageOrThrow=cue;function uue(){return nu("localStorage")}rr.getLocalStorage=uue});var oL=L(Ev=>{"use strict";h();Object.defineProperty(Ev,"__esModule",{value:!0});Ev.getWindowMetadata=void 0;var sL=JT();function lue(){let t,e;try{t=sL.getDocumentOrThrow(),e=sL.getLocationOrThrow()}catch{return null}function r(){let p=t.getElementsByTagName("link"),S=[];for(let I=0;I-1){let D=N.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let U=e.protocol+"//"+e.host;if(D.indexOf("/")===0)U+=D;else{let k=e.pathname.split("/");k.pop();let z=k.join("/");U+=z+"/"+D}S.push(U)}else if(D.indexOf("//")===0){let U=e.protocol+D;S.push(U)}else S.push(D)}}return S}function n(...p){let S=t.getElementsByTagName("meta");for(let I=0;IN.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(R.length&&R){let D=N.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),c=s(),a=e.origin,u=r();return{description:c,url:a,icons:u,name:o}}Ev.getWindowMetadata=lue});var cL=L((Lxe,aL)=>{"use strict";h();aL.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var hL=L((qxe,dL)=>{"use strict";h();var fL="%[a-f0-9]{2}",uL=new RegExp("("+fL+")|([^%]+?)","gi"),lL=new RegExp("("+fL+")+","gi");function XT(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],XT(r),XT(n))}function fue(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(uL)||[],r=1;r{"use strict";h();pL.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var yL=L((Hxe,mL)=>{"use strict";h();mL.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";h();var hue=cL(),pue=hL(),bL=gL(),gue=yL(),mue=t=>t==null,ZT=Symbol("encodeFragmentIdentifier");function yue(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Ir(e,t),"[",i,"]"].join("")]:[...r,[Ir(e,t),"[",Ir(i,t),"]=",Ir(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Ir(e,t),"[]"].join("")]:[...r,[Ir(e,t),"[]=",Ir(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Ir(e,t),":list="].join("")]:[...r,[Ir(e,t),":list=",Ir(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Ir(r,t),e,Ir(i,t)].join("")]:[[n,Ir(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,Ir(e,t)]:[...r,[Ir(e,t),"=",Ir(n,t)].join("")]}}function vue(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&Lo(n,t).includes(t.arrayFormatSeparator);n=o?Lo(n,t):n;let c=s||o?n.split(t.arrayFormatSeparator).map(a=>Lo(a,t)):n===null?n:Lo(n,t);i[r]=c};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Lo(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(c=>Lo(c,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function wL(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Ir(t,e){return e.encode?e.strict?hue(t):encodeURIComponent(t):t}function Lo(t,e){return e.decode?pue(t):t}function AL(t){return Array.isArray(t)?t.sort():typeof t=="object"?AL(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function EL(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function bue(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function SL(t){t=EL(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function vL(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function _L(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),wL(e.arrayFormatSeparator);let r=vue(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=bL(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Lo(o,e),r(Lo(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=vL(s[o],e);else n[i]=vL(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=AL(o):i[s]=o,i},Object.create(null))}Un.extract=SL;Un.parse=_L;Un.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),wL(e.arrayFormatSeparator);let r=o=>e.skipNull&&mue(t[o])||e.skipEmptyString&&t[o]==="",n=yue(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let c=t[o];return c===void 0?"":c===null?Ir(o,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?Ir(o,e)+"[]":c.reduce(n(o),[]).join("&"):Ir(o,e)+"="+Ir(c,e)}).filter(o=>o.length>0).join("&")};Un.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=bL(t,"#");return Object.assign({url:r.split("?")[0]||"",query:_L(SL(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Lo(n,e)}:{})};Un.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[ZT]:!0},e);let r=EL(t.url).split("?")[0]||"",n=Un.extract(t.url),i=Un.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=Un.stringify(s,e);o&&(o=`?${o}`);let c=bue(t.url);return t.fragmentIdentifier&&(c=`#${e[ZT]?Ir(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${c}`};Un.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[ZT]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=Un.parseUrl(t,r);return Un.stringifyUrl({url:n,query:gue(i,e),fragmentIdentifier:s},r)};Un.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return Un.pick(t,n,r)}});var CL=L(Sv=>{"use strict";h();Object.defineProperty(Sv,"__esModule",{value:!0});var pn=Sf(),eI=Ci(),wue=20;function Aue(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],a=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],S=r[23]<<24|r[22]<<16|r[21]<<8|r[20],I=r[27]<<24|r[26]<<16|r[25]<<8|r[24],N=r[31]<<24|r[30]<<16|r[29]<<8|r[28],R=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],U=e[11]<<24|e[10]<<16|e[9]<<8|e[8],k=e[15]<<24|e[14]<<16|e[13]<<8|e[12],z=n,H=i,F=s,V=o,q=c,C=a,B=u,x=f,g=p,v=S,l=I,d=N,m=R,w=D,_=U,A=k,y=0;y>>16|m<<16,g=g+m|0,q^=g,q=q>>>20|q<<12,H=H+C|0,w^=H,w=w>>>16|w<<16,v=v+w|0,C^=v,C=C>>>20|C<<12,F=F+B|0,_^=F,_=_>>>16|_<<16,l=l+_|0,B^=l,B=B>>>20|B<<12,V=V+x|0,A^=V,A=A>>>16|A<<16,d=d+A|0,x^=d,x=x>>>20|x<<12,F=F+B|0,_^=F,_=_>>>24|_<<8,l=l+_|0,B^=l,B=B>>>25|B<<7,V=V+x|0,A^=V,A=A>>>24|A<<8,d=d+A|0,x^=d,x=x>>>25|x<<7,H=H+C|0,w^=H,w=w>>>24|w<<8,v=v+w|0,C^=v,C=C>>>25|C<<7,z=z+q|0,m^=z,m=m>>>24|m<<8,g=g+m|0,q^=g,q=q>>>25|q<<7,z=z+C|0,A^=z,A=A>>>16|A<<16,l=l+A|0,C^=l,C=C>>>20|C<<12,H=H+B|0,m^=H,m=m>>>16|m<<16,d=d+m|0,B^=d,B=B>>>20|B<<12,F=F+x|0,w^=F,w=w>>>16|w<<16,g=g+w|0,x^=g,x=x>>>20|x<<12,V=V+q|0,_^=V,_=_>>>16|_<<16,v=v+_|0,q^=v,q=q>>>20|q<<12,F=F+x|0,w^=F,w=w>>>24|w<<8,g=g+w|0,x^=g,x=x>>>25|x<<7,V=V+q|0,_^=V,_=_>>>24|_<<8,v=v+_|0,q^=v,q=q>>>25|q<<7,H=H+B|0,m^=H,m=m>>>24|m<<8,d=d+m|0,B^=d,B=B>>>25|B<<7,z=z+C|0,A^=z,A=A>>>24|A<<8,l=l+A|0,C^=l,C=C>>>25|C<<7;pn.writeUint32LE(z+n|0,t,0),pn.writeUint32LE(H+i|0,t,4),pn.writeUint32LE(F+s|0,t,8),pn.writeUint32LE(V+o|0,t,12),pn.writeUint32LE(q+c|0,t,16),pn.writeUint32LE(C+a|0,t,20),pn.writeUint32LE(B+u|0,t,24),pn.writeUint32LE(x+f|0,t,28),pn.writeUint32LE(g+p|0,t,32),pn.writeUint32LE(v+S|0,t,36),pn.writeUint32LE(l+I|0,t,40),pn.writeUint32LE(d+N|0,t,44),pn.writeUint32LE(m+R|0,t,48),pn.writeUint32LE(w+D|0,t,52),pn.writeUint32LE(_+U|0,t,56),pn.writeUint32LE(A+k|0,t,60)}function IL(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var _v=L(Ff=>{"use strict";h();Object.defineProperty(Ff,"__esModule",{value:!0});function _ue(t,e,r){return~(t-1)&e|t-1&r}Ff.select=_ue;function Tue(t,e){return(t|0)-(e|0)-1>>>31&1}Ff.lessOrEqual=Tue;function xL(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Ff.compare=xL;function Iue(t,e){return t.length===0||e.length===0?!1:xL(t,e)!==0}Ff.equal=Iue});var OL=L(Fo=>{"use strict";h();Object.defineProperty(Fo,"__esModule",{value:!0});var Cue=_v(),Tv=Ci();Fo.DIGEST_LENGTH=16;var NL=function(){function t(e){this.digestLength=Fo.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var c=e[10]|e[11]<<8;this._r[6]=(o>>>14|c<<2)&8191;var a=e[12]|e[13]<<8;this._r[7]=(c>>>11|a<<5)&8065;var u=e[14]|e[15]<<8;this._r[8]=(a>>>8|u<<8)&8191,this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],c=this._h[2],a=this._h[3],u=this._h[4],f=this._h[5],p=this._h[6],S=this._h[7],I=this._h[8],N=this._h[9],R=this._r[0],D=this._r[1],U=this._r[2],k=this._r[3],z=this._r[4],H=this._r[5],F=this._r[6],V=this._r[7],q=this._r[8],C=this._r[9];n>=16;){var B=e[r+0]|e[r+1]<<8;s+=B&8191;var x=e[r+2]|e[r+3]<<8;o+=(B>>>13|x<<3)&8191;var g=e[r+4]|e[r+5]<<8;c+=(x>>>10|g<<6)&8191;var v=e[r+6]|e[r+7]<<8;a+=(g>>>7|v<<9)&8191;var l=e[r+8]|e[r+9]<<8;u+=(v>>>4|l<<12)&8191,f+=l>>>1&8191;var d=e[r+10]|e[r+11]<<8;p+=(l>>>14|d<<2)&8191;var m=e[r+12]|e[r+13]<<8;S+=(d>>>11|m<<5)&8191;var w=e[r+14]|e[r+15]<<8;I+=(m>>>8|w<<8)&8191,N+=w>>>5|i;var _=0,A=_;A+=s*R,A+=o*(5*C),A+=c*(5*q),A+=a*(5*V),A+=u*(5*F),_=A>>>13,A&=8191,A+=f*(5*H),A+=p*(5*z),A+=S*(5*k),A+=I*(5*U),A+=N*(5*D),_+=A>>>13,A&=8191;var y=_;y+=s*D,y+=o*R,y+=c*(5*C),y+=a*(5*q),y+=u*(5*V),_=y>>>13,y&=8191,y+=f*(5*F),y+=p*(5*H),y+=S*(5*z),y+=I*(5*k),y+=N*(5*U),_+=y>>>13,y&=8191;var T=_;T+=s*U,T+=o*D,T+=c*R,T+=a*(5*C),T+=u*(5*q),_=T>>>13,T&=8191,T+=f*(5*V),T+=p*(5*F),T+=S*(5*H),T+=I*(5*z),T+=N*(5*k),_+=T>>>13,T&=8191;var E=_;E+=s*k,E+=o*U,E+=c*D,E+=a*R,E+=u*(5*C),_=E>>>13,E&=8191,E+=f*(5*q),E+=p*(5*V),E+=S*(5*F),E+=I*(5*H),E+=N*(5*z),_+=E>>>13,E&=8191;var M=_;M+=s*z,M+=o*k,M+=c*U,M+=a*D,M+=u*R,_=M>>>13,M&=8191,M+=f*(5*C),M+=p*(5*q),M+=S*(5*V),M+=I*(5*F),M+=N*(5*H),_+=M>>>13,M&=8191;var W=_;W+=s*H,W+=o*z,W+=c*k,W+=a*U,W+=u*D,_=W>>>13,W&=8191,W+=f*R,W+=p*(5*C),W+=S*(5*q),W+=I*(5*V),W+=N*(5*F),_+=W>>>13,W&=8191;var Y=_;Y+=s*F,Y+=o*H,Y+=c*z,Y+=a*k,Y+=u*U,_=Y>>>13,Y&=8191,Y+=f*D,Y+=p*R,Y+=S*(5*C),Y+=I*(5*q),Y+=N*(5*V),_+=Y>>>13,Y&=8191;var P=_;P+=s*V,P+=o*F,P+=c*H,P+=a*z,P+=u*k,_=P>>>13,P&=8191,P+=f*U,P+=p*D,P+=S*R,P+=I*(5*C),P+=N*(5*q),_+=P>>>13,P&=8191;var G=_;G+=s*q,G+=o*V,G+=c*F,G+=a*H,G+=u*z,_=G>>>13,G&=8191,G+=f*k,G+=p*U,G+=S*D,G+=I*R,G+=N*(5*C),_+=G>>>13,G&=8191;var Q=_;Q+=s*C,Q+=o*q,Q+=c*V,Q+=a*F,Q+=u*H,_=Q>>>13,Q&=8191,Q+=f*z,Q+=p*k,Q+=S*U,Q+=I*D,Q+=N*R,_+=Q>>>13,Q&=8191,_=(_<<2)+_|0,_=_+A|0,A=_&8191,_=_>>>13,y+=_,s=A,o=y,c=T,a=E,u=M,f=W,p=Y,S=P,I=G,N=Q,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=c,this._h[3]=a,this._h[4]=u,this._h[5]=f,this._h[6]=p,this._h[7]=S,this._h[8]=I,this._h[9]=N},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,c;if(this._leftover){for(c=this._leftover,this._buffer[c++]=1;c<16;c++)this._buffer[c]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,c=2;c<10;c++)this._h[c]+=i,i=this._h[c]>>>13,this._h[c]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,c=1;c<10;c++)n[c]=this._h[c]+i,i=n[c]>>>13,n[c]&=8191;for(n[9]-=8192,s=(i^1)-1,c=0;c<10;c++)n[c]&=s;for(s=~s,c=0;c<10;c++)this._h[c]=this._h[c]&s|n[c];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,c=1;c<8;c++)o=(this._h[c]+this._pad[c]|0)+(o>>>16)|0,this._h[c]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";h();Object.defineProperty(qo,"__esModule",{value:!0});var Iv=CL(),Oue=OL(),x0=Ci(),PL=Sf(),Pue=_v();qo.KEY_LENGTH=32;qo.NONCE_LENGTH=12;qo.TAG_LENGTH=16;var RL=new Uint8Array(16),Rue=function(){function t(e){if(this.nonceLength=qo.NONCE_LENGTH,this.tagLength=qo.TAG_LENGTH,e.length!==qo.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);Iv.stream(this._key,s,o,4);var c=r.length+this.tagLength,a;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");a=i}else a=new Uint8Array(c);return Iv.streamXOR(this._key,s,r,a,4),this._authenticate(a.subarray(a.length-this.tagLength,a.length),o,a.subarray(0,a.length-this.tagLength),n),x0.wipe(s),a},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(RL.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(RL.subarray(n.length%16));var o=new Uint8Array(8);i&&PL.writeUint64LE(i.length,o),s.update(o),PL.writeUint64LE(n.length,o),s.update(o);for(var c=s.digest(),a=0;a{"use strict";h();Object.defineProperty(tI,"__esModule",{value:!0});function Mue(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}tI.isSerializableHash=Mue});var LL=L(N0=>{"use strict";h();Object.defineProperty(N0,"__esModule",{value:!0});var zs=DL(),Due=_v(),Bue=Ci(),BL=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";h();Object.defineProperty(rI,"__esModule",{value:!0});var FL=LL(),qL=Ci(),Fue=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=FL.hmac(this._hash,n,r);this._hmac=new FL.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";h();Object.defineProperty(La,"__esModule",{value:!0});var xv=Sf(),Cv=Ci();La.DIGEST_LENGTH=32;La.BLOCK_SIZE=64;var kL=function(){function t(){this.digestLength=La.DIGEST_LENGTH,this.blockSize=La.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Cv.wipe(this._buffer),Cv.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(nI(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=nI(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Cv.wipe(e.state),e.buffer&&Cv.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();La.SHA256=kL;var que=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 nI(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],c=e[2],a=e[3],u=e[4],f=e[5],p=e[6],S=e[7],I=0;I<16;I++){var N=n+I*4;t[I]=xv.readUint32BE(r,N)}for(var I=16;I<64;I++){var R=t[I-2],D=(R>>>17|R<<15)^(R>>>19|R<<13)^R>>>10;R=t[I-15];var U=(R>>>7|R<<25)^(R>>>18|R<<14)^R>>>3;t[I]=(D+t[I-7]|0)+(U+t[I-16]|0)}for(var I=0;I<64;I++){var D=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&f^~u&p)|0)+(S+(que[I]+t[I]|0)|0)|0,U=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&c^o&c)|0;S=p,p=f,f=u,u=a+D|0,a=c,c=o,o=s,s=D+U|0}e[0]+=s,e[1]+=o,e[2]+=c,e[3]+=a,e[4]+=u,e[5]+=f,e[6]+=p,e[7]+=S,n+=64,i-=64}return n}function Uue(t){var e=new kL;e.update(t);var r=e.digest();return e.clean(),r}La.hash=Uue});var jL=L(mr=>{"use strict";h();Object.defineProperty(mr,"__esModule",{value:!0});mr.sharedKey=mr.generateKeyPair=mr.generateKeyPairFromSeed=mr.scalarMultBase=mr.scalarMult=mr.SHARED_KEY_LENGTH=mr.SECRET_KEY_LENGTH=mr.PUBLIC_KEY_LENGTH=void 0;var kue=y0(),Vue=Ci();mr.PUBLIC_KEY_LENGTH=32;mr.SECRET_KEY_LENGTH=32;mr.SHARED_KEY_LENGTH=32;function js(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,O0(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function zue(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Nv(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ov(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Uo(t,e,r){let n,i,s=0,o=0,c=0,a=0,u=0,f=0,p=0,S=0,I=0,N=0,R=0,D=0,U=0,k=0,z=0,H=0,F=0,V=0,q=0,C=0,B=0,x=0,g=0,v=0,l=0,d=0,m=0,w=0,_=0,A=0,y=0,T=r[0],E=r[1],M=r[2],W=r[3],Y=r[4],P=r[5],G=r[6],Q=r[7],$=r[8],ee=r[9],ie=r[10],X=r[11],re=r[12],ae=r[13],Z=r[14],oe=r[15];n=e[0],s+=n*T,o+=n*E,c+=n*M,a+=n*W,u+=n*Y,f+=n*P,p+=n*G,S+=n*Q,I+=n*$,N+=n*ee,R+=n*ie,D+=n*X,U+=n*re,k+=n*ae,z+=n*Z,H+=n*oe,n=e[1],o+=n*T,c+=n*E,a+=n*M,u+=n*W,f+=n*Y,p+=n*P,S+=n*G,I+=n*Q,N+=n*$,R+=n*ee,D+=n*ie,U+=n*X,k+=n*re,z+=n*ae,H+=n*Z,F+=n*oe,n=e[2],c+=n*T,a+=n*E,u+=n*M,f+=n*W,p+=n*Y,S+=n*P,I+=n*G,N+=n*Q,R+=n*$,D+=n*ee,U+=n*ie,k+=n*X,z+=n*re,H+=n*ae,F+=n*Z,V+=n*oe,n=e[3],a+=n*T,u+=n*E,f+=n*M,p+=n*W,S+=n*Y,I+=n*P,N+=n*G,R+=n*Q,D+=n*$,U+=n*ee,k+=n*ie,z+=n*X,H+=n*re,F+=n*ae,V+=n*Z,q+=n*oe,n=e[4],u+=n*T,f+=n*E,p+=n*M,S+=n*W,I+=n*Y,N+=n*P,R+=n*G,D+=n*Q,U+=n*$,k+=n*ee,z+=n*ie,H+=n*X,F+=n*re,V+=n*ae,q+=n*Z,C+=n*oe,n=e[5],f+=n*T,p+=n*E,S+=n*M,I+=n*W,N+=n*Y,R+=n*P,D+=n*G,U+=n*Q,k+=n*$,z+=n*ee,H+=n*ie,F+=n*X,V+=n*re,q+=n*ae,C+=n*Z,B+=n*oe,n=e[6],p+=n*T,S+=n*E,I+=n*M,N+=n*W,R+=n*Y,D+=n*P,U+=n*G,k+=n*Q,z+=n*$,H+=n*ee,F+=n*ie,V+=n*X,q+=n*re,C+=n*ae,B+=n*Z,x+=n*oe,n=e[7],S+=n*T,I+=n*E,N+=n*M,R+=n*W,D+=n*Y,U+=n*P,k+=n*G,z+=n*Q,H+=n*$,F+=n*ee,V+=n*ie,q+=n*X,C+=n*re,B+=n*ae,x+=n*Z,g+=n*oe,n=e[8],I+=n*T,N+=n*E,R+=n*M,D+=n*W,U+=n*Y,k+=n*P,z+=n*G,H+=n*Q,F+=n*$,V+=n*ee,q+=n*ie,C+=n*X,B+=n*re,x+=n*ae,g+=n*Z,v+=n*oe,n=e[9],N+=n*T,R+=n*E,D+=n*M,U+=n*W,k+=n*Y,z+=n*P,H+=n*G,F+=n*Q,V+=n*$,q+=n*ee,C+=n*ie,B+=n*X,x+=n*re,g+=n*ae,v+=n*Z,l+=n*oe,n=e[10],R+=n*T,D+=n*E,U+=n*M,k+=n*W,z+=n*Y,H+=n*P,F+=n*G,V+=n*Q,q+=n*$,C+=n*ee,B+=n*ie,x+=n*X,g+=n*re,v+=n*ae,l+=n*Z,d+=n*oe,n=e[11],D+=n*T,U+=n*E,k+=n*M,z+=n*W,H+=n*Y,F+=n*P,V+=n*G,q+=n*Q,C+=n*$,B+=n*ee,x+=n*ie,g+=n*X,v+=n*re,l+=n*ae,d+=n*Z,m+=n*oe,n=e[12],U+=n*T,k+=n*E,z+=n*M,H+=n*W,F+=n*Y,V+=n*P,q+=n*G,C+=n*Q,B+=n*$,x+=n*ee,g+=n*ie,v+=n*X,l+=n*re,d+=n*ae,m+=n*Z,w+=n*oe,n=e[13],k+=n*T,z+=n*E,H+=n*M,F+=n*W,V+=n*Y,q+=n*P,C+=n*G,B+=n*Q,x+=n*$,g+=n*ee,v+=n*ie,l+=n*X,d+=n*re,m+=n*ae,w+=n*Z,_+=n*oe,n=e[14],z+=n*T,H+=n*E,F+=n*M,V+=n*W,q+=n*Y,C+=n*P,B+=n*G,x+=n*Q,g+=n*$,v+=n*ee,l+=n*ie,d+=n*X,m+=n*re,w+=n*ae,_+=n*Z,A+=n*oe,n=e[15],H+=n*T,F+=n*E,V+=n*M,q+=n*W,C+=n*Y,B+=n*P,x+=n*G,g+=n*Q,v+=n*$,l+=n*ee,d+=n*ie,m+=n*X,w+=n*re,_+=n*ae,A+=n*Z,y+=n*oe,s+=38*F,o+=38*V,c+=38*q,a+=38*C,u+=38*B,f+=38*x,p+=38*g,S+=38*v,I+=38*l,N+=38*d,R+=38*m,D+=38*w,U+=38*_,k+=38*A,z+=38*y,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=c,t[3]=a,t[4]=u,t[5]=f,t[6]=p,t[7]=S,t[8]=I,t[9]=N,t[10]=R,t[11]=D,t[12]=U,t[13]=k,t[14]=z,t[15]=H}function P0(t,e){Uo(t,e,e)}function jue(t,e){let r=js();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)P0(r,r),n!==2&&n!==4&&Uo(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function sI(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=js(),s=js(),o=js(),c=js(),a=js(),u=js();for(let I=0;I<31;I++)r[I]=t[I];r[31]=t[31]&127|64,r[0]&=248,zue(n,e);for(let I=0;I<16;I++)s[I]=n[I];i[0]=c[0]=1;for(let I=254;I>=0;--I){let N=r[I>>>3]>>>(I&7)&1;O0(i,s,N),O0(o,c,N),Nv(a,i,o),Ov(i,i,o),Nv(o,s,c),Ov(s,s,c),P0(c,a),P0(u,i),Uo(i,o,i),Uo(o,s,a),Nv(a,i,o),Ov(i,i,o),P0(s,i),Ov(o,c,u),Uo(i,o,Hue),Nv(i,i,c),Uo(o,o,i),Uo(i,c,u),Uo(c,s,n),P0(s,a),O0(i,s,N),O0(o,c,N)}for(let I=0;I<16;I++)n[I+16]=i[I],n[I+32]=o[I],n[I+48]=s[I],n[I+64]=c[I];let f=n.subarray(32),p=n.subarray(16);jue(f,f),Uo(p,p,f);let S=new Uint8Array(32);return Gue(S,p),S}mr.scalarMult=sI;function GL(t){return sI(t,HL)}mr.scalarMultBase=GL;function zL(t){if(t.length!==mr.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${mr.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:GL(e),secretKey:e}}mr.generateKeyPairFromSeed=zL;function Que(t){let e=(0,kue.randomBytes)(32,t),r=zL(e);return(0,Vue.wipe)(e),r}mr.generateKeyPair=Que;function Kue(t,e,r=!1){if(t.length!==mr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==mr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=sI(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{h()});function WL(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{h()});function YL(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Nf(t.length);for(let n=0;n{h();pv()});var oI={};Zt(oI,{compare:()=>QL,concat:()=>gv,equals:()=>WL,fromString:()=>Gs,toString:()=>Bo,xor:()=>YL});var aI=pe(()=>{h();KL();pT();$L();VT();kT();JL()});var XL=L((_Ne,Wue)=>{Wue.exports={name:"elliptic",version:"6.5.7",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var Qs=L((ZL,cI)=>{h();(function(t,e){"use strict";function r(x,g){if(!x)throw new Error(g||"Assertion failed")}function n(x,g){x.super_=g;var v=function(){};v.prototype=g.prototype,x.prototype=new v,x.prototype.constructor=x}function i(x,g,v){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((g==="le"||g==="be")&&(v=g,g=10),this._init(x||0,g||10,v||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=wo().Buffer}catch{}i.isBN=function(g){return g instanceof i?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===i.wordSize&&Array.isArray(g.words)},i.max=function(g,v){return g.cmp(v)>0?g:v},i.min=function(g,v){return g.cmp(v)<0?g:v},i.prototype._init=function(g,v,l){if(typeof g=="number")return this._initNumber(g,v,l);if(typeof g=="object")return this._initArray(g,v,l);v==="hex"&&(v=16),r(v===(v|0)&&v>=2&&v<=36),g=g.toString().replace(/\s+/g,"");var d=0;g[0]==="-"&&(d++,this.negative=1),d=0;d-=3)w=g[d]|g[d-1]<<8|g[d-2]<<16,this.words[m]|=w<<_&67108863,this.words[m+1]=w>>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);else if(l==="le")for(d=0,m=0;d>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);return this.strip()};function o(x,g){var v=x.charCodeAt(g);return v>=65&&v<=70?v-55:v>=97&&v<=102?v-87:v-48&15}function c(x,g,v){var l=o(x,v);return v-1>=g&&(l|=o(x,v-1)<<4),l}i.prototype._parseHex=function(g,v,l){this.length=Math.ceil((g.length-v)/6),this.words=new Array(this.length);for(var d=0;d=v;d-=2)_=c(g,v,d)<=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8;else{var A=g.length-v;for(d=A%2===0?v+1:v;d=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8}this.strip()};function a(x,g,v,l){for(var d=0,m=Math.min(x.length,v),w=g;w=49?d+=_-49+10:_>=17?d+=_-17+10:d+=_}return d}i.prototype._parseBase=function(g,v,l){this.words=[0],this.length=1;for(var d=0,m=1;m<=67108863;m*=v)d++;d--,m=m/v|0;for(var w=g.length-l,_=w%d,A=Math.min(w,w-_)+l,y=0,T=l;T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","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"],f=[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],p=[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];i.prototype.toString=function(g,v){g=g||10,v=v|0||1;var l;if(g===16||g==="hex"){l="";for(var d=0,m=0,w=0;w>>24-d&16777215,m!==0||w!==this.length-1?l=u[6-A.length]+A+l:l=A+l,d+=2,d>=26&&(d-=26,w--)}for(m!==0&&(l=m.toString(16)+l);l.length%v!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(g===(g|0)&&g>=2&&g<=36){var y=f[g],T=p[g];l="";var E=this.clone();for(E.negative=0;!E.isZero();){var M=E.modn(T).toString(g);E=E.idivn(T),E.isZero()?l=M+l:l=u[y-M.length]+M+l}for(this.isZero()&&(l="0"+l);l.length%v!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(g,v){return r(typeof s<"u"),this.toArrayLike(s,g,v)},i.prototype.toArray=function(g,v){return this.toArrayLike(Array,g,v)},i.prototype.toArrayLike=function(g,v,l){var d=this.byteLength(),m=l||Math.max(1,d);r(d<=m,"byte array longer than desired length"),r(m>0,"Requested array length <= 0"),this.strip();var w=v==="le",_=new g(m),A,y,T=this.clone();if(w){for(y=0;!T.isZero();y++)A=T.andln(255),T.iushrn(8),_[y]=A;for(;y=4096&&(l+=13,v>>>=13),v>=64&&(l+=7,v>>>=7),v>=8&&(l+=4,v>>>=4),v>=2&&(l+=2,v>>>=2),l+v},i.prototype._zeroBits=function(g){if(g===0)return 26;var v=g,l=0;return v&8191||(l+=13,v>>>=13),v&127||(l+=7,v>>>=7),v&15||(l+=4,v>>>=4),v&3||(l+=2,v>>>=2),v&1||l++,l},i.prototype.bitLength=function(){var g=this.words[this.length-1],v=this._countBits(g);return(this.length-1)*26+v};function S(x){for(var g=new Array(x.bitLength()),v=0;v>>d}return g}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,v=0;vg.length?this.clone().ior(g):g.clone().ior(this)},i.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},i.prototype.iuand=function(g){var v;this.length>g.length?v=g:v=this;for(var l=0;lg.length?this.clone().iand(g):g.clone().iand(this)},i.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},i.prototype.iuxor=function(g){var v,l;this.length>g.length?(v=this,l=g):(v=g,l=this);for(var d=0;dg.length?this.clone().ixor(g):g.clone().ixor(this)},i.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},i.prototype.inotn=function(g){r(typeof g=="number"&&g>=0);var v=Math.ceil(g/26)|0,l=g%26;this._expand(v),l>0&&v--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-l),this.strip()},i.prototype.notn=function(g){return this.clone().inotn(g)},i.prototype.setn=function(g,v){r(typeof g=="number"&&g>=0);var l=g/26|0,d=g%26;return this._expand(l+1),v?this.words[l]=this.words[l]|1<g.length?(l=this,d=g):(l=g,d=this);for(var m=0,w=0;w>>26;for(;m!==0&&w>>26;if(this.length=l.length,m!==0)this.words[this.length]=m,this.length++;else if(l!==this)for(;wg.length?this.clone().iadd(g):g.clone().iadd(this)},i.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var v=this.iadd(g);return g.negative=1,v._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var l=this.cmp(g);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,m;l>0?(d=this,m=g):(d=g,m=this);for(var w=0,_=0;_>26,this.words[_]=v&67108863;for(;w!==0&&_>26,this.words[_]=v&67108863;if(w===0&&_>>26,E=A&67108863,M=Math.min(y,g.length-1),W=Math.max(0,y-x.length+1);W<=M;W++){var Y=y-W|0;d=x.words[Y]|0,m=g.words[W]|0,w=d*m+E,T+=w/67108864|0,E=w&67108863}v.words[y]=E|0,A=T|0}return A!==0?v.words[y]=A|0:v.length--,v.strip()}var N=function(g,v,l){var d=g.words,m=v.words,w=l.words,_=0,A,y,T,E=d[0]|0,M=E&8191,W=E>>>13,Y=d[1]|0,P=Y&8191,G=Y>>>13,Q=d[2]|0,$=Q&8191,ee=Q>>>13,ie=d[3]|0,X=ie&8191,re=ie>>>13,ae=d[4]|0,Z=ae&8191,oe=ae>>>13,Ot=d[5]|0,De=Ot&8191,Pt=Ot>>>13,Rt=d[6]|0,Be=Rt&8191,Mt=Rt>>>13,Dt=d[7]|0,Le=Dt&8191,Bt=Dt>>>13,Lt=d[8]|0,Fe=Lt&8191,Ft=Lt>>>13,at=d[9]|0,Se=at&8191,ct=at>>>13,ut=m[0]|0,_e=ut&8191,lt=ut>>>13,ft=m[1]|0,Te=ft&8191,dt=ft>>>13,ht=m[2]|0,Ie=ht&8191,pt=ht>>>13,gt=m[3]|0,Ce=gt&8191,mt=gt>>>13,yt=m[4]|0,xe=yt&8191,vt=yt>>>13,bt=m[5]|0,Ne=bt&8191,wt=bt>>>13,At=m[6]|0,Oe=At&8191,Et=At>>>13,St=m[7]|0,Pe=St&8191,_t=St>>>13,Tt=m[8]|0,Re=Tt&8191,It=Tt>>>13,Ct=m[9]|0,Me=Ct&8191,xt=Ct>>>13;l.negative=g.negative^v.negative,l.length=19,A=Math.imul(M,_e),y=Math.imul(M,lt),y=y+Math.imul(W,_e)|0,T=Math.imul(W,lt);var rt=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(rt>>>26)|0,rt&=67108863,A=Math.imul(P,_e),y=Math.imul(P,lt),y=y+Math.imul(G,_e)|0,T=Math.imul(G,lt),A=A+Math.imul(M,Te)|0,y=y+Math.imul(M,dt)|0,y=y+Math.imul(W,Te)|0,T=T+Math.imul(W,dt)|0;var nt=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(nt>>>26)|0,nt&=67108863,A=Math.imul($,_e),y=Math.imul($,lt),y=y+Math.imul(ee,_e)|0,T=Math.imul(ee,lt),A=A+Math.imul(P,Te)|0,y=y+Math.imul(P,dt)|0,y=y+Math.imul(G,Te)|0,T=T+Math.imul(G,dt)|0,A=A+Math.imul(M,Ie)|0,y=y+Math.imul(M,pt)|0,y=y+Math.imul(W,Ie)|0,T=T+Math.imul(W,pt)|0;var nn=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(nn>>>26)|0,nn&=67108863,A=Math.imul(X,_e),y=Math.imul(X,lt),y=y+Math.imul(re,_e)|0,T=Math.imul(re,lt),A=A+Math.imul($,Te)|0,y=y+Math.imul($,dt)|0,y=y+Math.imul(ee,Te)|0,T=T+Math.imul(ee,dt)|0,A=A+Math.imul(P,Ie)|0,y=y+Math.imul(P,pt)|0,y=y+Math.imul(G,Ie)|0,T=T+Math.imul(G,pt)|0,A=A+Math.imul(M,Ce)|0,y=y+Math.imul(M,mt)|0,y=y+Math.imul(W,Ce)|0,T=T+Math.imul(W,mt)|0;var sn=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(sn>>>26)|0,sn&=67108863,A=Math.imul(Z,_e),y=Math.imul(Z,lt),y=y+Math.imul(oe,_e)|0,T=Math.imul(oe,lt),A=A+Math.imul(X,Te)|0,y=y+Math.imul(X,dt)|0,y=y+Math.imul(re,Te)|0,T=T+Math.imul(re,dt)|0,A=A+Math.imul($,Ie)|0,y=y+Math.imul($,pt)|0,y=y+Math.imul(ee,Ie)|0,T=T+Math.imul(ee,pt)|0,A=A+Math.imul(P,Ce)|0,y=y+Math.imul(P,mt)|0,y=y+Math.imul(G,Ce)|0,T=T+Math.imul(G,mt)|0,A=A+Math.imul(M,xe)|0,y=y+Math.imul(M,vt)|0,y=y+Math.imul(W,xe)|0,T=T+Math.imul(W,vt)|0;var on=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(on>>>26)|0,on&=67108863,A=Math.imul(De,_e),y=Math.imul(De,lt),y=y+Math.imul(Pt,_e)|0,T=Math.imul(Pt,lt),A=A+Math.imul(Z,Te)|0,y=y+Math.imul(Z,dt)|0,y=y+Math.imul(oe,Te)|0,T=T+Math.imul(oe,dt)|0,A=A+Math.imul(X,Ie)|0,y=y+Math.imul(X,pt)|0,y=y+Math.imul(re,Ie)|0,T=T+Math.imul(re,pt)|0,A=A+Math.imul($,Ce)|0,y=y+Math.imul($,mt)|0,y=y+Math.imul(ee,Ce)|0,T=T+Math.imul(ee,mt)|0,A=A+Math.imul(P,xe)|0,y=y+Math.imul(P,vt)|0,y=y+Math.imul(G,xe)|0,T=T+Math.imul(G,vt)|0,A=A+Math.imul(M,Ne)|0,y=y+Math.imul(M,wt)|0,y=y+Math.imul(W,Ne)|0,T=T+Math.imul(W,wt)|0;var an=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(an>>>26)|0,an&=67108863,A=Math.imul(Be,_e),y=Math.imul(Be,lt),y=y+Math.imul(Mt,_e)|0,T=Math.imul(Mt,lt),A=A+Math.imul(De,Te)|0,y=y+Math.imul(De,dt)|0,y=y+Math.imul(Pt,Te)|0,T=T+Math.imul(Pt,dt)|0,A=A+Math.imul(Z,Ie)|0,y=y+Math.imul(Z,pt)|0,y=y+Math.imul(oe,Ie)|0,T=T+Math.imul(oe,pt)|0,A=A+Math.imul(X,Ce)|0,y=y+Math.imul(X,mt)|0,y=y+Math.imul(re,Ce)|0,T=T+Math.imul(re,mt)|0,A=A+Math.imul($,xe)|0,y=y+Math.imul($,vt)|0,y=y+Math.imul(ee,xe)|0,T=T+Math.imul(ee,vt)|0,A=A+Math.imul(P,Ne)|0,y=y+Math.imul(P,wt)|0,y=y+Math.imul(G,Ne)|0,T=T+Math.imul(G,wt)|0,A=A+Math.imul(M,Oe)|0,y=y+Math.imul(M,Et)|0,y=y+Math.imul(W,Oe)|0,T=T+Math.imul(W,Et)|0;var cn=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(cn>>>26)|0,cn&=67108863,A=Math.imul(Le,_e),y=Math.imul(Le,lt),y=y+Math.imul(Bt,_e)|0,T=Math.imul(Bt,lt),A=A+Math.imul(Be,Te)|0,y=y+Math.imul(Be,dt)|0,y=y+Math.imul(Mt,Te)|0,T=T+Math.imul(Mt,dt)|0,A=A+Math.imul(De,Ie)|0,y=y+Math.imul(De,pt)|0,y=y+Math.imul(Pt,Ie)|0,T=T+Math.imul(Pt,pt)|0,A=A+Math.imul(Z,Ce)|0,y=y+Math.imul(Z,mt)|0,y=y+Math.imul(oe,Ce)|0,T=T+Math.imul(oe,mt)|0,A=A+Math.imul(X,xe)|0,y=y+Math.imul(X,vt)|0,y=y+Math.imul(re,xe)|0,T=T+Math.imul(re,vt)|0,A=A+Math.imul($,Ne)|0,y=y+Math.imul($,wt)|0,y=y+Math.imul(ee,Ne)|0,T=T+Math.imul(ee,wt)|0,A=A+Math.imul(P,Oe)|0,y=y+Math.imul(P,Et)|0,y=y+Math.imul(G,Oe)|0,T=T+Math.imul(G,Et)|0,A=A+Math.imul(M,Pe)|0,y=y+Math.imul(M,_t)|0,y=y+Math.imul(W,Pe)|0,T=T+Math.imul(W,_t)|0;var un=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(un>>>26)|0,un&=67108863,A=Math.imul(Fe,_e),y=Math.imul(Fe,lt),y=y+Math.imul(Ft,_e)|0,T=Math.imul(Ft,lt),A=A+Math.imul(Le,Te)|0,y=y+Math.imul(Le,dt)|0,y=y+Math.imul(Bt,Te)|0,T=T+Math.imul(Bt,dt)|0,A=A+Math.imul(Be,Ie)|0,y=y+Math.imul(Be,pt)|0,y=y+Math.imul(Mt,Ie)|0,T=T+Math.imul(Mt,pt)|0,A=A+Math.imul(De,Ce)|0,y=y+Math.imul(De,mt)|0,y=y+Math.imul(Pt,Ce)|0,T=T+Math.imul(Pt,mt)|0,A=A+Math.imul(Z,xe)|0,y=y+Math.imul(Z,vt)|0,y=y+Math.imul(oe,xe)|0,T=T+Math.imul(oe,vt)|0,A=A+Math.imul(X,Ne)|0,y=y+Math.imul(X,wt)|0,y=y+Math.imul(re,Ne)|0,T=T+Math.imul(re,wt)|0,A=A+Math.imul($,Oe)|0,y=y+Math.imul($,Et)|0,y=y+Math.imul(ee,Oe)|0,T=T+Math.imul(ee,Et)|0,A=A+Math.imul(P,Pe)|0,y=y+Math.imul(P,_t)|0,y=y+Math.imul(G,Pe)|0,T=T+Math.imul(G,_t)|0,A=A+Math.imul(M,Re)|0,y=y+Math.imul(M,It)|0,y=y+Math.imul(W,Re)|0,T=T+Math.imul(W,It)|0;var Ui=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,A=Math.imul(Se,_e),y=Math.imul(Se,lt),y=y+Math.imul(ct,_e)|0,T=Math.imul(ct,lt),A=A+Math.imul(Fe,Te)|0,y=y+Math.imul(Fe,dt)|0,y=y+Math.imul(Ft,Te)|0,T=T+Math.imul(Ft,dt)|0,A=A+Math.imul(Le,Ie)|0,y=y+Math.imul(Le,pt)|0,y=y+Math.imul(Bt,Ie)|0,T=T+Math.imul(Bt,pt)|0,A=A+Math.imul(Be,Ce)|0,y=y+Math.imul(Be,mt)|0,y=y+Math.imul(Mt,Ce)|0,T=T+Math.imul(Mt,mt)|0,A=A+Math.imul(De,xe)|0,y=y+Math.imul(De,vt)|0,y=y+Math.imul(Pt,xe)|0,T=T+Math.imul(Pt,vt)|0,A=A+Math.imul(Z,Ne)|0,y=y+Math.imul(Z,wt)|0,y=y+Math.imul(oe,Ne)|0,T=T+Math.imul(oe,wt)|0,A=A+Math.imul(X,Oe)|0,y=y+Math.imul(X,Et)|0,y=y+Math.imul(re,Oe)|0,T=T+Math.imul(re,Et)|0,A=A+Math.imul($,Pe)|0,y=y+Math.imul($,_t)|0,y=y+Math.imul(ee,Pe)|0,T=T+Math.imul(ee,_t)|0,A=A+Math.imul(P,Re)|0,y=y+Math.imul(P,It)|0,y=y+Math.imul(G,Re)|0,T=T+Math.imul(G,It)|0,A=A+Math.imul(M,Me)|0,y=y+Math.imul(M,xt)|0,y=y+Math.imul(W,Me)|0,T=T+Math.imul(W,xt)|0;var ki=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(ki>>>26)|0,ki&=67108863,A=Math.imul(Se,Te),y=Math.imul(Se,dt),y=y+Math.imul(ct,Te)|0,T=Math.imul(ct,dt),A=A+Math.imul(Fe,Ie)|0,y=y+Math.imul(Fe,pt)|0,y=y+Math.imul(Ft,Ie)|0,T=T+Math.imul(Ft,pt)|0,A=A+Math.imul(Le,Ce)|0,y=y+Math.imul(Le,mt)|0,y=y+Math.imul(Bt,Ce)|0,T=T+Math.imul(Bt,mt)|0,A=A+Math.imul(Be,xe)|0,y=y+Math.imul(Be,vt)|0,y=y+Math.imul(Mt,xe)|0,T=T+Math.imul(Mt,vt)|0,A=A+Math.imul(De,Ne)|0,y=y+Math.imul(De,wt)|0,y=y+Math.imul(Pt,Ne)|0,T=T+Math.imul(Pt,wt)|0,A=A+Math.imul(Z,Oe)|0,y=y+Math.imul(Z,Et)|0,y=y+Math.imul(oe,Oe)|0,T=T+Math.imul(oe,Et)|0,A=A+Math.imul(X,Pe)|0,y=y+Math.imul(X,_t)|0,y=y+Math.imul(re,Pe)|0,T=T+Math.imul(re,_t)|0,A=A+Math.imul($,Re)|0,y=y+Math.imul($,It)|0,y=y+Math.imul(ee,Re)|0,T=T+Math.imul(ee,It)|0,A=A+Math.imul(P,Me)|0,y=y+Math.imul(P,xt)|0,y=y+Math.imul(G,Me)|0,T=T+Math.imul(G,xt)|0;var Vi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,A=Math.imul(Se,Ie),y=Math.imul(Se,pt),y=y+Math.imul(ct,Ie)|0,T=Math.imul(ct,pt),A=A+Math.imul(Fe,Ce)|0,y=y+Math.imul(Fe,mt)|0,y=y+Math.imul(Ft,Ce)|0,T=T+Math.imul(Ft,mt)|0,A=A+Math.imul(Le,xe)|0,y=y+Math.imul(Le,vt)|0,y=y+Math.imul(Bt,xe)|0,T=T+Math.imul(Bt,vt)|0,A=A+Math.imul(Be,Ne)|0,y=y+Math.imul(Be,wt)|0,y=y+Math.imul(Mt,Ne)|0,T=T+Math.imul(Mt,wt)|0,A=A+Math.imul(De,Oe)|0,y=y+Math.imul(De,Et)|0,y=y+Math.imul(Pt,Oe)|0,T=T+Math.imul(Pt,Et)|0,A=A+Math.imul(Z,Pe)|0,y=y+Math.imul(Z,_t)|0,y=y+Math.imul(oe,Pe)|0,T=T+Math.imul(oe,_t)|0,A=A+Math.imul(X,Re)|0,y=y+Math.imul(X,It)|0,y=y+Math.imul(re,Re)|0,T=T+Math.imul(re,It)|0,A=A+Math.imul($,Me)|0,y=y+Math.imul($,xt)|0,y=y+Math.imul(ee,Me)|0,T=T+Math.imul(ee,xt)|0;var Hi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,A=Math.imul(Se,Ce),y=Math.imul(Se,mt),y=y+Math.imul(ct,Ce)|0,T=Math.imul(ct,mt),A=A+Math.imul(Fe,xe)|0,y=y+Math.imul(Fe,vt)|0,y=y+Math.imul(Ft,xe)|0,T=T+Math.imul(Ft,vt)|0,A=A+Math.imul(Le,Ne)|0,y=y+Math.imul(Le,wt)|0,y=y+Math.imul(Bt,Ne)|0,T=T+Math.imul(Bt,wt)|0,A=A+Math.imul(Be,Oe)|0,y=y+Math.imul(Be,Et)|0,y=y+Math.imul(Mt,Oe)|0,T=T+Math.imul(Mt,Et)|0,A=A+Math.imul(De,Pe)|0,y=y+Math.imul(De,_t)|0,y=y+Math.imul(Pt,Pe)|0,T=T+Math.imul(Pt,_t)|0,A=A+Math.imul(Z,Re)|0,y=y+Math.imul(Z,It)|0,y=y+Math.imul(oe,Re)|0,T=T+Math.imul(oe,It)|0,A=A+Math.imul(X,Me)|0,y=y+Math.imul(X,xt)|0,y=y+Math.imul(re,Me)|0,T=T+Math.imul(re,xt)|0;var Gi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,A=Math.imul(Se,xe),y=Math.imul(Se,vt),y=y+Math.imul(ct,xe)|0,T=Math.imul(ct,vt),A=A+Math.imul(Fe,Ne)|0,y=y+Math.imul(Fe,wt)|0,y=y+Math.imul(Ft,Ne)|0,T=T+Math.imul(Ft,wt)|0,A=A+Math.imul(Le,Oe)|0,y=y+Math.imul(Le,Et)|0,y=y+Math.imul(Bt,Oe)|0,T=T+Math.imul(Bt,Et)|0,A=A+Math.imul(Be,Pe)|0,y=y+Math.imul(Be,_t)|0,y=y+Math.imul(Mt,Pe)|0,T=T+Math.imul(Mt,_t)|0,A=A+Math.imul(De,Re)|0,y=y+Math.imul(De,It)|0,y=y+Math.imul(Pt,Re)|0,T=T+Math.imul(Pt,It)|0,A=A+Math.imul(Z,Me)|0,y=y+Math.imul(Z,xt)|0,y=y+Math.imul(oe,Me)|0,T=T+Math.imul(oe,xt)|0;var zi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(zi>>>26)|0,zi&=67108863,A=Math.imul(Se,Ne),y=Math.imul(Se,wt),y=y+Math.imul(ct,Ne)|0,T=Math.imul(ct,wt),A=A+Math.imul(Fe,Oe)|0,y=y+Math.imul(Fe,Et)|0,y=y+Math.imul(Ft,Oe)|0,T=T+Math.imul(Ft,Et)|0,A=A+Math.imul(Le,Pe)|0,y=y+Math.imul(Le,_t)|0,y=y+Math.imul(Bt,Pe)|0,T=T+Math.imul(Bt,_t)|0,A=A+Math.imul(Be,Re)|0,y=y+Math.imul(Be,It)|0,y=y+Math.imul(Mt,Re)|0,T=T+Math.imul(Mt,It)|0,A=A+Math.imul(De,Me)|0,y=y+Math.imul(De,xt)|0,y=y+Math.imul(Pt,Me)|0,T=T+Math.imul(Pt,xt)|0;var ji=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(ji>>>26)|0,ji&=67108863,A=Math.imul(Se,Oe),y=Math.imul(Se,Et),y=y+Math.imul(ct,Oe)|0,T=Math.imul(ct,Et),A=A+Math.imul(Fe,Pe)|0,y=y+Math.imul(Fe,_t)|0,y=y+Math.imul(Ft,Pe)|0,T=T+Math.imul(Ft,_t)|0,A=A+Math.imul(Le,Re)|0,y=y+Math.imul(Le,It)|0,y=y+Math.imul(Bt,Re)|0,T=T+Math.imul(Bt,It)|0,A=A+Math.imul(Be,Me)|0,y=y+Math.imul(Be,xt)|0,y=y+Math.imul(Mt,Me)|0,T=T+Math.imul(Mt,xt)|0;var Qi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,A=Math.imul(Se,Pe),y=Math.imul(Se,_t),y=y+Math.imul(ct,Pe)|0,T=Math.imul(ct,_t),A=A+Math.imul(Fe,Re)|0,y=y+Math.imul(Fe,It)|0,y=y+Math.imul(Ft,Re)|0,T=T+Math.imul(Ft,It)|0,A=A+Math.imul(Le,Me)|0,y=y+Math.imul(Le,xt)|0,y=y+Math.imul(Bt,Me)|0,T=T+Math.imul(Bt,xt)|0;var Ki=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,A=Math.imul(Se,Re),y=Math.imul(Se,It),y=y+Math.imul(ct,Re)|0,T=Math.imul(ct,It),A=A+Math.imul(Fe,Me)|0,y=y+Math.imul(Fe,xt)|0,y=y+Math.imul(Ft,Me)|0,T=T+Math.imul(Ft,xt)|0;var mc=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(mc>>>26)|0,mc&=67108863,A=Math.imul(Se,Me),y=Math.imul(Se,xt),y=y+Math.imul(ct,Me)|0,T=Math.imul(ct,xt);var yc=(_+A|0)+((y&8191)<<13)|0;return _=(T+(y>>>13)|0)+(yc>>>26)|0,yc&=67108863,w[0]=rt,w[1]=nt,w[2]=nn,w[3]=sn,w[4]=on,w[5]=an,w[6]=cn,w[7]=un,w[8]=Ui,w[9]=ki,w[10]=Vi,w[11]=Hi,w[12]=Gi,w[13]=zi,w[14]=ji,w[15]=Qi,w[16]=Ki,w[17]=mc,w[18]=yc,_!==0&&(w[19]=_,l.length++),l};Math.imul||(N=I);function R(x,g,v){v.negative=g.negative^x.negative,v.length=x.length+g.length;for(var l=0,d=0,m=0;m>>26)|0,d+=w>>>26,w&=67108863}v.words[m]=_,l=w,w=d}return l!==0?v.words[m]=l:v.length--,v.strip()}function D(x,g,v){var l=new U;return l.mulp(x,g,v)}i.prototype.mulTo=function(g,v){var l,d=this.length+g.length;return this.length===10&&g.length===10?l=N(this,g,v):d<63?l=I(this,g,v):d<1024?l=R(this,g,v):l=D(this,g,v),l};function U(x,g){this.x=x,this.y=g}U.prototype.makeRBT=function(g){for(var v=new Array(g),l=i.prototype._countBits(g)-1,d=0;d>=1;return d},U.prototype.permute=function(g,v,l,d,m,w){for(var _=0;_>>1)m++;return 1<>>13,l[2*w+1]=m&8191,m=m>>>13;for(w=2*v;w>=26,v+=d/67108864|0,v+=m>>>26,this.words[l]=m&67108863}return v!==0&&(this.words[l]=v,this.length++),this},i.prototype.muln=function(g){return this.clone().imuln(g)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(g){var v=S(g);if(v.length===0)return new i(1);for(var l=this,d=0;d=0);var v=g%26,l=(g-v)/26,d=67108863>>>26-v<<26-v,m;if(v!==0){var w=0;for(m=0;m>>26-v}w&&(this.words[m]=w,this.length++)}if(l!==0){for(m=this.length-1;m>=0;m--)this.words[m+l]=this.words[m];for(m=0;m=0);var d;v?d=(v-v%26)/26:d=0;var m=g%26,w=Math.min((g-m)/26,this.length),_=67108863^67108863>>>m<w)for(this.length-=w,y=0;y=0&&(T!==0||y>=d);y--){var E=this.words[y]|0;this.words[y]=T<<26-m|E>>>m,T=E&_}return A&&T!==0&&(A.words[A.length++]=T),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(g,v,l){return r(this.negative===0),this.iushrn(g,v,l)},i.prototype.shln=function(g){return this.clone().ishln(g)},i.prototype.ushln=function(g){return this.clone().iushln(g)},i.prototype.shrn=function(g){return this.clone().ishrn(g)},i.prototype.ushrn=function(g){return this.clone().iushrn(g)},i.prototype.testn=function(g){r(typeof g=="number"&&g>=0);var v=g%26,l=(g-v)/26,d=1<=0);var v=g%26,l=(g-v)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(v!==0&&l++,this.length=Math.min(l,this.length),v!==0){var d=67108863^67108863>>>v<=67108864;v++)this.words[v]-=67108864,v===this.length-1?this.words[v+1]=1:this.words[v+1]++;return this.length=Math.max(this.length,v+1),this},i.prototype.isubn=function(g){if(r(typeof g=="number"),r(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var v=0;v>26)-(A/67108864|0),this.words[m+l]=w&67108863}for(;m>26,this.words[m+l]=w&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,m=0;m>26,this.words[m]=w&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(g,v){var l=this.length-g.length,d=this.clone(),m=g,w=m.words[m.length-1]|0,_=this._countBits(w);l=26-_,l!==0&&(m=m.ushln(l),d.iushln(l),w=m.words[m.length-1]|0);var A=d.length-m.length,y;if(v!=="mod"){y=new i(null),y.length=A+1,y.words=new Array(y.length);for(var T=0;T=0;M--){var W=(d.words[m.length+M]|0)*67108864+(d.words[m.length+M-1]|0);for(W=Math.min(W/w|0,67108863),d._ishlnsubmul(m,W,M);d.negative!==0;)W--,d.negative=0,d._ishlnsubmul(m,1,M),d.isZero()||(d.negative^=1);y&&(y.words[M]=W)}return y&&y.strip(),d.strip(),v!=="div"&&l!==0&&d.iushrn(l),{div:y||null,mod:d}},i.prototype.divmod=function(g,v,l){if(r(!g.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var d,m,w;return this.negative!==0&&g.negative===0?(w=this.neg().divmod(g,v),v!=="mod"&&(d=w.div.neg()),v!=="div"&&(m=w.mod.neg(),l&&m.negative!==0&&m.iadd(g)),{div:d,mod:m}):this.negative===0&&g.negative!==0?(w=this.divmod(g.neg(),v),v!=="mod"&&(d=w.div.neg()),{div:d,mod:w.mod}):this.negative&g.negative?(w=this.neg().divmod(g.neg(),v),v!=="div"&&(m=w.mod.neg(),l&&m.negative!==0&&m.isub(g)),{div:w.div,mod:m}):g.length>this.length||this.cmp(g)<0?{div:new i(0),mod:this}:g.length===1?v==="div"?{div:this.divn(g.words[0]),mod:null}:v==="mod"?{div:null,mod:new i(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new i(this.modn(g.words[0]))}:this._wordDiv(g,v)},i.prototype.div=function(g){return this.divmod(g,"div",!1).div},i.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},i.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},i.prototype.divRound=function(g){var v=this.divmod(g);if(v.mod.isZero())return v.div;var l=v.div.negative!==0?v.mod.isub(g):v.mod,d=g.ushrn(1),m=g.andln(1),w=l.cmp(d);return w<0||m===1&&w===0?v.div:v.div.negative!==0?v.div.isubn(1):v.div.iaddn(1)},i.prototype.modn=function(g){r(g<=67108863);for(var v=(1<<26)%g,l=0,d=this.length-1;d>=0;d--)l=(v*l+(this.words[d]|0))%g;return l},i.prototype.idivn=function(g){r(g<=67108863);for(var v=0,l=this.length-1;l>=0;l--){var d=(this.words[l]|0)+v*67108864;this.words[l]=d/g|0,v=d%g}return this.strip()},i.prototype.divn=function(g){return this.clone().idivn(g)},i.prototype.egcd=function(g){r(g.negative===0),r(!g.isZero());var v=this,l=g.clone();v.negative!==0?v=v.umod(g):v=v.clone();for(var d=new i(1),m=new i(0),w=new i(0),_=new i(1),A=0;v.isEven()&&l.isEven();)v.iushrn(1),l.iushrn(1),++A;for(var y=l.clone(),T=v.clone();!v.isZero();){for(var E=0,M=1;!(v.words[0]&M)&&E<26;++E,M<<=1);if(E>0)for(v.iushrn(E);E-- >0;)(d.isOdd()||m.isOdd())&&(d.iadd(y),m.isub(T)),d.iushrn(1),m.iushrn(1);for(var W=0,Y=1;!(l.words[0]&Y)&&W<26;++W,Y<<=1);if(W>0)for(l.iushrn(W);W-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(y),_.isub(T)),w.iushrn(1),_.iushrn(1);v.cmp(l)>=0?(v.isub(l),d.isub(w),m.isub(_)):(l.isub(v),w.isub(d),_.isub(m))}return{a:w,b:_,gcd:l.iushln(A)}},i.prototype._invmp=function(g){r(g.negative===0),r(!g.isZero());var v=this,l=g.clone();v.negative!==0?v=v.umod(g):v=v.clone();for(var d=new i(1),m=new i(0),w=l.clone();v.cmpn(1)>0&&l.cmpn(1)>0;){for(var _=0,A=1;!(v.words[0]&A)&&_<26;++_,A<<=1);if(_>0)for(v.iushrn(_);_-- >0;)d.isOdd()&&d.iadd(w),d.iushrn(1);for(var y=0,T=1;!(l.words[0]&T)&&y<26;++y,T<<=1);if(y>0)for(l.iushrn(y);y-- >0;)m.isOdd()&&m.iadd(w),m.iushrn(1);v.cmp(l)>=0?(v.isub(l),d.isub(m)):(l.isub(v),m.isub(d))}var E;return v.cmpn(1)===0?E=d:E=m,E.cmpn(0)<0&&E.iadd(g),E},i.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var v=this.clone(),l=g.clone();v.negative=0,l.negative=0;for(var d=0;v.isEven()&&l.isEven();d++)v.iushrn(1),l.iushrn(1);do{for(;v.isEven();)v.iushrn(1);for(;l.isEven();)l.iushrn(1);var m=v.cmp(l);if(m<0){var w=v;v=l,l=w}else if(m===0||l.cmpn(1)===0)break;v.isub(l)}while(!0);return l.iushln(d)},i.prototype.invm=function(g){return this.egcd(g).a.umod(g)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(g){return this.words[0]&g},i.prototype.bincn=function(g){r(typeof g=="number");var v=g%26,l=(g-v)/26,d=1<>>26,_&=67108863,this.words[w]=_}return m!==0&&(this.words[w]=m,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(g){var v=g<0;if(this.negative!==0&&!v)return-1;if(this.negative===0&&v)return 1;this.strip();var l;if(this.length>1)l=1;else{v&&(g=-g),r(g<=67108863,"Number is too big");var d=this.words[0]|0;l=d===g?0:dg.length)return 1;if(this.length=0;l--){var d=this.words[l]|0,m=g.words[l]|0;if(d!==m){dm&&(v=1);break}}return v},i.prototype.gtn=function(g){return this.cmpn(g)===1},i.prototype.gt=function(g){return this.cmp(g)===1},i.prototype.gten=function(g){return this.cmpn(g)>=0},i.prototype.gte=function(g){return this.cmp(g)>=0},i.prototype.ltn=function(g){return this.cmpn(g)===-1},i.prototype.lt=function(g){return this.cmp(g)===-1},i.prototype.lten=function(g){return this.cmpn(g)<=0},i.prototype.lte=function(g){return this.cmp(g)<=0},i.prototype.eqn=function(g){return this.cmpn(g)===0},i.prototype.eq=function(g){return this.cmp(g)===0},i.red=function(g){return new C(g)},i.prototype.toRed=function(g){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(g){return this.red=g,this},i.prototype.forceRed=function(g){return r(!this.red,"Already a number in reduction context"),this._forceRed(g)},i.prototype.redAdd=function(g){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},i.prototype.redIAdd=function(g){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},i.prototype.redSub=function(g){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},i.prototype.redISub=function(g){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},i.prototype.redShl=function(g){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},i.prototype.redMul=function(g){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},i.prototype.redIMul=function(g){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(g){return r(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var k={k256:null,p224:null,p192:null,p25519:null};function z(x,g){this.name=x,this.p=new i(g,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var g=new i(null);return g.words=new Array(Math.ceil(this.n/13)),g},z.prototype.ireduce=function(g){var v=g,l;do this.split(v,this.tmp),v=this.imulK(v),v=v.iadd(this.tmp),l=v.bitLength();while(l>this.n);var d=l0?v.isub(this.p):v.strip!==void 0?v.strip():v._strip(),v},z.prototype.split=function(g,v){g.iushrn(this.n,0,v)},z.prototype.imulK=function(g){return g.imul(this.k)};function H(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(H,z),H.prototype.split=function(g,v){for(var l=4194303,d=Math.min(g.length,9),m=0;m>>22,w=_}w>>>=22,g.words[m-10]=w,w===0&&g.length>10?g.length-=10:g.length-=9},H.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var v=0,l=0;l>>=26,g.words[l]=m,v=d}return v!==0&&(g.words[g.length++]=v),g},i._prime=function(g){if(k[g])return k[g];var v;if(g==="k256")v=new H;else if(g==="p224")v=new F;else if(g==="p192")v=new V;else if(g==="p25519")v=new q;else throw new Error("Unknown prime "+g);return k[g]=v,v};function C(x){if(typeof x=="string"){var g=i._prime(x);this.m=g.p,this.prime=g}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}C.prototype._verify1=function(g){r(g.negative===0,"red works only with positives"),r(g.red,"red works only with red numbers")},C.prototype._verify2=function(g,v){r((g.negative|v.negative)===0,"red works only with positives"),r(g.red&&g.red===v.red,"red works only with red numbers")},C.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},C.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},C.prototype.add=function(g,v){this._verify2(g,v);var l=g.add(v);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},C.prototype.iadd=function(g,v){this._verify2(g,v);var l=g.iadd(v);return l.cmp(this.m)>=0&&l.isub(this.m),l},C.prototype.sub=function(g,v){this._verify2(g,v);var l=g.sub(v);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},C.prototype.isub=function(g,v){this._verify2(g,v);var l=g.isub(v);return l.cmpn(0)<0&&l.iadd(this.m),l},C.prototype.shl=function(g,v){return this._verify1(g),this.imod(g.ushln(v))},C.prototype.imul=function(g,v){return this._verify2(g,v),this.imod(g.imul(v))},C.prototype.mul=function(g,v){return this._verify2(g,v),this.imod(g.mul(v))},C.prototype.isqr=function(g){return this.imul(g,g.clone())},C.prototype.sqr=function(g){return this.mul(g,g)},C.prototype.sqrt=function(g){if(g.isZero())return g.clone();var v=this.m.andln(3);if(r(v%2===1),v===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(g,l)}for(var d=this.m.subn(1),m=0;!d.isZero()&&d.andln(1)===0;)m++,d.iushrn(1);r(!d.isZero());var w=new i(1).toRed(this),_=w.redNeg(),A=this.m.subn(1).iushrn(1),y=this.m.bitLength();for(y=new i(2*y*y).toRed(this);this.pow(y,A).cmp(_)!==0;)y.redIAdd(_);for(var T=this.pow(y,d),E=this.pow(g,d.addn(1).iushrn(1)),M=this.pow(g,d),W=m;M.cmp(w)!==0;){for(var Y=M,P=0;Y.cmp(w)!==0;P++)Y=Y.redSqr();r(P=0;m--){for(var T=v.words[m],E=y-1;E>=0;E--){var M=T>>E&1;if(w!==d[0]&&(w=this.sqr(w)),M===0&&_===0){A=0;continue}_<<=1,_|=M,A++,!(A!==l&&(m!==0||E!==0))&&(w=this.mul(w,d[_]),A=0,_=0)}y=26}return w},C.prototype.convertTo=function(g){var v=g.umod(this.m);return v===g?v.clone():v},C.prototype.convertFrom=function(g){var v=g.clone();return v.red=null,v},i.mont=function(g){return new B(g)};function B(x){C.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}n(B,C),B.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},B.prototype.convertFrom=function(g){var v=this.imod(g.mul(this.rinv));return v.red=null,v},B.prototype.imul=function(g,v){if(g.isZero()||v.isZero())return g.words[0]=0,g.length=1,g;var l=g.imul(v),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(d).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},B.prototype.mul=function(g,v){if(g.isZero()||v.isZero())return new i(0)._forceRed(this);var l=g.mul(v),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(d).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},B.prototype.invm=function(g){var v=this.imod(g._invmp(this.m).mul(this.r2));return v._forceRed(this)}})(typeof cI>"u"||cI,ZL)});var Fa=L((INe,tF)=>{h();tF.exports=eF;function eF(t,e){if(!t)throw new Error(e||"Assertion failed")}eF.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)}});var uI=L(iF=>{"use strict";h();var Pv=iF;function $ue(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t!="string"){for(var n=0;n>8,o=i&255;s?r.push(s,o):r.push(o)}return r}Pv.toArray=$ue;function rF(t){return t.length===1?"0"+t:t}Pv.zero2=rF;function nF(t){for(var e="",r=0;r{"use strict";h();var ss=sF,Yue=Qs(),Jue=Fa(),Rv=uI();ss.assert=Jue;ss.toArray=Rv.toArray;ss.zero2=Rv.zero2;ss.toHex=Rv.toHex;ss.encode=Rv.encode;function Xue(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1),i;for(i=0;i(s>>1)-1?c=(s>>1)-a:c=a,o.isubn(c)):c=0,n[i]=c,o.iushrn(1)}return n}ss.getNAF=Xue;function Zue(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0,s;t.cmpn(-n)>0||e.cmpn(-i)>0;){var o=t.andln(3)+n&3,c=e.andln(3)+i&3;o===3&&(o=-1),c===3&&(c=-1);var a;o&1?(s=t.andln(7)+n&7,(s===3||s===5)&&c===2?a=-o:a=o):a=0,r[0].push(a);var u;c&1?(s=e.andln(7)+i&7,(s===3||s===5)&&o===2?u=-c:u=c):u=0,r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}ss.getJSF=Zue;function ele(t,e,r){var n="_"+e;t.prototype[e]=function(){return this[n]!==void 0?this[n]:this[n]=r.call(this)}}ss.cachedProperty=ele;function tle(t){return typeof t=="string"?ss.toArray(t,"hex"):t}ss.parseBytes=tle;function rle(t){return new Yue(t,"hex","le")}ss.intFromLE=rle});var hI=L((RNe,dI)=>{h();var lI;dI.exports=function(e){return lI||(lI=new qa(null)),lI.generate(e)};function qa(t){this.rand=t}dI.exports.Rand=qa;qa.prototype.generate=function(e){return this._rand(e)};qa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n{"use strict";h();var iu=Qs(),R0=Xn(),Mv=R0.getNAF,nle=R0.getJSF,Dv=R0.assert;function Ua(t,e){this.type=t,this.p=new iu(e.p,16),this.red=e.prime?iu.red(e.prime):iu.mont(this.p),this.zero=new iu(0).toRed(this.red),this.one=new iu(1).toRed(this.red),this.two=new iu(2).toRed(this.red),this.n=e.n&&new iu(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}oF.exports=Ua;Ua.prototype.point=function(){throw new Error("Not implemented")};Ua.prototype.validate=function(){throw new Error("Not implemented")};Ua.prototype._fixedNafMul=function(e,r){Dv(e.precomputed);var n=e._getDoubles(),i=Mv(r,1,this._bitLength),s=(1<=c;u--)a=(a<<1)+i[u];o.push(a)}for(var f=this.jpoint(null,null,null),p=this.jpoint(null,null,null),S=s;S>0;S--){for(c=0;c=0;a--){for(var u=0;a>=0&&o[a]===0;a--)u++;if(a>=0&&u++,c=c.dblp(u),a<0)break;var f=o[a];Dv(f!==0),e.type==="affine"?f>0?c=c.mixedAdd(s[f-1>>1]):c=c.mixedAdd(s[-f-1>>1].neg()):f>0?c=c.add(s[f-1>>1]):c=c.add(s[-f-1>>1].neg())}return e.type==="affine"?c.toP():c};Ua.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,c=this._wnafT2,a=this._wnafT3,u=0,f,p,S;for(f=0;f=1;f-=2){var N=f-1,R=f;if(o[N]!==1||o[R]!==1){a[N]=Mv(n[N],o[N],this._bitLength),a[R]=Mv(n[R],o[R],this._bitLength),u=Math.max(a[N].length,u),u=Math.max(a[R].length,u);continue}var D=[r[N],null,null,r[R]];r[N].y.cmp(r[R].y)===0?(D[1]=r[N].add(r[R]),D[2]=r[N].toJ().mixedAdd(r[R].neg())):r[N].y.cmp(r[R].y.redNeg())===0?(D[1]=r[N].toJ().mixedAdd(r[R]),D[2]=r[N].add(r[R].neg())):(D[1]=r[N].toJ().mixedAdd(r[R]),D[2]=r[N].toJ().mixedAdd(r[R].neg()));var U=[-3,-1,-5,-7,0,7,5,1,3],k=nle(n[N],n[R]);for(u=Math.max(k[0].length,u),a[N]=new Array(u),a[R]=new Array(u),p=0;p=0;f--){for(var q=0;f>=0;){var C=!0;for(p=0;p=0&&q++,F=F.dblp(q),f<0)break;for(p=0;p0?S=c[p][B-1>>1]:B<0&&(S=c[p][-B-1>>1].neg()),S.type==="affine"?F=F.mixedAdd(S):F=F.add(S))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};xi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s{"use strict";h();var ile=Xn(),yr=Qs(),pI=Ss(),qf=M0(),sle=ile.assert;function Ni(t){qf.call(this,"short",t),this.a=new yr(t.a,16).toRed(this.red),this.b=new yr(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}pI(Ni,qf);aF.exports=Ni;Ni.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(e.beta)r=new yr(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(e.lambda)n=new yr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?n=s[0]:(n=s[1],sle(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(c){return{a:new yr(c.a,16),b:new yr(c.b,16)}}):o=this._getEndoBasis(n),{beta:r,lambda:n,basis:o}}};Ni.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:yr.mont(e),n=new yr(2).toRed(r).redInvm(),i=n.redNeg(),s=new yr(3).toRed(r).redNeg().redSqrt().redMul(n),o=i.redAdd(s).fromRed(),c=i.redSub(s).fromRed();return[o,c]};Ni.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),s=new yr(1),o=new yr(0),c=new yr(0),a=new yr(1),u,f,p,S,I,N,R,D=0,U,k;n.cmpn(0)!==0;){var z=i.div(n);U=i.sub(z.mul(n)),k=c.sub(z.mul(s));var H=a.sub(z.mul(o));if(!p&&U.cmp(r)<0)u=R.neg(),f=s,p=U.neg(),S=k;else if(p&&++D===2)break;R=U,i=n,n=U,c=s,s=k,a=o,o=H}I=U.neg(),N=k;var F=p.sqr().add(S.sqr()),V=I.sqr().add(N.sqr());return V.cmp(F)>=0&&(I=u,N=f),p.negative&&(p=p.neg(),S=S.neg()),I.negative&&(I=I.neg(),N=N.neg()),[{a:p,b:S},{a:I,b:N}]};Ni.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),c=s.mul(n.a),a=o.mul(i.a),u=s.mul(n.b),f=o.mul(i.b),p=e.sub(c).sub(a),S=u.add(f).neg();return{k1:p,k2:S}};Ni.prototype.pointFromX=function(e,r){e=new yr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};Ni.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};Ni.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Hr.prototype.isInfinity=function(){return this.inf};Hr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Hr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),c=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,c)};Hr.prototype.getX=function(){return this.x.fromRed()};Hr.prototype.getY=function(){return this.y.fromRed()};Hr.prototype.mul=function(e){return e=new yr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Hr.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Hr.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Hr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Hr.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Hr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Yr(t,e,r,n){qf.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new yr(0)):(this.x=new yr(e,16),this.y=new yr(r,16),this.z=new yr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}pI(Yr,qf.BasePoint);Ni.prototype.jpoint=function(e,r,n){return new Yr(this,e,r,n)};Yr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Yr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Yr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),c=e.y.redMul(n.redMul(this.z)),a=i.redSub(s),u=o.redSub(c);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),p=f.redMul(a),S=i.redMul(f),I=u.redSqr().redIAdd(p).redISub(S).redISub(S),N=u.redMul(S.redISub(I)).redISub(o.redMul(p)),R=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(I,N,R)};Yr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),c=n.redSub(i),a=s.redSub(o);if(c.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=c.redSqr(),f=u.redMul(c),p=n.redMul(u),S=a.redSqr().redIAdd(f).redISub(p).redISub(p),I=a.redMul(p.redISub(S)).redISub(s.redMul(f)),N=this.z.redMul(c);return this.curve.jpoint(S,I,N)};Yr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};Yr.prototype.inspect=function(){return this.isInfinity()?"":""};Yr.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var fF=L((qNe,lF)=>{"use strict";h();var Uf=Qs(),uF=Ss(),Bv=M0(),ole=Xn();function kf(t){Bv.call(this,"mont",t),this.a=new Uf(t.a,16).toRed(this.red),this.b=new Uf(t.b,16).toRed(this.red),this.i4=new Uf(4).toRed(this.red).redInvm(),this.two=new Uf(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}uF(kf,Bv);lF.exports=kf;kf.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Gr(t,e,r){Bv.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Uf(e,16),this.z=new Uf(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}uF(Gr,Bv.BasePoint);kf.prototype.decodePoint=function(e,r){return this.point(ole.toArray(e,r),1)};kf.prototype.point=function(e,r){return new Gr(this,e,r)};kf.prototype.pointFromJSON=function(e){return Gr.fromJSON(this,e)};Gr.prototype.precompute=function(){};Gr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Gr.fromJSON=function(e,r){return new Gr(e,r[0],r[1]||e.one)};Gr.prototype.inspect=function(){return this.isInfinity()?"":""};Gr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Gr.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),c=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,c)};Gr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Gr.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),c=o.redMul(n),a=s.redMul(i),u=r.z.redMul(c.redAdd(a).redSqr()),f=r.x.redMul(c.redISub(a).redSqr());return this.curve.point(u,f)};Gr.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var c=o.length-1;c>=0;c--)o[c]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};Gr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Gr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Gr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Gr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Gr.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var pF=L((kNe,hF)=>{"use strict";h();var ale=Xn(),ko=Qs(),dF=Ss(),Lv=M0(),cle=ale.assert;function Ks(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Lv.call(this,"edwards",t),this.a=new ko(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ko(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ko(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),cle(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}dF(Ks,Lv);hF.exports=Ks;Ks.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Ks.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Ks.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};Ks.prototype.pointFromX=function(e,r){e=new ko(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),c=o.redSqrt();if(c.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var a=c.fromRed().isOdd();return(r&&!a||!r&&a)&&(c=c.redNeg()),this.point(e,c)};Ks.prototype.pointFromY=function(e,r){e=new ko(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var c=o.redSqrt();if(c.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return c.fromRed().isOdd()!==r&&(c=c.redNeg()),this.point(c,e)};Ks.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function nr(t,e,r,n,i){Lv.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ko(e,16),this.y=new ko(r,16),this.z=n?new ko(n,16):this.curve.one,this.t=i&&new ko(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}dF(nr,Lv.BasePoint);Ks.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)};Ks.prototype.point=function(e,r,n,i){return new nr(this,e,r,n,i)};nr.fromJSON=function(e,r){return new nr(e,r[0],r[1],r[2])};nr.prototype.inspect=function(){return this.isInfinity()?"":""};nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};nr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),c=o.redSub(n),a=i.redSub(r),u=s.redMul(c),f=o.redMul(a),p=s.redMul(a),S=c.redMul(o);return this.curve.point(u,f,S,p)};nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,c,a,u;if(this.curve.twisted){c=this.curve._mulA(r);var f=c.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(f.redSub(this.curve.two)),s=f.redMul(c.redSub(n)),o=f.redSqr().redSub(f).redSub(f)):(a=this.z.redSqr(),u=f.redSub(a).redISub(a),i=e.redSub(r).redISub(n).redMul(u),s=f.redMul(c.redSub(n)),o=f.redMul(u))}else c=r.redAdd(n),a=this.curve._mulC(this.z).redSqr(),u=c.redSub(a).redSub(a),i=this.curve._mulC(e.redISub(c)).redMul(u),s=this.curve._mulC(c).redMul(r.redISub(n)),o=c.redMul(u);return this.curve.point(i,s,o)};nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};nr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),c=s.redSub(i),a=s.redAdd(i),u=n.redAdd(r),f=o.redMul(c),p=a.redMul(u),S=o.redMul(u),I=c.redMul(a);return this.curve.point(f,p,I,S)};nr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),c=n.redSub(o),a=n.redAdd(o),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),f=r.redMul(c).redMul(u),p,S;return this.curve.twisted?(p=r.redMul(a).redMul(s.redSub(this.curve._mulA(i))),S=c.redMul(a)):(p=r.redMul(a).redMul(s.redSub(i)),S=this.curve._mulC(c).redMul(a)),this.curve.point(f,p,S)};nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};nr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};nr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()};nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};nr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};nr.prototype.toP=nr.prototype.normalize;nr.prototype.mixedAdd=nr.prototype.add});var gI=L(gF=>{"use strict";h();var Fv=gF;Fv.base=M0();Fv.short=cF();Fv.mont=fF();Fv.edwards=pF()});var os=L(Xt=>{"use strict";h();var ule=Fa(),lle=Ss();Xt.inherits=lle;function fle(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function dle(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):fle(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Xt.htonl=mF;function ple(t,e){for(var r="",n=0;n>>0}return s}Xt.join32=gle;function mle(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Xt.split32=mle;function yle(t,e){return t>>>e|t<<32-e}Xt.rotr32=yle;function vle(t,e){return t<>>32-e}Xt.rotl32=vle;function ble(t,e){return t+e>>>0}Xt.sum32=ble;function wle(t,e,r){return t+e+r>>>0}Xt.sum32_3=wle;function Ale(t,e,r,n){return t+e+r+n>>>0}Xt.sum32_4=Ale;function Ele(t,e,r,n,i){return t+e+r+n+i>>>0}Xt.sum32_5=Ele;function Sle(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,c=(o>>0,t[e+1]=o}Xt.sum64=Sle;function _le(t,e,r,n){var i=e+n>>>0,s=(i>>0}Xt.sum64_hi=_le;function Tle(t,e,r,n){var i=e+n;return i>>>0}Xt.sum64_lo=Tle;function Ile(t,e,r,n,i,s,o,c){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}Xt.sum64_4_hi=Ile;function Cle(t,e,r,n,i,s,o,c){var a=e+n+s+c;return a>>>0}Xt.sum64_4_lo=Cle;function xle(t,e,r,n,i,s,o,c,a,u){var f=0,p=e;p=p+n>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0}Xt.sum64_5_hi=xle;function Nle(t,e,r,n,i,s,o,c,a,u){var f=e+n+s+c+u;return f>>>0}Xt.sum64_5_lo=Nle;function Ole(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Xt.rotr64_hi=Ole;function Ple(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Xt.rotr64_lo=Ple;function Rle(t,e,r){return t>>>r}Xt.shr64_hi=Rle;function Mle(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Xt.shr64_lo=Mle});var Vf=L(wF=>{"use strict";h();var bF=os(),Dle=Fa();function qv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}wF.BlockHash=qv;qv.prototype.update=function(e,r){if(e=bF.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=bF.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o{"use strict";h();var Ble=os(),Ws=Ble.rotr32;function Lle(t,e,r,n){if(t===0)return AF(e,r,n);if(t===1||t===3)return SF(e,r,n);if(t===2)return EF(e,r,n)}Vo.ft_1=Lle;function AF(t,e,r){return t&e^~t&r}Vo.ch32=AF;function EF(t,e,r){return t&e^t&r^e&r}Vo.maj32=EF;function SF(t,e,r){return t^e^r}Vo.p32=SF;function Fle(t){return Ws(t,2)^Ws(t,13)^Ws(t,22)}Vo.s0_256=Fle;function qle(t){return Ws(t,6)^Ws(t,11)^Ws(t,25)}Vo.s1_256=qle;function Ule(t){return Ws(t,7)^Ws(t,18)^t>>>3}Vo.g0_256=Ule;function kle(t){return Ws(t,17)^Ws(t,19)^t>>>10}Vo.g1_256=kle});var IF=L((YNe,TF)=>{"use strict";h();var Hf=os(),Vle=Vf(),Hle=mI(),yI=Hf.rotl32,D0=Hf.sum32,Gle=Hf.sum32_5,zle=Hle.ft_1,_F=Vle.BlockHash,jle=[1518500249,1859775393,2400959708,3395469782];function $s(){if(!(this instanceof $s))return new $s;_F.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Hf.inherits($s,_F);TF.exports=$s;$s.blockSize=512;$s.outSize=160;$s.hmacStrength=80;$s.padLength=64;$s.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i{"use strict";h();var Gf=os(),Qle=Vf(),zf=mI(),Kle=Fa(),as=Gf.sum32,Wle=Gf.sum32_4,$le=Gf.sum32_5,Yle=zf.ch32,Jle=zf.maj32,Xle=zf.s0_256,Zle=zf.s1_256,efe=zf.g0_256,tfe=zf.g1_256,CF=Qle.BlockHash,rfe=[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 Ys(){if(!(this instanceof Ys))return new Ys;CF.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=rfe,this.W=new Array(64)}Gf.inherits(Ys,CF);xF.exports=Ys;Ys.blockSize=512;Ys.outSize=256;Ys.hmacStrength=192;Ys.padLength=64;Ys.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i{"use strict";h();var bI=os(),NF=vI();function Ho(){if(!(this instanceof Ho))return new Ho;NF.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}bI.inherits(Ho,NF);OF.exports=Ho;Ho.blockSize=512;Ho.outSize=224;Ho.hmacStrength=192;Ho.padLength=64;Ho.prototype._digest=function(e){return e==="hex"?bI.toHex32(this.h.slice(0,7),"big"):bI.split32(this.h.slice(0,7),"big")}});var EI=L((rOe,BF)=>{"use strict";h();var kn=os(),nfe=Vf(),ife=Fa(),Js=kn.rotr64_hi,Xs=kn.rotr64_lo,RF=kn.shr64_hi,MF=kn.shr64_lo,ka=kn.sum64,wI=kn.sum64_hi,AI=kn.sum64_lo,sfe=kn.sum64_4_hi,ofe=kn.sum64_4_lo,afe=kn.sum64_5_hi,cfe=kn.sum64_5_lo,DF=nfe.BlockHash,ufe=[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 cs(){if(!(this instanceof cs))return new cs;DF.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=ufe,this.W=new Array(160)}kn.inherits(cs,DF);BF.exports=cs;cs.blockSize=1024;cs.outSize=512;cs.hmacStrength=192;cs.padLength=128;cs.prototype._prepareBlock=function(e,r){for(var n=this.W,i=0;i<32;i++)n[i]=e[r+i];for(;i{"use strict";h();var SI=os(),LF=EI();function Go(){if(!(this instanceof Go))return new Go;LF.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}SI.inherits(Go,LF);FF.exports=Go;Go.blockSize=1024;Go.outSize=384;Go.hmacStrength=192;Go.padLength=128;Go.prototype._digest=function(e){return e==="hex"?SI.toHex32(this.h.slice(0,12),"big"):SI.split32(this.h.slice(0,12),"big")}});var UF=L(jf=>{"use strict";h();jf.sha1=IF();jf.sha224=PF();jf.sha256=vI();jf.sha384=qF();jf.sha512=EI()});var jF=L(zF=>{"use strict";h();var su=os(),Efe=Vf(),Uv=su.rotl32,kF=su.sum32,B0=su.sum32_3,VF=su.sum32_4,GF=Efe.BlockHash;function Zs(){if(!(this instanceof Zs))return new Zs;GF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}su.inherits(Zs,GF);zF.ripemd160=Zs;Zs.blockSize=512;Zs.outSize=160;Zs.hmacStrength=192;Zs.padLength=64;Zs.prototype._update=function(e,r){for(var n=this.h[0],i=this.h[1],s=this.h[2],o=this.h[3],c=this.h[4],a=n,u=i,f=s,p=o,S=c,I=0;I<80;I++){var N=kF(Uv(VF(n,HF(I,i,s,o),e[Tfe[I]+r],Sfe(I)),Cfe[I]),c);n=c,c=o,o=Uv(s,10),s=i,i=N,N=kF(Uv(VF(a,HF(79-I,u,f,p),e[Ife[I]+r],_fe(I)),xfe[I]),S),a=S,S=p,p=Uv(f,10),f=u,u=N}N=B0(this.h[1],s,p),this.h[1]=B0(this.h[2],o,S),this.h[2]=B0(this.h[3],c,a),this.h[3]=B0(this.h[4],n,u),this.h[4]=B0(this.h[0],i,f),this.h[0]=N};Zs.prototype._digest=function(e){return e==="hex"?su.toHex32(this.h,"little"):su.split32(this.h,"little")};function HF(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function Sfe(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function _fe(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var Tfe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Ife=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Cfe=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],xfe=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var KF=L((lOe,QF)=>{"use strict";h();var Nfe=os(),Ofe=Fa();function Qf(t,e,r){if(!(this instanceof Qf))return new Qf(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Nfe.toArray(e,r))}QF.exports=Qf;Qf.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),Ofe(e.length<=this.blockSize);for(var r=e.length;r{h();var Jr=WF;Jr.utils=os();Jr.common=Vf();Jr.sha=UF();Jr.ripemd=jF();Jr.hmac=KF();Jr.sha1=Jr.sha.sha1;Jr.sha256=Jr.sha.sha256;Jr.sha224=Jr.sha.sha224;Jr.sha384=Jr.sha.sha384;Jr.sha512=Jr.sha.sha512;Jr.ripemd160=Jr.ripemd.ripemd160});var YF=L((pOe,$F)=>{h();$F.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var Vv=L(ZF=>{"use strict";h();var TI=ZF,Va=kv(),_I=gI(),Pfe=Xn(),JF=Pfe.assert;function XF(t){t.type==="short"?this.curve=new _I.short(t):t.type==="edwards"?this.curve=new _I.edwards(t):this.curve=new _I.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,JF(this.g.validate(),"Invalid curve"),JF(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}TI.PresetCurve=XF;function Ha(t,e){Object.defineProperty(TI,t,{configurable:!0,enumerable:!0,get:function(){var r=new XF(e);return Object.defineProperty(TI,t,{configurable:!0,enumerable:!0,value:r}),r}})}Ha("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Va.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});Ha("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Va.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});Ha("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Va.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});Ha("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Va.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});Ha("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Va.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});Ha("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Va.sha256,gRed:!1,g:["9"]});Ha("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Va.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var II;try{II=YF()}catch{II=void 0}Ha("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Va.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",II]})});var rq=L((vOe,tq)=>{"use strict";h();var Rfe=kv(),ou=uI(),eq=Fa();function Ga(t){if(!(this instanceof Ga))return new Ga(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ou.toArray(t.entropy,t.entropyEnc||"hex"),r=ou.toArray(t.nonce,t.nonceEnc||"hex"),n=ou.toArray(t.pers,t.persEnc||"hex");eq(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}tq.exports=Ga;Ga.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Ga.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ou.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length{"use strict";h();var Mfe=Qs(),Dfe=Xn(),CI=Dfe.assert;function gn(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}nq.exports=gn;gn.fromPublic=function(e,r,n){return r instanceof gn?r:new gn(e,{pub:r,pubEnc:n})};gn.fromPrivate=function(e,r,n){return r instanceof gn?r:new gn(e,{priv:r,privEnc:n})};gn.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};gn.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};gn.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};gn.prototype._importPrivate=function(e,r){this.priv=new Mfe(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};gn.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?CI(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&CI(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};gn.prototype.derive=function(e){return e.validate()||CI(e.validate(),"public point not validated"),e.mul(this.priv).getX()};gn.prototype.sign=function(e,r,n){return this.ec.sign(e,this,r,n)};gn.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};gn.prototype.inspect=function(){return""}});var aq=L((EOe,oq)=>{"use strict";h();var Hv=Qs(),OI=Xn(),Bfe=OI.assert;function Gv(t,e){if(t instanceof Gv)return t;this._importDER(t,e)||(Bfe(t.r&&t.s,"Signature without r or s"),this.r=new Hv(t.r,16),this.s=new Hv(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}oq.exports=Gv;function Lfe(){this.place=0}function xI(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function sq(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Gv.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=sq(r),n=sq(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];NI(i,r.length),i=i.concat(r),i.push(2),NI(i,n.length);var s=i.concat(n),o=[48];return NI(o,s.length),o=o.concat(s),OI.encode(o,e)}});var fq=L((_Oe,lq)=>{"use strict";h();var au=Qs(),cq=rq(),Ffe=Xn(),PI=Vv(),qfe=hI(),uq=Ffe.assert,RI=iq(),zv=aq();function Oi(t){if(!(this instanceof Oi))return new Oi(t);typeof t=="string"&&(uq(Object.prototype.hasOwnProperty.call(PI,t),"Unknown curve "+t),t=PI[t]),t instanceof PI.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}lq.exports=Oi;Oi.prototype.keyPair=function(e){return new RI(this,e)};Oi.prototype.keyFromPrivate=function(e,r){return RI.fromPrivate(this,e,r)};Oi.prototype.keyFromPublic=function(e,r){return RI.fromPublic(this,e,r)};Oi.prototype.genKeyPair=function(e){e||(e={});for(var r=new cq({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qfe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new au(2));;){var s=new au(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};Oi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Oi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new au(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),c=e.toArray("be",s),a=new cq({hash:this.hash,entropy:o,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new au(1)),f=0;;f++){var p=i.k?i.k(f):new au(a.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(u)>=0)){var S=this.g.mul(p);if(!S.isInfinity()){var I=S.getX(),N=I.umod(this.n);if(N.cmpn(0)!==0){var R=p.invm(this.n).mul(N.mul(r.getPrivate()).iadd(e));if(R=R.umod(this.n),R.cmpn(0)!==0){var D=(S.getY().isOdd()?1:0)|(I.cmp(N)!==0?2:0);return i.canonical&&R.cmp(this.nh)>0&&(R=this.n.sub(R),D^=1),new zv({r:N,s:R,recoveryParam:D})}}}}}};Oi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new au(e,16)),n=this.keyFromPublic(n,i),r=new zv(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c=o.invm(this.n),a=c.mul(e).umod(this.n),u=c.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(a,n.getPublic(),u),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(a,n.getPublic(),u),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};Oi.prototype.recoverPubKey=function(t,e,r,n){uq((3&r)===r,"The recovery param is more than two bits"),e=new zv(e,n);var i=this.n,s=new au(t),o=e.r,c=e.s,a=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),a):o=this.curve.pointFromX(o,a);var f=e.r.invm(i),p=i.sub(s).mul(f).umod(i),S=c.mul(f).umod(i);return this.g.mulAdd(p,o,S)};Oi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new zv(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}});var gq=L((IOe,pq)=>{"use strict";h();var L0=Xn(),hq=L0.assert,dq=L0.parseBytes,Kf=L0.cachedProperty;function zr(t,e){this.eddsa=t,this._secret=dq(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=dq(e.pub)}zr.fromPublic=function(e,r){return r instanceof zr?r:new zr(e,{pub:r})};zr.fromSecret=function(e,r){return r instanceof zr?r:new zr(e,{secret:r})};zr.prototype.secret=function(){return this._secret};Kf(zr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Kf(zr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Kf(zr,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});Kf(zr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Kf(zr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Kf(zr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});zr.prototype.sign=function(e){return hq(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};zr.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};zr.prototype.getSecret=function(e){return hq(this._secret,"KeyPair is public only"),L0.encode(this.secret(),e)};zr.prototype.getPublic=function(e){return L0.encode(this.pubBytes(),e)};pq.exports=zr});var vq=L((xOe,yq)=>{"use strict";h();var Ufe=Qs(),jv=Xn(),mq=jv.assert,Qv=jv.cachedProperty,kfe=jv.parseBytes;function cu(t,e){this.eddsa=t,typeof e!="object"&&(e=kfe(e)),Array.isArray(e)&&(mq(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),mq(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof Ufe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Qv(cu,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Qv(cu,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Qv(cu,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Qv(cu,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});cu.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};cu.prototype.toHex=function(){return jv.encode(this.toBytes(),"hex").toUpperCase()};yq.exports=cu});var Sq=L((OOe,Eq)=>{"use strict";h();var Vfe=kv(),Hfe=Vv(),Wf=Xn(),Gfe=Wf.assert,wq=Wf.parseBytes,Aq=gq(),bq=vq();function Vn(t){if(Gfe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Vn))return new Vn(t);t=Hfe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Vfe.sha512}Eq.exports=Vn;Vn.prototype.sign=function(e,r){e=wq(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),c=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),a=i.add(c).umod(this.curve.n);return this.makeSignature({R:s,S:a,Rencoded:o})};Vn.prototype.verify=function(e,r,n){if(e=wq(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),c=r.R().add(i.pub().mul(s));return c.eq(o)};Vn.prototype.hashInt=function(){for(var e=this.hash(),r=0;r{"use strict";h();var uu=_q;uu.version=XL().version;uu.utils=Xn();uu.rand=hI();uu.curve=gI();uu.curves=Vv();uu.ec=fq();uu.eddsa=Sq()});var Iq={};Zt(Iq,{RELAY_JSONRPC:()=>tde,isPublishMethod:()=>BI,isPublishParams:()=>LI,isPublishRequest:()=>Wfe,isSubscribeMethod:()=>MI,isSubscribeParams:()=>DI,isSubscribeRequest:()=>Kfe,isSubscriptionMethod:()=>UI,isSubscriptionParams:()=>kI,isSubscriptionRequest:()=>Yfe,isUnsubscribeMethod:()=>FI,isUnsubscribeParams:()=>qI,isUnsubscribeRequest:()=>$fe,parsePublishRequest:()=>Xfe,parseSubscribeRequest:()=>Jfe,parseSubscriptionRequest:()=>ede,parseUnsubscribeRequest:()=>Zfe});function lu(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function zfe(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function jfe(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function Qfe(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Kv(t,e,r){return(r.length?Qfe(t,e.length):jfe(t,e.length))?zfe(t,e):!1}function Wv(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}function Kfe(t){return MI(t.method)&&DI(t.params)}function MI(t){return Wv(t,"subscribe")}function DI(t){return Kv(t,["topic"],[])}function Wfe(t){return BI(t.method)&&LI(t.params)}function BI(t){return Wv(t,"publish")}function LI(t){return Kv(t,["message","topic","ttl"],["prompt","tag"])}function $fe(t){return FI(t.method)&&qI(t.params)}function FI(t){return Wv(t,"unsubscribe")}function qI(t){return Kv(t,["id","topic"],[])}function Yfe(t){return UI(t.method)&&kI(t.params)}function UI(t){return Wv(t,"subscription")}function kI(t){return Kv(t,["id","data"],[])}function Jfe(t){if(!MI(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!DI(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return lu(e,"topic"),e}function Xfe(t){if(!BI(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!LI(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return lu(e,"topic"),lu(e,"message"),lu(e,"ttl","number"),e}function Zfe(t){if(!FI(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!qI(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return lu(e,"id"),e}function ede(t){if(!UI(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!kI(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return lu(e,"id"),lu(e,"data"),e}var tde,Cq=pe(()=>{h();tde={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}}});var J0=L(K=>{"use strict";h();Object.defineProperty(K,"__esModule",{value:!0});var rde=iL(),Yf=yf(),du=JT(),nde=oL(),ide=TL(),aU=ML(),sde=UL(),lb=y0(),fb=VL(),ode=jL(),Yt=(aI(),qe(oI)),ade=Tq(),cde=($T(),qe(WT)),ude=(Cq(),qe(Iq));function cU(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var nb=cU(ide),uU=cU(ode),db=":";function lU(t){let[e,r]=t.split(db);return{namespace:e,reference:r}}function fU(t){let{namespace:e,reference:r}=t;return[e,r].join(db)}function d8(t){let[e,r,n]=t.split(db);return{namespace:e,reference:r,address:n}}function dU(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(db)}function h8(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function hU(t){let{address:e}=d8(t);return e}function pU(t){let{namespace:e,reference:r}=d8(t);return fU({namespace:e,reference:r})}function lde(t,e){let{namespace:r,reference:n}=lU(e);return dU({namespace:r,reference:n,address:t})}function fde(t){return h8(t,hU)}function gU(t){return h8(t,pU)}function dde(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function hde(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...gU(i.accounts))}),r}function pde(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...hb(n,i))}),r}function hb(t,e){return t.includes(":")?[t]:e.chains||[]}var gde=Object.defineProperty,xq=Object.getOwnPropertySymbols,mde=Object.prototype.hasOwnProperty,yde=Object.prototype.propertyIsEnumerable,Nq=(t,e,r)=>e in t?gde(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oq=(t,e)=>{for(var r in e||(e={}))mde.call(e,r)&&Nq(t,r,e[r]);if(xq)for(var r of xq(e))yde.call(e,r)&&Nq(t,r,e[r]);return t},mU="ReactNative",_n={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},ib=" ",vde=":",yU="/",p8=2,bde=1e3,vU="js";function g8(){return typeof O.default<"u"&&typeof O.default.versions<"u"&&typeof O.default.versions.node<"u"}function rd(){return!du.getDocument()&&!!du.getNavigator()&&navigator.product===mU}function K0(){return!g8()&&!!du.getNavigator()&&!!du.getDocument()}function gu(){return rd()?_n.reactNative:g8()?_n.node:K0()?_n.browser:_n.unknown}function wde(){var t;try{return rd()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function bU(t,e){let r=nb.parse(t);return r=Oq(Oq({},r),e),t=nb.stringify(r),t}function Ade(){return nde.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Ede(t,e){var r;let n=gu(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=du.getLocation())==null?void 0:r.host)||"unknown"),i}function wU(){if(gu()===_n.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=rde.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function AU(){var t;let e=gu();return e===_n.browser?[e,((t=du.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function EU(t,e,r){let n=wU(),i=AU();return[[t,e].join("-"),[vU,r].join("-"),n,i].join("/")}function Sde({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:c}){let a=r.split("?"),u=EU(t,e,n),f={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0,origin:c||void 0},p=bU(a[1]||"",f);return a[0]+"?"+p}function _de(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function Tde(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function SU(t,e=p8){return _U(t.split(yU),e)}function Ide(t){return SU(t).join(ib)}function Ka(t,e){return t.filter(r=>e.includes(r)).length===t.length}function _U(t,e=p8){return t.slice(Math.max(t.length-e,0))}function Cde(t){return Object.fromEntries(t.entries())}function xde(t){return new Map(Object.entries(t))}function Nde(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Ode=t=>t;function TU(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function Pde(t){return t.split(ib).map(e=>TU(e)).join(ib)}function Rde(t=Yf.FIVE_MINUTES,e){let r=Yf.toMiliseconds(t||Yf.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,c)=>{s=setTimeout(()=>{c(new Error(e))},r),n=o,i=c})}}function Mde(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function m8(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Dde(t){return m8("topic",t)}function Bde(t){return m8("id",t)}function Lde(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Fde(t,e){return Yf.fromMiliseconds((e||Date.now())+Yf.toMiliseconds(t))}function qde(t){return Date.now()>=Yf.toMiliseconds(t)}function Ude(t,e){return`${t}${e?`:${e}`:""}`}function $o(t=[],e=[]){return[...new Set([...t,...e])]}async function kde({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;let i=typeof r=="string"?JSON.parse(r):r,s=i?.href;if(typeof s!="string")return;let o=IU(s,t,e),c=gu();if(c===_n.browser){if(!((n=du.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,CU()?"_blank":"_self","noreferrer noopener")}else c===_n.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function IU(t,e,r){let n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){let s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${xU(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function Vde(t,e){let r="";try{if(K0()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function r8(t,e){return t.filter(r=>e.includes(r))}function Hde(t,e){if(!t.includes(e))return null;let r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Gde(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function zde(){return typeof O.default<"u"&&O.default.env.IS_VITEST==="true"}function CU(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function xU(t,e=!1){let r=b.Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function y8(t){return b.Buffer.from(t,"base64").toString("utf-8")}var NU=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jde(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var OU={exports:{}};(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof O.default=="object"&&O.default.versions&&O.default.versions.node;o?i=NU:s&&(i=self);var c=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],S=[1,256,65536,16777216],I=[6,1536,393216,100663296],N=[0,8,16,24],R=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],U=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],z={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(P){return Object.prototype.toString.call(P)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(P){return typeof P=="object"&&P.buffer&&P.buffer.constructor===ArrayBuffer});for(var H=function(P,G,Q){return function($){return new M(P,G,P).update($)[Q]()}},F=function(P,G,Q){return function($,ee){return new M(P,G,ee).update($)[Q]()}},V=function(P,G,Q){return function($,ee,ie,X){return d["cshake"+P].update($,ee,ie,X)[Q]()}},q=function(P,G,Q){return function($,ee,ie,X){return d["kmac"+P].update($,ee,ie,X)[Q]()}},C=function(P,G,Q,$){for(var ee=0;ee>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Q>>5,this.extraBytes=(Q&31)>>3;for(var $=0;$<50;++$)this.s[$]=0}M.prototype.update=function(P){if(this.finalized)throw new Error(r);var G,Q=typeof P;if(Q!=="string"){if(Q==="object"){if(P===null)throw new Error(e);if(a&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!a||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);G=!0}for(var $=this.blocks,ee=this.byteCount,ie=P.length,X=this.blockCount,re=0,ae=this.s,Z,oe;re>2]|=P[re]<>2]|=oe<>2]|=(192|oe>>6)<>2]|=(128|oe&63)<=57344?($[Z>>2]|=(224|oe>>12)<>2]|=(128|oe>>6&63)<>2]|=(128|oe&63)<>2]|=(240|oe>>18)<>2]|=(128|oe>>12&63)<>2]|=(128|oe>>6&63)<>2]|=(128|oe&63)<=ee){for(this.start=Z-ee,this.block=$[X],Z=0;Z>8,Q=P&255;Q>0;)ee.unshift(Q),P=P>>8,Q=P&255,++$;return G?ee.push($):ee.unshift($),this.update(ee),ee.length},M.prototype.encodeString=function(P){var G,Q=typeof P;if(Q!=="string"){if(Q==="object"){if(P===null)throw new Error(e);if(a&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!a||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);G=!0}var $=0,ee=P.length;if(G)$=ee;else for(var ie=0;ie=57344?$+=3:(X=65536+((X&1023)<<10|P.charCodeAt(++ie)&1023),$+=4)}return $+=this.encode($*8),this.update(P),$},M.prototype.bytepad=function(P,G){for(var Q=this.encode(G),$=0;$>2]|=this.padding[G&3],this.lastByteIndex===this.byteCount)for(P[0]=P[Q],G=1;G>4&15]+u[re&15]+u[re>>12&15]+u[re>>8&15]+u[re>>20&15]+u[re>>16&15]+u[re>>28&15]+u[re>>24&15];ie%P===0&&(Y(G),ee=0)}return $&&(re=G[ee],X+=u[re>>4&15]+u[re&15],$>1&&(X+=u[re>>12&15]+u[re>>8&15]),$>2&&(X+=u[re>>20&15]+u[re>>16&15])),X},M.prototype.arrayBuffer=function(){this.finalize();var P=this.blockCount,G=this.s,Q=this.outputBlocks,$=this.extraBytes,ee=0,ie=0,X=this.outputBits>>3,re;$?re=new ArrayBuffer(Q+1<<2):re=new ArrayBuffer(X);for(var ae=new Uint32Array(re);ie>8&255,X[re+2]=ae>>16&255,X[re+3]=ae>>24&255;ie%P===0&&Y(G)}return $&&(re=ie<<2,ae=G[ee],X[re]=ae&255,$>1&&(X[re+1]=ae>>8&255),$>2&&(X[re+2]=ae>>16&255)),X};function W(P,G,Q){M.call(this,P,G,Q)}W.prototype=new M,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),M.prototype.finalize.call(this)};var Y=function(P){var G,Q,$,ee,ie,X,re,ae,Z,oe,Ot,De,Pt,Rt,Be,Mt,Dt,Le,Bt,Lt,Fe,Ft,at,Se,ct,ut,_e,lt,ft,Te,dt,ht,Ie,pt,gt,Ce,mt,yt,xe,vt,bt,Ne,wt,At,Oe,Et,St,Pe,_t,Tt,Re,It,Ct,Me,xt,rt,nt,nn,sn,on,an,cn,un;for($=0;$<48;$+=2)ee=P[0]^P[10]^P[20]^P[30]^P[40],ie=P[1]^P[11]^P[21]^P[31]^P[41],X=P[2]^P[12]^P[22]^P[32]^P[42],re=P[3]^P[13]^P[23]^P[33]^P[43],ae=P[4]^P[14]^P[24]^P[34]^P[44],Z=P[5]^P[15]^P[25]^P[35]^P[45],oe=P[6]^P[16]^P[26]^P[36]^P[46],Ot=P[7]^P[17]^P[27]^P[37]^P[47],De=P[8]^P[18]^P[28]^P[38]^P[48],Pt=P[9]^P[19]^P[29]^P[39]^P[49],G=De^(X<<1|re>>>31),Q=Pt^(re<<1|X>>>31),P[0]^=G,P[1]^=Q,P[10]^=G,P[11]^=Q,P[20]^=G,P[21]^=Q,P[30]^=G,P[31]^=Q,P[40]^=G,P[41]^=Q,G=ee^(ae<<1|Z>>>31),Q=ie^(Z<<1|ae>>>31),P[2]^=G,P[3]^=Q,P[12]^=G,P[13]^=Q,P[22]^=G,P[23]^=Q,P[32]^=G,P[33]^=Q,P[42]^=G,P[43]^=Q,G=X^(oe<<1|Ot>>>31),Q=re^(Ot<<1|oe>>>31),P[4]^=G,P[5]^=Q,P[14]^=G,P[15]^=Q,P[24]^=G,P[25]^=Q,P[34]^=G,P[35]^=Q,P[44]^=G,P[45]^=Q,G=ae^(De<<1|Pt>>>31),Q=Z^(Pt<<1|De>>>31),P[6]^=G,P[7]^=Q,P[16]^=G,P[17]^=Q,P[26]^=G,P[27]^=Q,P[36]^=G,P[37]^=Q,P[46]^=G,P[47]^=Q,G=oe^(ee<<1|ie>>>31),Q=Ot^(ie<<1|ee>>>31),P[8]^=G,P[9]^=Q,P[18]^=G,P[19]^=Q,P[28]^=G,P[29]^=Q,P[38]^=G,P[39]^=Q,P[48]^=G,P[49]^=Q,Rt=P[0],Be=P[1],Et=P[11]<<4|P[10]>>>28,St=P[10]<<4|P[11]>>>28,lt=P[20]<<3|P[21]>>>29,ft=P[21]<<3|P[20]>>>29,on=P[31]<<9|P[30]>>>23,an=P[30]<<9|P[31]>>>23,Ne=P[40]<<18|P[41]>>>14,wt=P[41]<<18|P[40]>>>14,pt=P[2]<<1|P[3]>>>31,gt=P[3]<<1|P[2]>>>31,Mt=P[13]<<12|P[12]>>>20,Dt=P[12]<<12|P[13]>>>20,Pe=P[22]<<10|P[23]>>>22,_t=P[23]<<10|P[22]>>>22,Te=P[33]<<13|P[32]>>>19,dt=P[32]<<13|P[33]>>>19,cn=P[42]<<2|P[43]>>>30,un=P[43]<<2|P[42]>>>30,Me=P[5]<<30|P[4]>>>2,xt=P[4]<<30|P[5]>>>2,Ce=P[14]<<6|P[15]>>>26,mt=P[15]<<6|P[14]>>>26,Le=P[25]<<11|P[24]>>>21,Bt=P[24]<<11|P[25]>>>21,Tt=P[34]<<15|P[35]>>>17,Re=P[35]<<15|P[34]>>>17,ht=P[45]<<29|P[44]>>>3,Ie=P[44]<<29|P[45]>>>3,Se=P[6]<<28|P[7]>>>4,ct=P[7]<<28|P[6]>>>4,rt=P[17]<<23|P[16]>>>9,nt=P[16]<<23|P[17]>>>9,yt=P[26]<<25|P[27]>>>7,xe=P[27]<<25|P[26]>>>7,Lt=P[36]<<21|P[37]>>>11,Fe=P[37]<<21|P[36]>>>11,It=P[47]<<24|P[46]>>>8,Ct=P[46]<<24|P[47]>>>8,At=P[8]<<27|P[9]>>>5,Oe=P[9]<<27|P[8]>>>5,ut=P[18]<<20|P[19]>>>12,_e=P[19]<<20|P[18]>>>12,nn=P[29]<<7|P[28]>>>25,sn=P[28]<<7|P[29]>>>25,vt=P[38]<<8|P[39]>>>24,bt=P[39]<<8|P[38]>>>24,Ft=P[48]<<14|P[49]>>>18,at=P[49]<<14|P[48]>>>18,P[0]=Rt^~Mt&Le,P[1]=Be^~Dt&Bt,P[10]=Se^~ut<,P[11]=ct^~_e&ft,P[20]=pt^~Ce&yt,P[21]=gt^~mt&xe,P[30]=At^~Et&Pe,P[31]=Oe^~St&_t,P[40]=Me^~rt&nn,P[41]=xt^~nt&sn,P[2]=Mt^~Le&Lt,P[3]=Dt^~Bt&Fe,P[12]=ut^~lt&Te,P[13]=_e^~ft&dt,P[22]=Ce^~yt&vt,P[23]=mt^~xe&bt,P[32]=Et^~Pe&Tt,P[33]=St^~_t&Re,P[42]=rt^~nn&on,P[43]=nt^~sn&an,P[4]=Le^~Lt&Ft,P[5]=Bt^~Fe&at,P[14]=lt^~Te&ht,P[15]=ft^~dt&Ie,P[24]=yt^~vt&Ne,P[25]=xe^~bt&wt,P[34]=Pe^~Tt&It,P[35]=_t^~Re&Ct,P[44]=nn^~on&cn,P[45]=sn^~an&un,P[6]=Lt^~Ft&Rt,P[7]=Fe^~at&Be,P[16]=Te^~ht&Se,P[17]=dt^~Ie&ct,P[26]=vt^~Ne&pt,P[27]=bt^~wt>,P[36]=Tt^~It&At,P[37]=Re^~Ct&Oe,P[46]=on^~cn&Me,P[47]=an^~un&xt,P[8]=Ft^~Rt&Mt,P[9]=at^~Be&Dt,P[18]=ht^~Se&ut,P[19]=Ie^~ct&_e,P[28]=Ne^~pt&Ce,P[29]=wt^~gt&mt,P[38]=It^~At&Et,P[39]=Ct^~Oe&St,P[48]=cn^~Me&rt,P[49]=un^~xt&nt,P[0]^=R[$],P[1]^=R[$+1]};if(c)t.exports=d;else for(w=0;w{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var Dq=Wde(),n8;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(n8||(n8={}));var ls;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ls||(ls={}));var Bq="0123456789abcdef",lr=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let n=e.toLowerCase();eb[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Mq>eb[n])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,n){if(Rq)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(a=>{let u=n[a];try{if(u instanceof Uint8Array){let f="";for(let p=0;p>4],f+=Bq[u[p]&15];i.push(a+"=Uint8Array(0x"+f+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);let s=e,o="";switch(r){case ls.NUMERIC_FAULT:{o="NUMERIC_FAULT";let a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":o+="-"+a;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ls.CALL_EXCEPTION:case ls.INSUFFICIENT_FUNDS:case ls.MISSING_NEW:case ls.NONCE_EXPIRED:case ls.REPLACEMENT_UNDERPRICED:case ls.TRANSACTION_REPLACED:case ls.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let c=new Error(e);return c.reason=s,c.code=r,Object.keys(n).forEach(function(a){c[a]=n[a]}),c}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Dq&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Dq})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return VI||(VI=new t(Kde)),VI}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Pq){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Rq=!!e,Pq=!!r}static setLogLevel(e){let r=eb[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}Mq=r}static from(e){return new t(e)}};lr.errors=ls,lr.levels=n8;var $de="bytes/5.7.0",Cr=new lr($de);function PU(t){return!!t.toHexString}function Jf(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return Jf(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Yde(t){return Zn(t)&&!(t.length%2)||nd(t)}function Lq(t){return typeof t=="number"&&t==t&&t%1===0}function nd(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Lq(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function vr(t,e){if(e||(e={}),typeof t=="number"){Cr.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Jf(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PU(t)&&(t=t.toHexString()),Zn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Cr.throwArgumentError("hex data is odd-length","value",t));let n=[];for(let i=0;ivr(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Jf(n)}function Xde(t,e){t=vr(t),t.length>e&&Cr.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),Jf(r)}function Zn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var HI="0123456789abcdef";function En(t,e){if(e||(e={}),typeof t=="number"){Cr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=HI[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PU(t))return t.toHexString();if(Zn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Cr.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(nd(t)){let r="0x";for(let n=0;n>4]+HI[i&15]}return r}return Cr.throwArgumentError("invalid hexlify value","value",t)}function Zde(t){if(typeof t!="string")t=En(t);else if(!Zn(t)||t.length%2)return null;return(t.length-2)/2}function Fq(t,e,r){return typeof t!="string"?t=En(t):(!Zn(t)||t.length%2)&&Cr.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function so(t,e){for(typeof t!="string"?t=En(t):Zn(t)||Cr.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Cr.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function RU(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Yde(t)){let r=vr(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=En(r.slice(0,32)),e.s=En(r.slice(32,64))):r.length===65?(e.r=En(r.slice(0,32)),e.s=En(r.slice(32,64)),e.v=r[64]):Cr.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:Cr.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=En(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let i=Xde(vr(e._vs),32);e._vs=En(i);let s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Cr.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;let o=En(i);e.s==null?e.s=o:e.s!==o&&Cr.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?Cr.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Cr.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Zn(e.r)?Cr.throwArgumentError("signature missing or invalid r","signature",t):e.r=so(e.r,32),e.s==null||!Zn(e.s)?Cr.throwArgumentError("signature missing or invalid s","signature",t):e.s=so(e.s,32);let r=vr(e.s);r[0]>=128&&Cr.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let n=En(r);e._vs&&(Zn(e._vs)||Cr.throwArgumentError("signature invalid _vs","signature",t),e._vs=so(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&Cr.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function v8(t){return"0x"+Qde.keccak_256(vr(t))}var MU={exports:{}},ehe={},the=Object.freeze({__proto__:null,default:ehe}),rhe=jde(the);(function(t){(function(e,r){function n(l,d){if(!l)throw new Error(d||"Assertion failed")}function i(l,d){l.super_=d;var m=function(){};m.prototype=d.prototype,l.prototype=new m,l.prototype.constructor=l}function s(l,d,m){if(s.isBN(l))return l;this.negative=0,this.words=null,this.length=0,this.red=null,l!==null&&((d==="le"||d==="be")&&(m=d,d=10),this._init(l||0,d||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=rhe.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,d){return l.cmp(d)>0?l:d},s.min=function(l,d){return l.cmp(d)<0?l:d},s.prototype._init=function(l,d,m){if(typeof l=="number")return this._initNumber(l,d,m);if(typeof l=="object")return this._initArray(l,d,m);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),l=l.toString().replace(/\s+/g,"");var w=0;l[0]==="-"&&(w++,this.negative=1),w=0;w-=3)A=l[w]|l[w-1]<<8|l[w-2]<<16,this.words[_]|=A<>>26-y&67108863,y+=24,y>=26&&(y-=26,_++);else if(m==="le")for(w=0,_=0;w>>26-y&67108863,y+=24,y>=26&&(y-=26,_++);return this._strip()};function c(l,d){var m=l.charCodeAt(d);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;n(!1,"Invalid character in "+l)}function a(l,d,m){var w=c(l,m);return m-1>=d&&(w|=c(l,m-1)<<4),w}s.prototype._parseHex=function(l,d,m){this.length=Math.ceil((l.length-d)/6),this.words=new Array(this.length);for(var w=0;w=d;w-=2)y=a(l,d,w)<<_,this.words[A]|=y&67108863,_>=18?(_-=18,A+=1,this.words[A]|=y>>>26):_+=8;else{var T=l.length-d;for(w=T%2===0?d+1:d;w=18?(_-=18,A+=1,this.words[A]|=y>>>26):_+=8}this._strip()};function u(l,d,m,w){for(var _=0,A=0,y=Math.min(l.length,m),T=d;T=49?A=E-49+10:E>=17?A=E-17+10:A=E,n(E>=0&&A1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var S=["","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"],I=[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],N=[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];s.prototype.toString=function(l,d){l=l||10,d=d|0||1;var m;if(l===16||l==="hex"){m="";for(var w=0,_=0,A=0;A>>24-w&16777215,w+=2,w>=26&&(w-=26,A--),_!==0||A!==this.length-1?m=S[6-T.length]+T+m:m=T+m}for(_!==0&&(m=_.toString(16)+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(l===(l|0)&&l>=2&&l<=36){var E=I[l],M=N[l];m="";var W=this.clone();for(W.negative=0;!W.isZero();){var Y=W.modrn(M).toString(l);W=W.idivn(M),W.isZero()?m=Y+m:m=S[E-Y.length]+Y+m}for(this.isZero()&&(m="0"+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(l,d){return this.toArrayLike(o,l,d)}),s.prototype.toArray=function(l,d){return this.toArrayLike(Array,l,d)};var R=function(l,d){return l.allocUnsafe?l.allocUnsafe(d):new l(d)};s.prototype.toArrayLike=function(l,d,m){this._strip();var w=this.byteLength(),_=m||Math.max(1,w);n(w<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var A=R(l,_),y=d==="le"?"LE":"BE";return this["_toArrayLike"+y](A,w),A},s.prototype._toArrayLikeLE=function(l,d){for(var m=0,w=0,_=0,A=0;_>8&255),m>16&255),A===6?(m>24&255),w=0,A=0):(w=y>>>24,A+=2)}if(m=0&&(l[m--]=y>>8&255),m>=0&&(l[m--]=y>>16&255),A===6?(m>=0&&(l[m--]=y>>24&255),w=0,A=0):(w=y>>>24,A+=2)}if(m>=0)for(l[m--]=w;m>=0;)l[m--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var d=l,m=0;return d>=4096&&(m+=13,d>>>=13),d>=64&&(m+=7,d>>>=7),d>=8&&(m+=4,d>>>=4),d>=2&&(m+=2,d>>>=2),m+d},s.prototype._zeroBits=function(l){if(l===0)return 26;var d=l,m=0;return d&8191||(m+=13,d>>>=13),d&127||(m+=7,d>>>=7),d&15||(m+=4,d>>>=4),d&3||(m+=2,d>>>=2),d&1||m++,m},s.prototype.bitLength=function(){var l=this.words[this.length-1],d=this._countBits(l);return(this.length-1)*26+d};function D(l){for(var d=new Array(l.bitLength()),m=0;m>>_&1}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,d=0;dl.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var d;this.length>l.length?d=l:d=this;for(var m=0;ml.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var d,m;this.length>l.length?(d=this,m=l):(d=l,m=this);for(var w=0;wl.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){n(typeof l=="number"&&l>=0);var d=Math.ceil(l/26)|0,m=l%26;this._expand(d),m>0&&d--;for(var w=0;w0&&(this.words[w]=~this.words[w]&67108863>>26-m),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,d){n(typeof l=="number"&&l>=0);var m=l/26|0,w=l%26;return this._expand(m+1),d?this.words[m]=this.words[m]|1<l.length?(m=this,w=l):(m=l,w=this);for(var _=0,A=0;A>>26;for(;_!==0&&A>>26;if(this.length=m.length,_!==0)this.words[this.length]=_,this.length++;else if(m!==this)for(;Al.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var d=this.iadd(l);return l.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var m=this.cmp(l);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,_;m>0?(w=this,_=l):(w=l,_=this);for(var A=0,y=0;y<_.length;y++)d=(w.words[y]|0)-(_.words[y]|0)+A,A=d>>26,this.words[y]=d&67108863;for(;A!==0&&y>26,this.words[y]=d&67108863;if(A===0&&y>>26,Y=E&67108863,P=Math.min(M,d.length-1),G=Math.max(0,M-l.length+1);G<=P;G++){var Q=M-G|0;_=l.words[Q]|0,A=d.words[G]|0,y=_*A+Y,W+=y/67108864|0,Y=y&67108863}m.words[M]=Y|0,E=W|0}return E!==0?m.words[M]=E|0:m.length--,m._strip()}var k=function(l,d,m){var w=l.words,_=d.words,A=m.words,y=0,T,E,M,W=w[0]|0,Y=W&8191,P=W>>>13,G=w[1]|0,Q=G&8191,$=G>>>13,ee=w[2]|0,ie=ee&8191,X=ee>>>13,re=w[3]|0,ae=re&8191,Z=re>>>13,oe=w[4]|0,Ot=oe&8191,De=oe>>>13,Pt=w[5]|0,Rt=Pt&8191,Be=Pt>>>13,Mt=w[6]|0,Dt=Mt&8191,Le=Mt>>>13,Bt=w[7]|0,Lt=Bt&8191,Fe=Bt>>>13,Ft=w[8]|0,at=Ft&8191,Se=Ft>>>13,ct=w[9]|0,ut=ct&8191,_e=ct>>>13,lt=_[0]|0,ft=lt&8191,Te=lt>>>13,dt=_[1]|0,ht=dt&8191,Ie=dt>>>13,pt=_[2]|0,gt=pt&8191,Ce=pt>>>13,mt=_[3]|0,yt=mt&8191,xe=mt>>>13,vt=_[4]|0,bt=vt&8191,Ne=vt>>>13,wt=_[5]|0,At=wt&8191,Oe=wt>>>13,Et=_[6]|0,St=Et&8191,Pe=Et>>>13,_t=_[7]|0,Tt=_t&8191,Re=_t>>>13,It=_[8]|0,Ct=It&8191,Me=It>>>13,xt=_[9]|0,rt=xt&8191,nt=xt>>>13;m.negative=l.negative^d.negative,m.length=19,T=Math.imul(Y,ft),E=Math.imul(Y,Te),E=E+Math.imul(P,ft)|0,M=Math.imul(P,Te);var nn=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(nn>>>26)|0,nn&=67108863,T=Math.imul(Q,ft),E=Math.imul(Q,Te),E=E+Math.imul($,ft)|0,M=Math.imul($,Te),T=T+Math.imul(Y,ht)|0,E=E+Math.imul(Y,Ie)|0,E=E+Math.imul(P,ht)|0,M=M+Math.imul(P,Ie)|0;var sn=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(sn>>>26)|0,sn&=67108863,T=Math.imul(ie,ft),E=Math.imul(ie,Te),E=E+Math.imul(X,ft)|0,M=Math.imul(X,Te),T=T+Math.imul(Q,ht)|0,E=E+Math.imul(Q,Ie)|0,E=E+Math.imul($,ht)|0,M=M+Math.imul($,Ie)|0,T=T+Math.imul(Y,gt)|0,E=E+Math.imul(Y,Ce)|0,E=E+Math.imul(P,gt)|0,M=M+Math.imul(P,Ce)|0;var on=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(on>>>26)|0,on&=67108863,T=Math.imul(ae,ft),E=Math.imul(ae,Te),E=E+Math.imul(Z,ft)|0,M=Math.imul(Z,Te),T=T+Math.imul(ie,ht)|0,E=E+Math.imul(ie,Ie)|0,E=E+Math.imul(X,ht)|0,M=M+Math.imul(X,Ie)|0,T=T+Math.imul(Q,gt)|0,E=E+Math.imul(Q,Ce)|0,E=E+Math.imul($,gt)|0,M=M+Math.imul($,Ce)|0,T=T+Math.imul(Y,yt)|0,E=E+Math.imul(Y,xe)|0,E=E+Math.imul(P,yt)|0,M=M+Math.imul(P,xe)|0;var an=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(an>>>26)|0,an&=67108863,T=Math.imul(Ot,ft),E=Math.imul(Ot,Te),E=E+Math.imul(De,ft)|0,M=Math.imul(De,Te),T=T+Math.imul(ae,ht)|0,E=E+Math.imul(ae,Ie)|0,E=E+Math.imul(Z,ht)|0,M=M+Math.imul(Z,Ie)|0,T=T+Math.imul(ie,gt)|0,E=E+Math.imul(ie,Ce)|0,E=E+Math.imul(X,gt)|0,M=M+Math.imul(X,Ce)|0,T=T+Math.imul(Q,yt)|0,E=E+Math.imul(Q,xe)|0,E=E+Math.imul($,yt)|0,M=M+Math.imul($,xe)|0,T=T+Math.imul(Y,bt)|0,E=E+Math.imul(Y,Ne)|0,E=E+Math.imul(P,bt)|0,M=M+Math.imul(P,Ne)|0;var cn=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(cn>>>26)|0,cn&=67108863,T=Math.imul(Rt,ft),E=Math.imul(Rt,Te),E=E+Math.imul(Be,ft)|0,M=Math.imul(Be,Te),T=T+Math.imul(Ot,ht)|0,E=E+Math.imul(Ot,Ie)|0,E=E+Math.imul(De,ht)|0,M=M+Math.imul(De,Ie)|0,T=T+Math.imul(ae,gt)|0,E=E+Math.imul(ae,Ce)|0,E=E+Math.imul(Z,gt)|0,M=M+Math.imul(Z,Ce)|0,T=T+Math.imul(ie,yt)|0,E=E+Math.imul(ie,xe)|0,E=E+Math.imul(X,yt)|0,M=M+Math.imul(X,xe)|0,T=T+Math.imul(Q,bt)|0,E=E+Math.imul(Q,Ne)|0,E=E+Math.imul($,bt)|0,M=M+Math.imul($,Ne)|0,T=T+Math.imul(Y,At)|0,E=E+Math.imul(Y,Oe)|0,E=E+Math.imul(P,At)|0,M=M+Math.imul(P,Oe)|0;var un=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(un>>>26)|0,un&=67108863,T=Math.imul(Dt,ft),E=Math.imul(Dt,Te),E=E+Math.imul(Le,ft)|0,M=Math.imul(Le,Te),T=T+Math.imul(Rt,ht)|0,E=E+Math.imul(Rt,Ie)|0,E=E+Math.imul(Be,ht)|0,M=M+Math.imul(Be,Ie)|0,T=T+Math.imul(Ot,gt)|0,E=E+Math.imul(Ot,Ce)|0,E=E+Math.imul(De,gt)|0,M=M+Math.imul(De,Ce)|0,T=T+Math.imul(ae,yt)|0,E=E+Math.imul(ae,xe)|0,E=E+Math.imul(Z,yt)|0,M=M+Math.imul(Z,xe)|0,T=T+Math.imul(ie,bt)|0,E=E+Math.imul(ie,Ne)|0,E=E+Math.imul(X,bt)|0,M=M+Math.imul(X,Ne)|0,T=T+Math.imul(Q,At)|0,E=E+Math.imul(Q,Oe)|0,E=E+Math.imul($,At)|0,M=M+Math.imul($,Oe)|0,T=T+Math.imul(Y,St)|0,E=E+Math.imul(Y,Pe)|0,E=E+Math.imul(P,St)|0,M=M+Math.imul(P,Pe)|0;var Ui=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,T=Math.imul(Lt,ft),E=Math.imul(Lt,Te),E=E+Math.imul(Fe,ft)|0,M=Math.imul(Fe,Te),T=T+Math.imul(Dt,ht)|0,E=E+Math.imul(Dt,Ie)|0,E=E+Math.imul(Le,ht)|0,M=M+Math.imul(Le,Ie)|0,T=T+Math.imul(Rt,gt)|0,E=E+Math.imul(Rt,Ce)|0,E=E+Math.imul(Be,gt)|0,M=M+Math.imul(Be,Ce)|0,T=T+Math.imul(Ot,yt)|0,E=E+Math.imul(Ot,xe)|0,E=E+Math.imul(De,yt)|0,M=M+Math.imul(De,xe)|0,T=T+Math.imul(ae,bt)|0,E=E+Math.imul(ae,Ne)|0,E=E+Math.imul(Z,bt)|0,M=M+Math.imul(Z,Ne)|0,T=T+Math.imul(ie,At)|0,E=E+Math.imul(ie,Oe)|0,E=E+Math.imul(X,At)|0,M=M+Math.imul(X,Oe)|0,T=T+Math.imul(Q,St)|0,E=E+Math.imul(Q,Pe)|0,E=E+Math.imul($,St)|0,M=M+Math.imul($,Pe)|0,T=T+Math.imul(Y,Tt)|0,E=E+Math.imul(Y,Re)|0,E=E+Math.imul(P,Tt)|0,M=M+Math.imul(P,Re)|0;var ki=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(ki>>>26)|0,ki&=67108863,T=Math.imul(at,ft),E=Math.imul(at,Te),E=E+Math.imul(Se,ft)|0,M=Math.imul(Se,Te),T=T+Math.imul(Lt,ht)|0,E=E+Math.imul(Lt,Ie)|0,E=E+Math.imul(Fe,ht)|0,M=M+Math.imul(Fe,Ie)|0,T=T+Math.imul(Dt,gt)|0,E=E+Math.imul(Dt,Ce)|0,E=E+Math.imul(Le,gt)|0,M=M+Math.imul(Le,Ce)|0,T=T+Math.imul(Rt,yt)|0,E=E+Math.imul(Rt,xe)|0,E=E+Math.imul(Be,yt)|0,M=M+Math.imul(Be,xe)|0,T=T+Math.imul(Ot,bt)|0,E=E+Math.imul(Ot,Ne)|0,E=E+Math.imul(De,bt)|0,M=M+Math.imul(De,Ne)|0,T=T+Math.imul(ae,At)|0,E=E+Math.imul(ae,Oe)|0,E=E+Math.imul(Z,At)|0,M=M+Math.imul(Z,Oe)|0,T=T+Math.imul(ie,St)|0,E=E+Math.imul(ie,Pe)|0,E=E+Math.imul(X,St)|0,M=M+Math.imul(X,Pe)|0,T=T+Math.imul(Q,Tt)|0,E=E+Math.imul(Q,Re)|0,E=E+Math.imul($,Tt)|0,M=M+Math.imul($,Re)|0,T=T+Math.imul(Y,Ct)|0,E=E+Math.imul(Y,Me)|0,E=E+Math.imul(P,Ct)|0,M=M+Math.imul(P,Me)|0;var Vi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,T=Math.imul(ut,ft),E=Math.imul(ut,Te),E=E+Math.imul(_e,ft)|0,M=Math.imul(_e,Te),T=T+Math.imul(at,ht)|0,E=E+Math.imul(at,Ie)|0,E=E+Math.imul(Se,ht)|0,M=M+Math.imul(Se,Ie)|0,T=T+Math.imul(Lt,gt)|0,E=E+Math.imul(Lt,Ce)|0,E=E+Math.imul(Fe,gt)|0,M=M+Math.imul(Fe,Ce)|0,T=T+Math.imul(Dt,yt)|0,E=E+Math.imul(Dt,xe)|0,E=E+Math.imul(Le,yt)|0,M=M+Math.imul(Le,xe)|0,T=T+Math.imul(Rt,bt)|0,E=E+Math.imul(Rt,Ne)|0,E=E+Math.imul(Be,bt)|0,M=M+Math.imul(Be,Ne)|0,T=T+Math.imul(Ot,At)|0,E=E+Math.imul(Ot,Oe)|0,E=E+Math.imul(De,At)|0,M=M+Math.imul(De,Oe)|0,T=T+Math.imul(ae,St)|0,E=E+Math.imul(ae,Pe)|0,E=E+Math.imul(Z,St)|0,M=M+Math.imul(Z,Pe)|0,T=T+Math.imul(ie,Tt)|0,E=E+Math.imul(ie,Re)|0,E=E+Math.imul(X,Tt)|0,M=M+Math.imul(X,Re)|0,T=T+Math.imul(Q,Ct)|0,E=E+Math.imul(Q,Me)|0,E=E+Math.imul($,Ct)|0,M=M+Math.imul($,Me)|0,T=T+Math.imul(Y,rt)|0,E=E+Math.imul(Y,nt)|0,E=E+Math.imul(P,rt)|0,M=M+Math.imul(P,nt)|0;var Hi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,T=Math.imul(ut,ht),E=Math.imul(ut,Ie),E=E+Math.imul(_e,ht)|0,M=Math.imul(_e,Ie),T=T+Math.imul(at,gt)|0,E=E+Math.imul(at,Ce)|0,E=E+Math.imul(Se,gt)|0,M=M+Math.imul(Se,Ce)|0,T=T+Math.imul(Lt,yt)|0,E=E+Math.imul(Lt,xe)|0,E=E+Math.imul(Fe,yt)|0,M=M+Math.imul(Fe,xe)|0,T=T+Math.imul(Dt,bt)|0,E=E+Math.imul(Dt,Ne)|0,E=E+Math.imul(Le,bt)|0,M=M+Math.imul(Le,Ne)|0,T=T+Math.imul(Rt,At)|0,E=E+Math.imul(Rt,Oe)|0,E=E+Math.imul(Be,At)|0,M=M+Math.imul(Be,Oe)|0,T=T+Math.imul(Ot,St)|0,E=E+Math.imul(Ot,Pe)|0,E=E+Math.imul(De,St)|0,M=M+Math.imul(De,Pe)|0,T=T+Math.imul(ae,Tt)|0,E=E+Math.imul(ae,Re)|0,E=E+Math.imul(Z,Tt)|0,M=M+Math.imul(Z,Re)|0,T=T+Math.imul(ie,Ct)|0,E=E+Math.imul(ie,Me)|0,E=E+Math.imul(X,Ct)|0,M=M+Math.imul(X,Me)|0,T=T+Math.imul(Q,rt)|0,E=E+Math.imul(Q,nt)|0,E=E+Math.imul($,rt)|0,M=M+Math.imul($,nt)|0;var Gi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,T=Math.imul(ut,gt),E=Math.imul(ut,Ce),E=E+Math.imul(_e,gt)|0,M=Math.imul(_e,Ce),T=T+Math.imul(at,yt)|0,E=E+Math.imul(at,xe)|0,E=E+Math.imul(Se,yt)|0,M=M+Math.imul(Se,xe)|0,T=T+Math.imul(Lt,bt)|0,E=E+Math.imul(Lt,Ne)|0,E=E+Math.imul(Fe,bt)|0,M=M+Math.imul(Fe,Ne)|0,T=T+Math.imul(Dt,At)|0,E=E+Math.imul(Dt,Oe)|0,E=E+Math.imul(Le,At)|0,M=M+Math.imul(Le,Oe)|0,T=T+Math.imul(Rt,St)|0,E=E+Math.imul(Rt,Pe)|0,E=E+Math.imul(Be,St)|0,M=M+Math.imul(Be,Pe)|0,T=T+Math.imul(Ot,Tt)|0,E=E+Math.imul(Ot,Re)|0,E=E+Math.imul(De,Tt)|0,M=M+Math.imul(De,Re)|0,T=T+Math.imul(ae,Ct)|0,E=E+Math.imul(ae,Me)|0,E=E+Math.imul(Z,Ct)|0,M=M+Math.imul(Z,Me)|0,T=T+Math.imul(ie,rt)|0,E=E+Math.imul(ie,nt)|0,E=E+Math.imul(X,rt)|0,M=M+Math.imul(X,nt)|0;var zi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(zi>>>26)|0,zi&=67108863,T=Math.imul(ut,yt),E=Math.imul(ut,xe),E=E+Math.imul(_e,yt)|0,M=Math.imul(_e,xe),T=T+Math.imul(at,bt)|0,E=E+Math.imul(at,Ne)|0,E=E+Math.imul(Se,bt)|0,M=M+Math.imul(Se,Ne)|0,T=T+Math.imul(Lt,At)|0,E=E+Math.imul(Lt,Oe)|0,E=E+Math.imul(Fe,At)|0,M=M+Math.imul(Fe,Oe)|0,T=T+Math.imul(Dt,St)|0,E=E+Math.imul(Dt,Pe)|0,E=E+Math.imul(Le,St)|0,M=M+Math.imul(Le,Pe)|0,T=T+Math.imul(Rt,Tt)|0,E=E+Math.imul(Rt,Re)|0,E=E+Math.imul(Be,Tt)|0,M=M+Math.imul(Be,Re)|0,T=T+Math.imul(Ot,Ct)|0,E=E+Math.imul(Ot,Me)|0,E=E+Math.imul(De,Ct)|0,M=M+Math.imul(De,Me)|0,T=T+Math.imul(ae,rt)|0,E=E+Math.imul(ae,nt)|0,E=E+Math.imul(Z,rt)|0,M=M+Math.imul(Z,nt)|0;var ji=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(ji>>>26)|0,ji&=67108863,T=Math.imul(ut,bt),E=Math.imul(ut,Ne),E=E+Math.imul(_e,bt)|0,M=Math.imul(_e,Ne),T=T+Math.imul(at,At)|0,E=E+Math.imul(at,Oe)|0,E=E+Math.imul(Se,At)|0,M=M+Math.imul(Se,Oe)|0,T=T+Math.imul(Lt,St)|0,E=E+Math.imul(Lt,Pe)|0,E=E+Math.imul(Fe,St)|0,M=M+Math.imul(Fe,Pe)|0,T=T+Math.imul(Dt,Tt)|0,E=E+Math.imul(Dt,Re)|0,E=E+Math.imul(Le,Tt)|0,M=M+Math.imul(Le,Re)|0,T=T+Math.imul(Rt,Ct)|0,E=E+Math.imul(Rt,Me)|0,E=E+Math.imul(Be,Ct)|0,M=M+Math.imul(Be,Me)|0,T=T+Math.imul(Ot,rt)|0,E=E+Math.imul(Ot,nt)|0,E=E+Math.imul(De,rt)|0,M=M+Math.imul(De,nt)|0;var Qi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,T=Math.imul(ut,At),E=Math.imul(ut,Oe),E=E+Math.imul(_e,At)|0,M=Math.imul(_e,Oe),T=T+Math.imul(at,St)|0,E=E+Math.imul(at,Pe)|0,E=E+Math.imul(Se,St)|0,M=M+Math.imul(Se,Pe)|0,T=T+Math.imul(Lt,Tt)|0,E=E+Math.imul(Lt,Re)|0,E=E+Math.imul(Fe,Tt)|0,M=M+Math.imul(Fe,Re)|0,T=T+Math.imul(Dt,Ct)|0,E=E+Math.imul(Dt,Me)|0,E=E+Math.imul(Le,Ct)|0,M=M+Math.imul(Le,Me)|0,T=T+Math.imul(Rt,rt)|0,E=E+Math.imul(Rt,nt)|0,E=E+Math.imul(Be,rt)|0,M=M+Math.imul(Be,nt)|0;var Ki=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,T=Math.imul(ut,St),E=Math.imul(ut,Pe),E=E+Math.imul(_e,St)|0,M=Math.imul(_e,Pe),T=T+Math.imul(at,Tt)|0,E=E+Math.imul(at,Re)|0,E=E+Math.imul(Se,Tt)|0,M=M+Math.imul(Se,Re)|0,T=T+Math.imul(Lt,Ct)|0,E=E+Math.imul(Lt,Me)|0,E=E+Math.imul(Fe,Ct)|0,M=M+Math.imul(Fe,Me)|0,T=T+Math.imul(Dt,rt)|0,E=E+Math.imul(Dt,nt)|0,E=E+Math.imul(Le,rt)|0,M=M+Math.imul(Le,nt)|0;var mc=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(mc>>>26)|0,mc&=67108863,T=Math.imul(ut,Tt),E=Math.imul(ut,Re),E=E+Math.imul(_e,Tt)|0,M=Math.imul(_e,Re),T=T+Math.imul(at,Ct)|0,E=E+Math.imul(at,Me)|0,E=E+Math.imul(Se,Ct)|0,M=M+Math.imul(Se,Me)|0,T=T+Math.imul(Lt,rt)|0,E=E+Math.imul(Lt,nt)|0,E=E+Math.imul(Fe,rt)|0,M=M+Math.imul(Fe,nt)|0;var yc=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(yc>>>26)|0,yc&=67108863,T=Math.imul(ut,Ct),E=Math.imul(ut,Me),E=E+Math.imul(_e,Ct)|0,M=Math.imul(_e,Me),T=T+Math.imul(at,rt)|0,E=E+Math.imul(at,nt)|0,E=E+Math.imul(Se,rt)|0,M=M+Math.imul(Se,nt)|0;var lA=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(lA>>>26)|0,lA&=67108863,T=Math.imul(ut,rt),E=Math.imul(ut,nt),E=E+Math.imul(_e,rt)|0,M=Math.imul(_e,nt);var fA=(y+T|0)+((E&8191)<<13)|0;return y=(M+(E>>>13)|0)+(fA>>>26)|0,fA&=67108863,A[0]=nn,A[1]=sn,A[2]=on,A[3]=an,A[4]=cn,A[5]=un,A[6]=Ui,A[7]=ki,A[8]=Vi,A[9]=Hi,A[10]=Gi,A[11]=zi,A[12]=ji,A[13]=Qi,A[14]=Ki,A[15]=mc,A[16]=yc,A[17]=lA,A[18]=fA,y!==0&&(A[19]=y,m.length++),m};Math.imul||(k=U);function z(l,d,m){m.negative=d.negative^l.negative,m.length=l.length+d.length;for(var w=0,_=0,A=0;A>>26)|0,_+=y>>>26,y&=67108863}m.words[A]=T,w=y,y=_}return w!==0?m.words[A]=w:m.length--,m._strip()}function H(l,d,m){return z(l,d,m)}s.prototype.mulTo=function(l,d){var m,w=this.length+l.length;return this.length===10&&l.length===10?m=k(this,l,d):w<63?m=U(this,l,d):w<1024?m=z(this,l,d):m=H(this,l,d),m},s.prototype.mul=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),this.mulTo(l,d)},s.prototype.mulf=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),H(this,l,d)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var d=l<0;d&&(l=-l),n(typeof l=="number"),n(l<67108864);for(var m=0,w=0;w>=26,m+=_/67108864|0,m+=A>>>26,this.words[w]=A&67108863}return m!==0&&(this.words[w]=m,this.length++),d?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var d=D(l);if(d.length===0)return new s(1);for(var m=this,w=0;w=0);var d=l%26,m=(l-d)/26,w=67108863>>>26-d<<26-d,_;if(d!==0){var A=0;for(_=0;_>>26-d}A&&(this.words[_]=A,this.length++)}if(m!==0){for(_=this.length-1;_>=0;_--)this.words[_+m]=this.words[_];for(_=0;_=0);var w;d?w=(d-d%26)/26:w=0;var _=l%26,A=Math.min((l-_)/26,this.length),y=67108863^67108863>>>_<<_,T=m;if(w-=A,w=Math.max(0,w),T){for(var E=0;EA)for(this.length-=A,E=0;E=0&&(M!==0||E>=w);E--){var W=this.words[E]|0;this.words[E]=M<<26-_|W>>>_,M=W&y}return T&&M!==0&&(T.words[T.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,d,m){return n(this.negative===0),this.iushrn(l,d,m)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){n(typeof l=="number"&&l>=0);var d=l%26,m=(l-d)/26,w=1<=0);var d=l%26,m=(l-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(d!==0&&m++,this.length=Math.min(m,this.length),d!==0){var w=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},s.prototype.isubn=function(l){if(n(typeof l=="number"),n(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(T/67108864|0),this.words[_+m]=A&67108863}for(;_>26,this.words[_+m]=A&67108863;if(y===0)return this._strip();for(n(y===-1),y=0,_=0;_>26,this.words[_]=A&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,d){var m=this.length-l.length,w=this.clone(),_=l,A=_.words[_.length-1]|0,y=this._countBits(A);m=26-y,m!==0&&(_=_.ushln(m),w.iushln(m),A=_.words[_.length-1]|0);var T=w.length-_.length,E;if(d!=="mod"){E=new s(null),E.length=T+1,E.words=new Array(E.length);for(var M=0;M=0;Y--){var P=(w.words[_.length+Y]|0)*67108864+(w.words[_.length+Y-1]|0);for(P=Math.min(P/A|0,67108863),w._ishlnsubmul(_,P,Y);w.negative!==0;)P--,w.negative=0,w._ishlnsubmul(_,1,Y),w.isZero()||(w.negative^=1);E&&(E.words[Y]=P)}return E&&E._strip(),w._strip(),d!=="div"&&m!==0&&w.iushrn(m),{div:E||null,mod:w}},s.prototype.divmod=function(l,d,m){if(n(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var w,_,A;return this.negative!==0&&l.negative===0?(A=this.neg().divmod(l,d),d!=="mod"&&(w=A.div.neg()),d!=="div"&&(_=A.mod.neg(),m&&_.negative!==0&&_.iadd(l)),{div:w,mod:_}):this.negative===0&&l.negative!==0?(A=this.divmod(l.neg(),d),d!=="mod"&&(w=A.div.neg()),{div:w,mod:A.mod}):this.negative&l.negative?(A=this.neg().divmod(l.neg(),d),d!=="div"&&(_=A.mod.neg(),m&&_.negative!==0&&_.isub(l)),{div:A.div,mod:_}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?d==="div"?{div:this.divn(l.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,d)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var d=this.divmod(l);if(d.mod.isZero())return d.div;var m=d.div.negative!==0?d.mod.isub(l):d.mod,w=l.ushrn(1),_=l.andln(1),A=m.cmp(w);return A<0||_===1&&A===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(l){var d=l<0;d&&(l=-l),n(l<=67108863);for(var m=(1<<26)%l,w=0,_=this.length-1;_>=0;_--)w=(m*w+(this.words[_]|0))%l;return d?-w:w},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var d=l<0;d&&(l=-l),n(l<=67108863);for(var m=0,w=this.length-1;w>=0;w--){var _=(this.words[w]|0)+m*67108864;this.words[w]=_/l|0,m=_%l}return this._strip(),d?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){n(l.negative===0),n(!l.isZero());var d=this,m=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var w=new s(1),_=new s(0),A=new s(0),y=new s(1),T=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++T;for(var E=m.clone(),M=d.clone();!d.isZero();){for(var W=0,Y=1;!(d.words[0]&Y)&&W<26;++W,Y<<=1);if(W>0)for(d.iushrn(W);W-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(E),_.isub(M)),w.iushrn(1),_.iushrn(1);for(var P=0,G=1;!(m.words[0]&G)&&P<26;++P,G<<=1);if(P>0)for(m.iushrn(P);P-- >0;)(A.isOdd()||y.isOdd())&&(A.iadd(E),y.isub(M)),A.iushrn(1),y.iushrn(1);d.cmp(m)>=0?(d.isub(m),w.isub(A),_.isub(y)):(m.isub(d),A.isub(w),y.isub(_))}return{a:A,b:y,gcd:m.iushln(T)}},s.prototype._invmp=function(l){n(l.negative===0),n(!l.isZero());var d=this,m=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var w=new s(1),_=new s(0),A=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var y=0,T=1;!(d.words[0]&T)&&y<26;++y,T<<=1);if(y>0)for(d.iushrn(y);y-- >0;)w.isOdd()&&w.iadd(A),w.iushrn(1);for(var E=0,M=1;!(m.words[0]&M)&&E<26;++E,M<<=1);if(E>0)for(m.iushrn(E);E-- >0;)_.isOdd()&&_.iadd(A),_.iushrn(1);d.cmp(m)>=0?(d.isub(m),w.isub(_)):(m.isub(d),_.isub(w))}var W;return d.cmpn(1)===0?W=w:W=_,W.cmpn(0)<0&&W.iadd(l),W},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var d=this.clone(),m=l.clone();d.negative=0,m.negative=0;for(var w=0;d.isEven()&&m.isEven();w++)d.iushrn(1),m.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;m.isEven();)m.iushrn(1);var _=d.cmp(m);if(_<0){var A=d;d=m,m=A}else if(_===0||m.cmpn(1)===0)break;d.isub(m)}while(!0);return m.iushln(w)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){n(typeof l=="number");var d=l%26,m=(l-d)/26,w=1<>>26,y&=67108863,this.words[A]=y}return _!==0&&(this.words[A]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var d=l<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var m;if(this.length>1)m=1;else{d&&(l=-l),n(l<=67108863,"Number is too big");var w=this.words[0]|0;m=w===l?0:wl.length)return 1;if(this.length=0;m--){var w=this.words[m]|0,_=l.words[m]|0;if(w!==_){w<_?d=-1:w>_&&(d=1);break}}return d},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new g(l)},s.prototype.toRed=function(l){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return n(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return n(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var F={k256:null,p224:null,p192:null,p25519:null};function V(l,d){this.name=l,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},V.prototype.ireduce=function(l){var d=l,m;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),m=d.bitLength();while(m>this.n);var w=m0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},V.prototype.split=function(l,d){l.iushrn(this.n,0,d)},V.prototype.imulK=function(l){return l.imul(this.k)};function q(){V.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,V),q.prototype.split=function(l,d){for(var m=4194303,w=Math.min(l.length,9),_=0;_>>22,A=y}A>>>=22,l.words[_-10]=A,A===0&&l.length>10?l.length-=10:l.length-=9},q.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var d=0,m=0;m>>=26,l.words[m]=_,d=w}return d!==0&&(l.words[l.length++]=d),l},s._prime=function(l){if(F[l])return F[l];var d;if(l==="k256")d=new q;else if(l==="p224")d=new C;else if(l==="p192")d=new B;else if(l==="p25519")d=new x;else throw new Error("Unknown prime "+l);return F[l]=d,d};function g(l){if(typeof l=="string"){var d=s._prime(l);this.m=d.p,this.prime=d}else n(l.gtn(1),"modulus must be greater than 1"),this.m=l,this.prime=null}g.prototype._verify1=function(l){n(l.negative===0,"red works only with positives"),n(l.red,"red works only with red numbers")},g.prototype._verify2=function(l,d){n((l.negative|d.negative)===0,"red works only with positives"),n(l.red&&l.red===d.red,"red works only with red numbers")},g.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(f(l,l.umod(this.m)._forceRed(this)),l)},g.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},g.prototype.add=function(l,d){this._verify2(l,d);var m=l.add(d);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},g.prototype.iadd=function(l,d){this._verify2(l,d);var m=l.iadd(d);return m.cmp(this.m)>=0&&m.isub(this.m),m},g.prototype.sub=function(l,d){this._verify2(l,d);var m=l.sub(d);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},g.prototype.isub=function(l,d){this._verify2(l,d);var m=l.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},g.prototype.shl=function(l,d){return this._verify1(l),this.imod(l.ushln(d))},g.prototype.imul=function(l,d){return this._verify2(l,d),this.imod(l.imul(d))},g.prototype.mul=function(l,d){return this._verify2(l,d),this.imod(l.mul(d))},g.prototype.isqr=function(l){return this.imul(l,l.clone())},g.prototype.sqr=function(l){return this.mul(l,l)},g.prototype.sqrt=function(l){if(l.isZero())return l.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(l,m)}for(var w=this.m.subn(1),_=0;!w.isZero()&&w.andln(1)===0;)_++,w.iushrn(1);n(!w.isZero());var A=new s(1).toRed(this),y=A.redNeg(),T=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new s(2*E*E).toRed(this);this.pow(E,T).cmp(y)!==0;)E.redIAdd(y);for(var M=this.pow(E,w),W=this.pow(l,w.addn(1).iushrn(1)),Y=this.pow(l,w),P=_;Y.cmp(A)!==0;){for(var G=Y,Q=0;G.cmp(A)!==0;Q++)G=G.redSqr();n(Q=0;_--){for(var M=d.words[_],W=E-1;W>=0;W--){var Y=M>>W&1;if(A!==w[0]&&(A=this.sqr(A)),Y===0&&y===0){T=0;continue}y<<=1,y|=Y,T++,!(T!==m&&(_!==0||W!==0))&&(A=this.mul(A,w[y]),T=0,y=0)}E=26}return A},g.prototype.convertTo=function(l){var d=l.umod(this.m);return d===l?d.clone():d},g.prototype.convertFrom=function(l){var d=l.clone();return d.red=null,d},s.mont=function(l){return new v(l)};function v(l){g.call(this,l),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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(v,g),v.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},v.prototype.convertFrom=function(l){var d=this.imod(l.mul(this.rinv));return d.red=null,d},v.prototype.imul=function(l,d){if(l.isZero()||d.isZero())return l.words[0]=0,l.length=1,l;var m=l.imul(d),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=m.isub(w).iushrn(this.shift),A=_;return _.cmp(this.m)>=0?A=_.isub(this.m):_.cmpn(0)<0&&(A=_.iadd(this.m)),A._forceRed(this)},v.prototype.mul=function(l,d){if(l.isZero()||d.isZero())return new s(0)._forceRed(this);var m=l.mul(d),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=m.isub(w).iushrn(this.shift),A=_;return _.cmp(this.m)>=0?A=_.isub(this.m):_.cmpn(0)<0&&(A=_.iadd(this.m)),A._forceRed(this)},v.prototype.invm=function(l){var d=this.imod(l._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(t,NU)})(MU);var He=MU.exports,DU="bignumber/5.7.0",sb=He.BN,jo=new lr(DU),GI={},qq=9007199254740991;function nhe(t){return t!=null&&(Zr.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Zn(t)||typeof t=="bigint"||nd(t))}var Uq=!1,Zr=class t{constructor(e,r){e!==GI&&jo.throwError("cannot call constructor directly; use BigNumber.from",lr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Hn($e(this).fromTwos(e))}toTwos(e){return Hn($e(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return Hn($e(this).add($e(e)))}sub(e){return Hn($e(this).sub($e(e)))}div(e){return t.from(e).isZero()&&Pi("division-by-zero","div"),Hn($e(this).div($e(e)))}mul(e){return Hn($e(this).mul($e(e)))}mod(e){let r=$e(e);return r.isNeg()&&Pi("division-by-zero","mod"),Hn($e(this).umod(r))}pow(e){let r=$e(e);return r.isNeg()&&Pi("negative-power","pow"),Hn($e(this).pow(r))}and(e){let r=$e(e);return(this.isNegative()||r.isNeg())&&Pi("unbound-bitwise-result","and"),Hn($e(this).and(r))}or(e){let r=$e(e);return(this.isNegative()||r.isNeg())&&Pi("unbound-bitwise-result","or"),Hn($e(this).or(r))}xor(e){let r=$e(e);return(this.isNegative()||r.isNeg())&&Pi("unbound-bitwise-result","xor"),Hn($e(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Pi("negative-width","mask"),Hn($e(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Pi("negative-width","shl"),Hn($e(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Pi("negative-width","shr"),Hn($e(this).shrn(e))}eq(e){return $e(this).eq($e(e))}lt(e){return $e(this).lt($e(e))}lte(e){return $e(this).lte($e(e))}gt(e){return $e(this).gt($e(e))}gte(e){return $e(this).gte($e(e))}isNegative(){return this._hex[0]==="-"}isZero(){return $e(this).isZero()}toNumber(){try{return $e(this).toNumber()}catch{Pi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return jo.throwError("this platform does not support BigInt",lr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Uq||(Uq=!0,jo.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?jo.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",lr.errors.UNEXPECTED_ARGUMENT,{}):jo.throwError("BigNumber.toString does not accept parameters",lr.errors.UNEXPECTED_ARGUMENT,{})),$e(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(GI,j0(e)):e.match(/^-?[0-9]+$/)?new t(GI,j0(new sb(e))):jo.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Pi("underflow","BigNumber.from",e),(e>=qq||e<=-qq)&&Pi("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(nd(r))return t.from(En(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return t.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(Zn(n)||n[0]==="-"&&Zn(n.substring(1))))return t.from(n)}return jo.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function j0(t){if(typeof t!="string")return j0(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&jo.throwArgumentError("invalid hex","value",t),t=j0(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Hn(t){return Zr.from(j0(t))}function $e(t){let e=Zr.from(t).toHexString();return e[0]==="-"?new sb("-"+e.substring(3),16):new sb(e.substring(2),16)}function Pi(t,e,r){let n={fault:t,operation:e};return r!=null&&(n.value=r),jo.throwError(t,lr.errors.NUMERIC_FAULT,n)}function ihe(t){return new sb(t,36).toString(16)}var Sn=new lr(DU),V0={},BU=Zr.from(0),LU=Zr.from(-1);function FU(t,e,r,n){let i={fault:e,operation:r};return n!==void 0&&(i.value=n),Sn.throwError(t,lr.errors.NUMERIC_FAULT,i)}var H0="0";for(;H0.length<256;)H0+=H0;function b8(t){if(typeof t!="number")try{t=Zr.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+H0.substring(0,t):Sn.throwArgumentError("invalid decimal size","decimals",t)}function zI(t,e){e==null&&(e=0);let r=b8(e);t=Zr.from(t);let n=t.lt(BU);n&&(t=t.mul(LU));let i=t.mod(r).toString();for(;i.length2&&Sn.throwArgumentError("too many decimal points","value",t);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&FU("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.lengthe[o]==null?a:(typeof e[o]!==c&&Sn.throwArgumentError("invalid fixed format ("+o+" not "+c+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&Sn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&Sn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(V0,r,n,i)}},ob=class t{constructor(e,r,n,i){e!==V0&&Sn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",lr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Sn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(kq.toFormat(r.format))),r}ceiling(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(kq.toFormat(r.format))),r}round(e){e==null&&(e=0);let r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&Sn.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;let n=t.from("1"+H0.substring(0,e),this.format),i=she.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Sn.throwArgumentError("invalid byte width","width",e);let r=Zr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return so(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return t.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!nhe(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),t.fromString(zI(e,r),G0.from(n))}static fromString(e,r){r==null&&(r="fixed");let n=G0.from(r),i=zo(e,n.decimals);!n.signed&&i.lt(BU)&&FU("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=so(s,n.width/8));let o=zI(i,n.decimals);return new t(V0,s,o,n)}static fromBytes(e,r){r==null&&(r="fixed");let n=G0.from(r);if(vr(e).length>n.width/8)throw new Error("overflow");let i=Zr.from(e);n.signed&&(i=i.fromTwos(n.width));let s=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=zI(i,n.decimals);return new t(V0,s,o,n)}static from(e,r){if(typeof e=="string")return t.fromString(e,r);if(nd(e))return t.fromBytes(e,r);try{return t.fromValue(e,0,r)}catch(n){if(n.code!==lr.errors.INVALID_ARGUMENT)throw n}return Sn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}},kq=ob.from(1),she=ob.from("0.5"),ohe="strings/5.7.0",qU=new lr(ohe),ab;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(ab||(ab={}));var Xf;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Xf||(Xf={}));function ahe(t,e,r,n,i){return qU.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function UU(t,e,r,n,i){if(t===Xf.BAD_PREFIX||t===Xf.UNEXPECTED_CONTINUE){let s=0;for(let o=e+1;o>6===2;o++)s++;return s}return t===Xf.OVERRUN?r.length-e-1:0}function che(t,e,r,n,i){return t===Xf.OVERLONG?(n.push(i),0):(n.push(65533),UU(t,e,r))}Object.freeze({error:ahe,ignore:UU,replace:che});function jI(t,e=ab.current){e!=ab.current&&(qU.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;let s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return vr(r)}function uhe(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function Vq(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}Vq("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),QI("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),QI("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),QI("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",uhe),Vq("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");var kU="hash/5.7.0";function lhe(t){t=atob(t);let e=[];for(let r=0;r0&&Array.isArray(c)?i(c,o-1):r.push(c)})};return i(t,e),r}function fhe(t){let e={};for(let r=0;r>--a&1}let p=31,S=Math.pow(2,p),I=S>>>1,N=I>>1,R=S-1,D=0;for(let F=0;F1;){let x=V+q>>>1;F>>1|f(),C=C<<1^I,B=(B^I)<<1|I|1;k=C,z=1+B-C}let H=n-4;return U.map(F=>{switch(F-H){case 3:return H+65792+(t[c++]<<16|t[c++]<<8|t[c++]);case 2:return H+256+(t[c++]<<8|t[c++]);case 1:return H+t[c++];default:return F-1}})}function hhe(t){let e=0;return()=>t[e++]}function phe(t){return hhe(dhe(t))}function ghe(t){return t&1?~t>>1:t>>1}function mhe(t,e){let r=Array(t);for(let n=0;ne[o]):r}function vhe(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(whe(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Ahe(r,t))}return fhe(VU(e))}function bhe(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function HU(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[o].push(s));return n}function whe(t,e){let r=1+e(),n=e(),i=bhe(e),s=HU(i.length,1+t,e);return VU(s.map((o,c)=>{let a=o[0],u=o.slice(1);return Array(i[c]).fill(void 0).map((f,p)=>{let S=p*n;return[a+p*r,u.map(I=>I+S)]})}))}function Ahe(t,e){let r=1+e();return HU(r,1+t,e).map(n=>[n[0],n.slice(1)])}function Ehe(t){let e=cb(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=cb(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,f)=>f.set.size-u.set.size);let i=t(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let c=i==1,a=i==2;return{branches:n,valid:s,fe0f:o,save:c,check:a}}}function She(){return phe(lhe("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}var $v=She();new Set(cb($v)),new Set(cb($v)),vhe($v),Ehe($v),new lr(kU);var _he=new Uint8Array(32);_he.fill(0);var The=`Ethereum Signed Message: +`;function GU(t){return typeof t=="string"&&(t=jI(t)),v8(Jde([jI(The),jI(String(t.length)),t]))}var Ihe="rlp/5.7.0";new lr(Ihe);var Che="address/5.7.0",k0=new lr(Che);function Gq(t){Zn(t,20)||k0.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);let n=vr(v8(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}var xhe=9007199254740991;function Nhe(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var w8={};for(let t=0;t<10;t++)w8[String(t)]=String(t);for(let t=0;t<26;t++)w8[String.fromCharCode(65+t)]=String(10+t);var zq=Math.floor(Nhe(xhe));function Ohe(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>w8[n]).join("");for(;e.length>=zq;){let n=e.substring(0,zq);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function Phe(t){let e=null;if(typeof t!="string"&&k0.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Gq(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&k0.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Ohe(t)&&k0.throwArgumentError("bad icap checksum","address",t),e=ihe(t.substring(4));e.length<40;)e="0"+e;e=Gq("0x"+e)}else k0.throwArgumentError("invalid address","address",t);return e}var Rhe="properties/5.7.0";new lr(Rhe);function F0(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new lr(kU);var Mhe=new Uint8Array(32);Mhe.fill(0),Zr.from(-1);var Dhe=Zr.from(0),Bhe=Zr.from(1);Zr.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),so(Bhe.toHexString(),32),so(Dhe.toHexString(),32);var eo={},Ye={},W0=zU;function zU(t,e){if(!t)throw new Error(e||"Assertion failed")}zU.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var i8={exports:{}};typeof Object.create=="function"?i8.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:i8.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var Lhe=W0,Fhe=i8.exports;Ye.inherits=Fhe;function qhe(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function Uhe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):qhe(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Ye.htonl=jU;function Vhe(t,e){for(var r="",n=0;n>>0}return s}Ye.join32=Hhe;function Ghe(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Ye.split32=Ghe;function zhe(t,e){return t>>>e|t<<32-e}Ye.rotr32=zhe;function jhe(t,e){return t<>>32-e}Ye.rotl32=jhe;function Qhe(t,e){return t+e>>>0}Ye.sum32=Qhe;function Khe(t,e,r){return t+e+r>>>0}Ye.sum32_3=Khe;function Whe(t,e,r,n){return t+e+r+n>>>0}Ye.sum32_4=Whe;function $he(t,e,r,n,i){return t+e+r+n+i>>>0}Ye.sum32_5=$he;function Yhe(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,c=(o>>0,t[e+1]=o}Ye.sum64=Yhe;function Jhe(t,e,r,n){var i=e+n>>>0,s=(i>>0}Ye.sum64_hi=Jhe;function Xhe(t,e,r,n){var i=e+n;return i>>>0}Ye.sum64_lo=Xhe;function Zhe(t,e,r,n,i,s,o,c){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}Ye.sum64_4_hi=Zhe;function e0e(t,e,r,n,i,s,o,c){var a=e+n+s+c;return a>>>0}Ye.sum64_4_lo=e0e;function t0e(t,e,r,n,i,s,o,c,a,u){var f=0,p=e;p=p+n>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0}Ye.sum64_5_hi=t0e;function r0e(t,e,r,n,i,s,o,c,a,u){var f=e+n+s+c+u;return f>>>0}Ye.sum64_5_lo=r0e;function n0e(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Ye.rotr64_hi=n0e;function i0e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ye.rotr64_lo=i0e;function s0e(t,e,r){return t>>>r}Ye.shr64_hi=s0e;function o0e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ye.shr64_lo=o0e;var id={},jq=Ye,a0e=W0;function Yv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}id.BlockHash=Yv,Yv.prototype.update=function(t,e){if(t=jq.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=jq.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s>>3}lo.g0_256=d0e;function h0e(t){return oo(t,17)^oo(t,19)^t>>>10}lo.g1_256=h0e;var ed=Ye,p0e=id,g0e=lo,KI=ed.rotl32,q0=ed.sum32,m0e=ed.sum32_5,y0e=g0e.ft_1,JU=p0e.BlockHash,v0e=[1518500249,1859775393,2400959708,3395469782];function ro(){if(!(this instanceof ro))return new ro;JU.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ed.inherits(ro,JU);var b0e=ro;ro.blockSize=512,ro.outSize=160,ro.hmacStrength=80,ro.padLength=64,ro.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=new this.Hash().update(t).digest()),ope(t.length<=this.blockSize);for(var e=t.length;e>8,S=f&255;p?a.push(p,S):a.push(S)}return a}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var c="",a=0;a(S>>1)-1?R=(S>>1)-D:R=D,I.isubn(R)):R=0,p[N]=R,I.iushrn(1)}return p}r.getNAF=n;function i(a,u){var f=[[],[]];a=a.clone(),u=u.clone();for(var p=0,S=0,I;a.cmpn(-p)>0||u.cmpn(-S)>0;){var N=a.andln(3)+p&3,R=u.andln(3)+S&3;N===3&&(N=-1),R===3&&(R=-1);var D;N&1?(I=a.andln(7)+p&7,(I===3||I===5)&&R===2?D=-N:D=N):D=0,f[0].push(D);var U;R&1?(I=u.andln(7)+S&7,(I===3||I===5)&&N===2?U=-R:U=R):U=0,f[1].push(U),2*p===D+1&&(p=1-p),2*S===U+1&&(S=1-S),a.iushrn(1),u.iushrn(1)}return f}r.getJSF=i;function s(a,u,f){var p="_"+u;a.prototype[u]=function(){return this[p]!==void 0?this[p]:this[p]=f.call(this)}}r.cachedProperty=s;function o(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=o;function c(a){return new He(a,"hex","le")}r.intFromLE=c}),Xv=ei.getNAF,upe=ei.getJSF,ub=ei.assert;function ja(t,e){this.type=t,this.p=new He(e.p,16),this.red=e.prime?He.red(e.prime):He.mont(this.p),this.zero=new He(0).toRed(this.red),this.one=new He(1).toRed(this.red),this.two=new He(2).toRed(this.red),this.n=e.n&&new He(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var mu=ja;ja.prototype.point=function(){throw new Error("Not implemented")},ja.prototype.validate=function(){throw new Error("Not implemented")},ja.prototype._fixedNafMul=function(t,e){ub(t.precomputed);var r=t._getDoubles(),n=Xv(e,1,this._bitLength),i=(1<=o;a--)c=(c<<1)+n[a];s.push(c)}for(var u=this.jpoint(null,null,null),f=this.jpoint(null,null,null),p=i;p>0;p--){for(o=0;o=0;c--){for(var a=0;c>=0&&s[c]===0;c--)a++;if(c>=0&&a++,o=o.dblp(a),c<0)break;var u=s[c];ub(u!==0),t.type==="affine"?u>0?o=o.mixedAdd(i[u-1>>1]):o=o.mixedAdd(i[-u-1>>1].neg()):u>0?o=o.add(i[u-1>>1]):o=o.add(i[-u-1>>1].neg())}return t.type==="affine"?o.toP():o},ja.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,o=this._wnafT2,c=this._wnafT3,a=0,u,f,p;for(u=0;u=1;u-=2){var I=u-1,N=u;if(s[I]!==1||s[N]!==1){c[I]=Xv(r[I],s[I],this._bitLength),c[N]=Xv(r[N],s[N],this._bitLength),a=Math.max(c[I].length,a),a=Math.max(c[N].length,a);continue}var R=[e[I],null,null,e[N]];e[I].y.cmp(e[N].y)===0?(R[1]=e[I].add(e[N]),R[2]=e[I].toJ().mixedAdd(e[N].neg())):e[I].y.cmp(e[N].y.redNeg())===0?(R[1]=e[I].toJ().mixedAdd(e[N]),R[2]=e[I].add(e[N].neg())):(R[1]=e[I].toJ().mixedAdd(e[N]),R[2]=e[I].toJ().mixedAdd(e[N].neg()));var D=[-3,-1,-5,-7,0,7,5,1,3],U=upe(r[I],r[N]);for(a=Math.max(U[0].length,a),c[I]=new Array(a),c[N]=new Array(a),f=0;f=0;u--){for(var V=0;u>=0;){var q=!0;for(f=0;f=0&&V++,H=H.dblp(V),u<0)break;for(f=0;f0?p=o[f][C-1>>1]:C<0&&(p=o[f][-C-1>>1].neg()),p.type==="affine"?H=H.mixedAdd(p):H=H.add(p))}}for(u=0;u=Math.ceil((t.bitLength()+1)/e.step):!1},Ri.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(S=a,I=u),f.negative&&(f=f.neg(),p=p.neg()),S.negative&&(S=S.neg(),I=I.neg()),[{a:f,b:p},{a:S,b:I}]},Di.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),c=s.mul(n.a),a=i.mul(r.b),u=s.mul(n.b),f=t.sub(o).sub(c),p=a.add(u).neg();return{k1:f,k2:p}},Di.prototype.pointFromX=function(t,e){t=new He(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Di.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Di.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},jr.prototype.isInfinity=function(){return this.inf},jr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},jr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},jr.prototype.getX=function(){return this.x.fromRed()},jr.prototype.getY=function(){return this.y.fromRed()},jr.prototype.mul=function(t){return t=new He(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},jr.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},jr.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},jr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},jr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},jr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Xr(t,e,r,n){mu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new He(0)):(this.x=new He(e,16),this.y=new He(r,16),this.z=new He(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}E8(Xr,mu.BasePoint),Di.prototype.jpoint=function(t,e,r){return new Xr(this,t,e,r)},Xr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Xr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Xr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),c=n.redSub(i),a=s.redSub(o);if(c.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=c.redSqr(),f=u.redMul(c),p=n.redMul(u),S=a.redSqr().redIAdd(f).redISub(p).redISub(p),I=a.redMul(p.redISub(S)).redISub(s.redMul(f)),N=this.z.redMul(t.z).redMul(c);return this.curve.jpoint(S,I,N)},Xr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),c=i.redSub(s);if(o.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var a=o.redSqr(),u=a.redMul(o),f=r.redMul(a),p=c.redSqr().redIAdd(u).redISub(f).redISub(f),S=c.redMul(f.redISub(p)).redISub(i.redMul(u)),I=this.z.redMul(o);return this.curve.jpoint(p,S,I)},Xr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Xr.prototype.inspect=function(){return this.isInfinity()?"":""},Xr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var tb=od(function(t,e){var r=e;r.base=mu,r.short=fpe,r.mont=null,r.edwards=null}),rb=od(function(t,e){var r=e,n=ei.assert;function i(c){c.type==="short"?this.curve=new tb.short(c):c.type==="edwards"?this.curve=new tb.edwards(c):this.curve=new tb.mont(c),this.g=this.curve.g,this.n=this.curve.n,this.hash=c.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(c,a){Object.defineProperty(r,c,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,c,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:eo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:eo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:eo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:eo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:eo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:eo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:eo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:eo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Qa(t){if(!(this instanceof Qa))return new Qa(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ds.toArray(t.entropy,t.entropyEnc||"hex"),r=ds.toArray(t.nonce,t.nonceEnc||"hex"),n=ds.toArray(t.pers,t.persEnc||"hex");A8(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var $q=Qa;Qa.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Qa.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=ds.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var dpe=ei.assert;function pb(t,e){if(t instanceof pb)return t;this._importDER(t,e)||(dpe(t.r&&t.s,"Signature without r or s"),this.r=new He(t.r,16),this.s=new He(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Zv=pb;function hpe(){this.place=0}function XI(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function Yq(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}pb.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=Yq(e),r=Yq(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];ZI(n,e.length),n=n.concat(e),n.push(2),ZI(n,r.length);var i=n.concat(r),s=[48];return ZI(s,i.length),s=s.concat(i),ei.encode(s,t)};var ppe=function(){throw new Error("unsupported")},uk=ei.assert;function Mi(t){if(!(this instanceof Mi))return new Mi(t);typeof t=="string"&&(uk(Object.prototype.hasOwnProperty.call(rb,t),"Unknown curve "+t),t=rb[t]),t instanceof rb.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gpe=Mi;Mi.prototype.keyPair=function(t){return new JI(this,t)},Mi.prototype.keyFromPrivate=function(t,e){return JI.fromPrivate(this,t,e)},Mi.prototype.keyFromPublic=function(t,e){return JI.fromPublic(this,t,e)},Mi.prototype.genKeyPair=function(t){t||(t={});for(var e=new $q({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||ppe(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new He(2));;){var i=new He(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Mi.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Mi.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new He(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),o=t.toArray("be",i),c=new $q({hash:this.hash,entropy:s,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),a=this.n.sub(new He(1)),u=0;;u++){var f=n.k?n.k(u):new He(c.generate(this.n.byteLength()));if(f=this._truncateToN(f,!0),!(f.cmpn(1)<=0||f.cmp(a)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var S=p.getX(),I=S.umod(this.n);if(I.cmpn(0)!==0){var N=f.invm(this.n).mul(I.mul(e.getPrivate()).iadd(t));if(N=N.umod(this.n),N.cmpn(0)!==0){var R=(p.getY().isOdd()?1:0)|(S.cmp(I)!==0?2:0);return n.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),R^=1),new Zv({r:I,s:N,recoveryParam:R})}}}}}},Mi.prototype.verify=function(t,e,r,n){t=this._truncateToN(new He(t,16)),r=this.keyFromPublic(r,n),e=new Zv(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o=s.invm(this.n),c=o.mul(t).umod(this.n),a=o.mul(i).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(c,r.getPublic(),a),u.isInfinity()?!1:u.eqXToP(i)):(u=this.g.mulAdd(c,r.getPublic(),a),u.isInfinity()?!1:u.getX().umod(this.n).cmp(i)===0)},Mi.prototype.recoverPubKey=function(t,e,r,n){uk((3&r)===r,"The recovery param is more than two bits"),e=new Zv(e,n);var i=this.n,s=new He(t),o=e.r,c=e.s,a=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),a):o=this.curve.pointFromX(o,a);var f=e.r.invm(i),p=i.sub(s).mul(f).umod(i),S=c.mul(f).umod(i);return this.g.mulAdd(p,o,S)},Mi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Zv(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var mpe=od(function(t,e){var r=e;r.version="6.5.4",r.utils=ei,r.rand=function(){throw new Error("unsupported")},r.curve=tb,r.curves=rb,r.ec=gpe,r.eddsa=null}),ype=mpe.ec,vpe="signing-key/5.7.0",a8=new lr(vpe),e8=null;function io(){return e8||(e8=new ype("secp256k1")),e8}var c8=class{constructor(e){F0(this,"curve","secp256k1"),F0(this,"privateKey",En(e)),Zde(this.privateKey)!==32&&a8.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let r=io().keyFromPrivate(vr(this.privateKey));F0(this,"publicKey","0x"+r.getPublic(!1,"hex")),F0(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),F0(this,"_isSigningKey",!0)}_addPoint(e){let r=io().keyFromPublic(vr(this.publicKey)),n=io().keyFromPublic(vr(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){let r=io().keyFromPrivate(vr(this.privateKey)),n=vr(e);n.length!==32&&a8.throwArgumentError("bad digest length","digest",e);let i=r.sign(n,{canonical:!0});return RU({recoveryParam:i.recoveryParam,r:so("0x"+i.r.toString(16),32),s:so("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let r=io().keyFromPrivate(vr(this.privateKey)),n=io().keyFromPublic(vr(lk(e)));return so("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};function bpe(t,e){let r=RU(e),n={r:vr(r.r),s:vr(r.s)};return"0x"+io().recoverPubKey(vr(t),n,r.recoveryParam).encode("hex",!1)}function lk(t,e){let r=vr(t);if(r.length===32){let n=new c8(r);return e?"0x"+io().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?En(r):"0x"+io().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+io().keyFromPublic(r).getPublic(!0,"hex"):En(r)}return a8.throwArgumentError("invalid public or private key","key","[REDACTED]")}var wpe="transactions/5.7.0";new lr(wpe);var Jq;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Jq||(Jq={}));function Ape(t){let e=lk(t);return Phe(Fq(v8(Fq(e,1)),12))}function Epe(t,e){return Ape(bpe(vr(t),e))}var Spe="https://rpc.walletconnect.org/v1";async function fk(t,e,r,n,i,s){switch(r.t){case"eip191":return dk(t,e,r.s);case"eip1271":return await hk(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function dk(t,e,r){return Epe(GU(e),r).toLowerCase()===t.toLowerCase()}async function hk(t,e,r,n,i,s){try{let o="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",u=r.substring(2),f=GU(e).substring(2),p=o+f+c+a+u,S=await fetch(`${s||Spe}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:_pe(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:p},"latest"]})}),{result:I}=await S.json();return I?I.slice(0,o.length).toLowerCase()===o.toLowerCase():!1}catch(o){return console.error("isValidEip1271Signature: ",o),!1}}function _pe(){return Date.now()+Math.floor(Math.random()*1e3)}var Tpe=Object.defineProperty,Ipe=Object.defineProperties,Cpe=Object.getOwnPropertyDescriptors,Xq=Object.getOwnPropertySymbols,xpe=Object.prototype.hasOwnProperty,Npe=Object.prototype.propertyIsEnumerable,Zq=(t,e,r)=>e in t?Tpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S8=(t,e)=>{for(var r in e||(e={}))xpe.call(e,r)&&Zq(t,r,e[r]);if(Xq)for(var r of Xq(e))Npe.call(e,r)&&Zq(t,r,e[r]);return t},pk=(t,e)=>Ipe(t,Cpe(e)),Ope="did:pkh:",gb=t=>t?.split(":"),_8=t=>{let e=t&&gb(t);if(e)return t.includes(Ope)?e[3]:e[1]},Ppe=t=>{let e=t&&gb(t);if(e)return e[2]+":"+e[3]},T8=t=>{let e=t&&gb(t);if(e)return e.pop()};async function Rpe(t){let{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=gk(i,i.iss),o=T8(i.iss);return await fk(o,s,n,_8(i.iss),r)}var gk=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=T8(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0,s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,c=`Chain ID: ${_8(e)}`,a=`Nonce: ${t.nonce}`,u=`Issued At: ${t.iat}`,f=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,S=t.requestId?`Request ID: ${t.requestId}`:void 0,I=t.resources?`Resources:${t.resources.map(R=>` +- ${R}`).join("")}`:void 0,N=yb(t.resources);if(N){let R=$a(N);i=x8(i,R)}return[r,n,"",i,"",s,o,c,a,u,f,p,S,I].filter(R=>R!=null).join(` +`)};function Mpe(t,e,r){return r.includes("did:pkh:")||(r=`did:pkh:${r}`),{h:{t:"caip122"},p:{iss:r,domain:t.domain,aud:t.aud,version:t.version,nonce:t.nonce,iat:t.iat,statement:t.statement,requestId:t.requestId,resources:t.resources,nbf:t.nbf,exp:t.exp},s:e}}function Dpe(t){var e;let{authPayload:r,chains:n,methods:i}=t,s=r.statement||"";if(!(n!=null&&n.length))return r;let o=r.chains,c=r8(o,n);if(!(c!=null&&c.length))throw new Error("No supported chains");let a=mk(r.resources);if(!a)return r;uo(a);let u=yk(a,"eip155"),f=r?.resources||[];if(u!=null&&u.length){let p=vk(u),S=r8(p,i);if(!(S!=null&&S.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(p)}, supported: ${JSON.stringify(i)}`);let I=I8("request",S,{chains:c}),N=Ek(a,"eip155",I);f=((e=r?.resources)==null?void 0:e.slice(0,-1))||[],f.push(mb(N))}return pk(S8({},r),{statement:_k(s,yb(f)),chains:c,resources:r!=null&&r.resources||f.length>0?f:void 0})}function mk(t){let e=yb(t);if(e&&C8(e))return $a(e)}function Bpe(t,e){var r;return(r=t?.att)==null?void 0:r.hasOwnProperty(e)}function yk(t,e){var r,n;return(r=t?.att)!=null&&r[e]?Object.keys((n=t?.att)==null?void 0:n[e]):[]}function Lpe(t){return t?.map(e=>Object.keys(e))||[]}function vk(t){return t?.map(e=>{var r;return(r=e.split("/"))==null?void 0:r[1]})||[]}function bk(t){return b.Buffer.from(JSON.stringify(t)).toString("base64")}function wk(t){return JSON.parse(b.Buffer.from(t,"base64").toString("utf-8"))}function uo(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");let e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{let n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{let s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function Ak(t,e,r,n={}){return r?.sort((i,s)=>i.localeCompare(s)),{att:{[t]:I8(e,r,n)}}}function Ek(t,e,r){var n;return t.att[e]=S8({},r),((n=Object.keys(t.att))==null?void 0:n.sort((i,s)=>i.localeCompare(s))).reduce((i,s)=>(i.att[s]=t.att[s],i),{att:{}})}function I8(t,e,r={}){e=e?.sort((i,s)=>i.localeCompare(s));let n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function mb(t){return uo(t),`urn:recap:${bk(t).replace(/=/g,"")}`}function $a(t){let e=wk(t.replace("urn:recap:",""));return uo(e),e}function Fpe(t,e,r){let n=Ak(t,e,r);return mb(n)}function C8(t){return t&&t.includes("urn:recap:")}function qpe(t,e){let r=$a(t),n=$a(e),i=Sk(r,n);return mb(i)}function Sk(t,e){uo(t),uo(e);let r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((c,a)=>c.localeCompare(a)).forEach(c=>{var a,u;n.att[i]=pk(S8({},n.att[i]),{[c]:((a=t.att[i])==null?void 0:a[c])||((u=e.att[i])==null?void 0:u[c])})})}),n}function x8(t="",e){uo(e);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;let n=[],i=0;Object.keys(e.att).forEach(c=>{let a=Object.keys(e.att[c]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));a.sort((p,S)=>p.action.localeCompare(S.action));let u={};a.forEach(p=>{u[p.ability]||(u[p.ability]=[]),u[p.ability].push(p.action)});let f=Object.keys(u).map(p=>(i++,`(${i}) '${p}': '${u[p].join("', '")}' for '${c}'.`));n.push(f.join(", ").replace(".,","."))});let s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function Upe(t){var e;let r=$a(t);uo(r);let n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function kpe(t){let e=$a(t);uo(e);let r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function _k(t,e){if(!e)return t;let r=$a(e);return uo(r),x8(t,r)}function yb(t){if(!t)return;let e=t?.[t.length-1];return C8(e)?e:void 0}var N8="base10",Tn="base16",O8="base64pad",Vpe="base64url",ad="utf8",P8=0,cd=1,$0=2,Hpe=0,eU=1,z0=12,R8=32;function Gpe(){let t=uU.generateKeyPair();return{privateKey:Yt.toString(t.secretKey,Tn),publicKey:Yt.toString(t.publicKey,Tn)}}function zpe(){let t=lb.randomBytes(R8);return Yt.toString(t,Tn)}function jpe(t,e){let r=uU.sharedKey(Yt.fromString(t,Tn),Yt.fromString(e,Tn),!0),n=new sde.HKDF(fb.SHA256,r).expand(R8);return Yt.toString(n,Tn)}function Qpe(t){let e=fb.hash(Yt.fromString(t,Tn));return Yt.toString(e,Tn)}function Kpe(t){let e=fb.hash(Yt.fromString(t,ad));return Yt.toString(e,Tn)}function M8(t){return Yt.fromString(`${t}`,N8)}function hu(t){return Number(Yt.toString(t,N8))}function Wpe(t){let e=M8(typeof t.type<"u"?t.type:P8);if(hu(e)===cd&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?Yt.fromString(t.senderPublicKey,Tn):void 0,n=typeof t.iv<"u"?Yt.fromString(t.iv,Tn):lb.randomBytes(z0),i=new aU.ChaCha20Poly1305(Yt.fromString(t.symKey,Tn)).seal(n,Yt.fromString(t.message,ad));return D8({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function $pe(t,e){let r=M8($0),n=lb.randomBytes(z0),i=Yt.fromString(t,ad);return D8({type:r,sealed:i,iv:n,encoding:e})}function Ype(t){let e=new aU.ChaCha20Poly1305(Yt.fromString(t.symKey,Tn)),{sealed:r,iv:n}=vb({encoded:t.encoded,encoding:t?.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Yt.toString(i,ad)}function Jpe(t,e){let{sealed:r}=vb({encoded:t,encoding:e});return Yt.toString(r,ad)}function D8(t){let{encoding:e=O8}=t;if(hu(t.type)===$0)return Yt.toString(Yt.concat([t.type,t.sealed]),e);if(hu(t.type)===cd){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Yt.toString(Yt.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Yt.toString(Yt.concat([t.type,t.iv,t.sealed]),e)}function vb(t){let{encoded:e,encoding:r=O8}=t,n=Yt.fromString(e,r),i=n.slice(Hpe,eU),s=eU;if(hu(i)===cd){let u=s+R8,f=u+z0,p=n.slice(s,u),S=n.slice(u,f),I=n.slice(f);return{type:i,sealed:I,iv:S,senderPublicKey:p}}if(hu(i)===$0){let u=n.slice(s),f=lb.randomBytes(z0);return{type:i,sealed:u,iv:f}}let o=s+z0,c=n.slice(s,o),a=n.slice(o);return{type:i,sealed:a,iv:c}}function Xpe(t,e){let r=vb({encoded:t,encoding:e?.encoding});return Tk({type:hu(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Yt.toString(r.senderPublicKey,Tn):void 0,receiverPublicKey:e?.receiverPublicKey})}function Tk(t){let e=t?.type||P8;if(e===cd){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Zpe(t){return t.type===cd&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function ege(t){return t.type===$0}function Ik(t){return new ade.ec("p256").keyFromPublic({x:b.Buffer.from(t.x,"base64").toString("hex"),y:b.Buffer.from(t.y,"base64").toString("hex")},"hex")}function tge(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function rge(t){return b.Buffer.from(tge(t),"base64")}function nge(t,e){let[r,n,i]=t.split("."),s=rge(i);if(s.length!==64)throw new Error("Invalid signature length");let o=s.slice(0,32).toString("hex"),c=s.slice(32,64).toString("hex"),a=`${r}.${n}`,u=new fb.SHA256().update(b.Buffer.from(a)).digest(),f=Ik(e),p=b.Buffer.from(u).toString("hex");if(!f.verify(p,{r:o,s:c}))throw new Error("Invalid signature");return cde.decodeJWT(t).payload}var Ck="irn";function ige(t){return t?.relay||{protocol:Ck}}function sge(t){let e=ude.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var oge=Object.defineProperty,age=Object.defineProperties,cge=Object.getOwnPropertyDescriptors,tU=Object.getOwnPropertySymbols,uge=Object.prototype.hasOwnProperty,lge=Object.prototype.propertyIsEnumerable,rU=(t,e,r)=>e in t?oge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nU=(t,e)=>{for(var r in e||(e={}))uge.call(e,r)&&rU(t,r,e[r]);if(tU)for(var r of tU(e))lge.call(e,r)&&rU(t,r,e[r]);return t},fge=(t,e)=>age(t,cge(e));function xk(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function dge(t){if(!t.includes("wc:")){let a=y8(t);a!=null&&a.includes("wc:")&&(t=a)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=nb.parse(s),c=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:Nk(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:xk(o),methods:c,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function Nk(t){return t.startsWith("//")?t.substring(2):t}function Ok(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function hge(t){return`${t.protocol}:${t.topic}@${t.version}?`+nb.stringify(nU(fge(nU({symKey:t.symKey},Ok(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function pge(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}var gge=Object.defineProperty,mge=Object.defineProperties,yge=Object.getOwnPropertyDescriptors,iU=Object.getOwnPropertySymbols,vge=Object.prototype.hasOwnProperty,bge=Object.prototype.propertyIsEnumerable,sU=(t,e,r)=>e in t?gge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wge=(t,e)=>{for(var r in e||(e={}))vge.call(e,r)&&sU(t,r,e[r]);if(iU)for(var r of iU(e))bge.call(e,r)&&sU(t,r,e[r]);return t},Age=(t,e)=>mge(t,yge(e));function yu(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function Pk(t){let e=[];return Object.values(t).forEach(r=>{e.push(...yu(r.accounts))}),e}function Rk(t,e){let r=[];return Object.values(t).forEach(n=>{yu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function Mk(t,e){let r=[];return Object.values(t).forEach(n=>{yu(n.accounts).includes(e)&&r.push(...n.events)}),r}function Ege(t,e){let r=zk(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function Sge(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=u8(e),s=u8(r),o={};Object.keys(n).forEach(u=>{let f=n[u].chains,p=n[u].methods,S=n[u].events,I=n[u].accounts;f.forEach(N=>{if(!I.some(R=>R.includes(N)))throw new Error(`No accounts provided for chain ${N} in namespace ${u}`)}),o[u]={chains:f,methods:p,events:S,accounts:I}});let c=Qk(e,o,"approve()");if(c)throw new Error(c.message);let a={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(u=>{let f=n[u].chains.filter(N=>{var R,D;return(D=(R=i[u])==null?void 0:R.chains)==null?void 0:D.includes(N)}),p=n[u].methods.filter(N=>{var R,D;return(D=(R=i[u])==null?void 0:R.methods)==null?void 0:D.includes(N)}),S=n[u].events.filter(N=>{var R,D;return(D=(R=i[u])==null?void 0:R.events)==null?void 0:D.includes(N)}),I=f.map(N=>n[u].accounts.filter(R=>R.includes(`${N}:`))).flat();a[u]={chains:f,methods:p,events:S,accounts:I}}),Object.keys(s).forEach(u=>{var f,p,S,I,N,R;if(!n[u])return;let D=(p=(f=s[u])==null?void 0:f.chains)==null?void 0:p.filter(H=>n[u].chains.includes(H)),U=n[u].methods.filter(H=>{var F,V;return(V=(F=s[u])==null?void 0:F.methods)==null?void 0:V.includes(H)}),k=n[u].events.filter(H=>{var F,V;return(V=(F=s[u])==null?void 0:F.events)==null?void 0:V.includes(H)}),z=D?.map(H=>n[u].accounts.filter(F=>F.includes(`${H}:`))).flat();a[u]={chains:$o((S=a[u])==null?void 0:S.chains,D),methods:$o((I=a[u])==null?void 0:I.methods,U),events:$o((N=a[u])==null?void 0:N.events,k),accounts:$o((R=a[u])==null?void 0:R.accounts,z)}}),a)}function B8(t){return t.includes(":")}function Dk(t){return B8(t)?t.split(":")[0]:t}function u8(t){var e,r,n;let i={};if(!bb(t))return i;for(let[s,o]of Object.entries(t)){let c=B8(s)?[s]:o.chains,a=o.methods||[],u=o.events||[],f=Dk(s);i[f]=Age(wge({},i[f]),{chains:$o(c,(e=i[f])==null?void 0:e.chains),methods:$o(a,(r=i[f])==null?void 0:r.methods),events:$o(u,(n=i[f])==null?void 0:n.events)})}return i}function Bk(t){let e={};return t?.forEach(r=>{let[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function _ge(t,e){e=e.map(n=>n.replace("did:pkh:",""));let r=Bk(e);for(let[n,i]of Object.entries(r))i.methods?i.methods=$o(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}var Lk={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}},Fk={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 Wo(t,e){let{message:r,code:n}=Fk[t];return{message:e?`${r} ${e}`:r,code:n}}function pu(t,e){let{message:r,code:n}=Lk[t];return{message:e?`${r} ${e}`:r,code:n}}function Y0(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function bb(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Wa(t){return typeof t>"u"}function ti(t,e){return e&&Wa(t)?!0:typeof t=="string"&&!!t.trim().length}function wb(t,e){return e&&Wa(t)?!0:typeof t=="number"&&!isNaN(t)}function Tge(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ka(i,n)?(n.forEach(o=>{let{accounts:c,methods:a,events:u}=t.namespaces[o],f=yu(c),p=r[o];(!Ka(hb(o,p),f)||!Ka(p.methods,a)||!Ka(p.events,u))&&(s=!1)}),s):!1}function Q0(t){return ti(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function qk(t){if(ti(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Q0(r)}}return!1}function Ige(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(ti(t,!1)){if(e(t))return!0;let r=y8(t);return e(r)}}catch{}return!1}function Cge(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function xge(t){return t?.topic}function Nge(t,e){let r=null;return ti(t?.publicKey,!1)||(r=Wo("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function l8(t){let e=!0;return Y0(t)?t.length&&(e=t.every(r=>ti(r,!1))):e=!1,e}function Uk(t,e,r){let n=null;return Y0(e)&&e.length?e.forEach(i=>{n||Q0(i)||(n=pu("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Q0(t)||(n=pu("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function kk(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=Uk(i,hb(i,s),`${e} ${r}`);o&&(n=o)}),n}function Vk(t,e){let r=null;return Y0(t)?t.forEach(n=>{r||qk(n)||(r=pu("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=pu("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Hk(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Vk(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function Gk(t,e){let r=null;return l8(t?.methods)?l8(t?.events)||(r=pu("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=pu("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function L8(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Gk(n,`${e}, namespace`);i&&(r=i)}),r}function Oge(t,e,r){let n=null;if(t&&bb(t)){let i=L8(t,e);i&&(n=i);let s=kk(t,e,r);s&&(n=s)}else n=Wo("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function zk(t,e){let r=null;if(t&&bb(t)){let n=L8(t,e);n&&(r=n);let i=Hk(t,e);i&&(r=i)}else r=Wo("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function jk(t){return ti(t.protocol,!0)}function Pge(t,e){let r=!1;return e&&!t?r=!0:t&&Y0(t)&&t.length&&t.forEach(n=>{r=jk(n)}),r}function Rge(t){return typeof t=="number"}function Mge(t){return typeof t<"u"&&typeof t!==null}function Dge(t){return!(!t||typeof t!="object"||!t.code||!wb(t.code,!1)||!t.message||!ti(t.message,!1))}function Bge(t){return!(Wa(t)||!ti(t.method,!1))}function Lge(t){return!(Wa(t)||Wa(t.result)&&Wa(t.error)||!wb(t.id,!1)||!ti(t.jsonrpc,!1))}function Fge(t){return!(Wa(t)||!ti(t.name,!1))}function qge(t,e){return!(!Q0(e)||!Pk(t).includes(e))}function Uge(t,e,r){return ti(r,!1)?Rk(t,e).includes(r):!1}function kge(t,e,r){return ti(r,!1)?Mk(t,e).includes(r):!1}function Qk(t,e,r){let n=null,i=Vge(t),s=Hge(e),o=Object.keys(i),c=Object.keys(s),a=oU(Object.keys(t)),u=oU(Object.keys(e)),f=a.filter(p=>!u.includes(p));return f.length&&(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Vo(o,u)||(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),Ka(o,c)||(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${u.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let w=tu(e[d].accounts);w.includes(d)||(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} - Required: ${d} - Approved: ${w.toString()}`))}),o.forEach(d=>{n||(Vo(i[d].methods,s[d].methods)?Vo(i[d].events,s[d].events)||(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Cse(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function YM(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Nse(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:tu(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function xse(t,e){return fy(t,!1)&&t<=e.max&&t>=e.min}function Ose(){let t=Za();return new Promise(e=>{switch(t){case zr.browser:e(L5());break;case zr.reactNative:e(F5());break;case zr.node:e(U5());break;default:e(!0)}})}function L5(){return Vh()&&navigator?.onLine}async function F5(){return ul()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function U5(){return!0}function Dse(t){switch(Za()){case zr.browser:q5(t);break;case zr.reactNative:V5(t);break;case zr.node:break}}function q5(t){!ul()&&Vh()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function V5(t){ul()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var T_={},F_=class{static get(e){return T_[e]}static set(e,r){T_[e]=r}static delete(e){delete T_[e]}};K.BASE10=tT,K.BASE16=Qr,K.BASE64=ry,K.COLON=pte,K.DEFAULT_DEPTH=k_,K.EMPTY_SPACE=Ym,K.ENV_MAP=zr,K.INTERNAL_ERRORS=T5,K.MemoryStore=F_,K.ONE_THOUSAND=mte,K.REACT_NATIVE_PRODUCT=a4,K.RELAYER_DEFAULT_PROTOCOL=m5,K.SDK_ERRORS=_5,K.SDK_TYPE=c4,K.SLASH=u4,K.TYPE_0=rT,K.TYPE_1=dl,K.UTF8=cy,K.addResourceToRecap=l5,K.appendToQueryString=l4,K.assertType=bte,K.assignAbilityToActions=X_,K.base64Decode=u5,K.base64Encode=a5,K.buildApprovedNamespaces=cse,K.buildAuthObject=Cie,K.buildNamespacesFromAuth=lse,K.buildRecapStatement=h5,K.calcExpiry=Bte,K.capitalize=Nte,K.capitalizeWord=m4,K.createDelayedPromise=xte,K.createEncodedRecap=Die,K.createExpiringPromise=Ote,K.createRecap=c5,K.decodeRecap=Ho,K.decodeTypeByte=Hh,K.decrypt=Hie,K.deriveSymKey=Uie,K.deserialize=iT,K.encodeRecap=ay,K.encodeTypeByte=d5,K.encrypt=kie,K.engineEvent=Lte,K.enumify=Cte,K.formatAccountId=n4,K.formatAccountWithChain=ate,K.formatChainId=r4,K.formatExpirerTarget=G_,K.formatIdTarget=Pte,K.formatMessage=n5,K.formatMessageContext=Ste,K.formatRelayParams=v5,K.formatRelayRpcUrl=Ate,K.formatStatementFromRecap=eT,K.formatTopicTarget=Dte,K.formatUA=d4,K.formatUri=ese,K.generateKeyPair=Lie,K.generateRandomBytes32=Fie,K.getAccountsChains=tu,K.getAccountsFromNamespaces=cte,K.getAddressFromAccount=i4,K.getAddressesFromAccounts=ute,K.getAppMetadata=wte,K.getBrowserOnlineStatus=L5,K.getBundleId=yte,K.getChainFromAccount=s4,K.getChainsFromAccounts=o4,K.getChainsFromNamespace=iy,K.getChainsFromNamespaces=lte,K.getChainsFromRecap=Bie,K.getChainsFromRequiredNamespaces=fte,K.getCommonValuesInArrays=C_,K.getDecodedRecapFromResources=i5,K.getDeepLink=Ute,K.getDidAddress=J_,K.getDidAddressSegments=oy,K.getDidChainId=Y_,K.getEnvironment=Za,K.getHttpUrl=Ete,K.getInternalError=$s,K.getJavascriptID=h4,K.getJavascriptOS=f4,K.getLastItems=p4,K.getMethodsFromRecap=Rie,K.getNamespacedDidChainId=_ie,K.getNamespacesChains=A5,K.getNamespacesEventsForChainId=b5,K.getNamespacesFromAccounts=I5,K.getNamespacesMethodsForChainId=E5,K.getNodeOnlineStatus=U5,K.getReCapActions=o5,K.getReactNativeOnlineStatus=F5,K.getRecapAbilitiesFromResource=Oie,K.getRecapFromResources=uy,K.getRecapResource=s5,K.getRelayClientMetadata=vte,K.getRelayProtocolApi=Qie,K.getRelayProtocolName=zie,K.getRequiredNamespacesFromNamespaces=use,K.getSdkError=Xa,K.getUniqueValues=V_,K.handleDeeplinkRedirect=Fte,K.hasOverlap=Vo,K.hashKey=qie,K.hashMessage=Vie,K.isBrowser=Vh,K.isCaipNamespace=sT,K.isConformingNamespaces=M5,K.isExpired=Mte,K.isNode=H_,K.isOnline=Ose,K.isProposalStruct=dse,K.isReactNative=ul,K.isRecap=Z_,K.isSessionCompatible=fse,K.isSessionStruct=gse,K.isTypeOneEnvelope=jie,K.isUndefined=ko,K.isValidAccountId=C5,K.isValidAccounts=O5,K.isValidActions=P5,K.isValidArray=Gh,K.isValidChainId=qh,K.isValidChains=N5,K.isValidController=pse,K.isValidEip1271Signature=t5,K.isValidEip191Signature=e5,K.isValidErrorReason=Ase,K.isValidEvent=Sse,K.isValidId=wse,K.isValidNamespaceAccounts=D5,K.isValidNamespaceActions=oT,K.isValidNamespaceChains=x5,K.isValidNamespaceMethodsOrEvents=L_,K.isValidNamespaces=R5,K.isValidNamespacesChainId=Ise,K.isValidNamespacesEvent=Tse,K.isValidNamespacesRequest=_se,K.isValidNumber=fy,K.isValidObject=ly,K.isValidParams=vse,K.isValidRecap=ps,K.isValidRelay=B5,K.isValidRelays=yse,K.isValidRequest=Ese,K.isValidRequestExpiry=xse,K.isValidRequiredNamespaces=mse,K.isValidResponse=bse,K.isValidString=yn,K.isValidUrl=hse,K.mapEntries=Tte,K.mapToObj=Ite,K.mergeArrays=Ys,K.mergeEncodedRecaps=Pie,K.mergeRecaps=f5,K.normalizeNamespaces=M_,K.objToMap=_te,K.parseAccountId=q_,K.parseChainId=t4,K.parseContextNames=g4,K.parseExpirerTarget=Rte,K.parseNamespaceKey=S5,K.parseRelayParams=y5,K.parseTopic=w5,K.parseUri=Zie,K.populateAuthPayload=Nie,K.recapHasResource=xie,K.serialize=g5,K.subscribeToBrowserNetworkChange=q5,K.subscribeToNetworkChange=Dse,K.subscribeToReactNativeNetworkChange=V5,K.validateDecoding=Gie,K.validateEncoding=p5,K.validateSignedCacao=Tie,K.verifySignature=Z4});var k5,H5,G5,j5,hy,zh,aT,dy,Go,Qh,gy=de(()=>{h();k5="PARSE_ERROR",H5="INVALID_REQUEST",G5="METHOD_NOT_FOUND",j5="INVALID_PARAMS",hy="INTERNAL_ERROR",zh="SERVER_ERROR",aT=[-32700,-32600,-32601,-32602,-32603],dy=[-32e3,-32099],Go={[k5]:{code:-32700,message:"Parse error"},[H5]:{code:-32600,message:"Invalid Request"},[G5]:{code:-32601,message:"Method not found"},[j5]:{code:-32602,message:"Invalid params"},[hy]:{code:-32603,message:"Internal error"},[zh]:{code:-32e3,message:"Server error"}},Qh=zh});function Pse(t){return t<=dy[0]&&t>=dy[1]}function py(t){return aT.includes(t)}function z5(t){return typeof t=="number"}function my(t){return Object.keys(Go).includes(t)?Go[t]:Go[Qh]}function yy(t){let e=Object.values(Go).find(r=>r.code===t);return e||Go[Qh]}function Rse(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!z5(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(py(t.error.code)){let e=yy(t.error.code);if(e.message!==Go[Qh].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function uT(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var cT=de(()=>{h();gy()});var K5=D(jo=>{"use strict";h();Object.defineProperty(jo,"__esModule",{value:!0});jo.isBrowserCryptoAvailable=jo.getSubtleCrypto=jo.getBrowerCrypto=void 0;function lT(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}jo.getBrowerCrypto=lT;function Q5(){let t=lT();return t.subtle||t.webkitSubtle}jo.getSubtleCrypto=Q5;function Bse(){return!!lT()&&!!Q5()}jo.isBrowserCryptoAvailable=Bse});var Y5=D(zo=>{"use strict";h();Object.defineProperty(zo,"__esModule",{value:!0});zo.isBrowser=zo.isNode=zo.isReactNative=void 0;function W5(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zo.isReactNative=W5;function $5(){return typeof S.default<"u"&&typeof S.default.versions<"u"&&typeof S.default.versions.node<"u"}zo.isNode=$5;function Mse(){return!W5()&&!$5()}zo.isBrowser=Mse});var fT=D(wy=>{"use strict";h();Object.defineProperty(wy,"__esModule",{value:!0});var J5=(Oc(),xe(xc));J5.__exportStar(K5(),wy);J5.__exportStar(Y5(),wy)});var br={};Ot(br,{isNodeJs:()=>Z5});var X5,Z5,eL=de(()=>{h();X5=ge(fT());Tr(br,ge(fT()));Z5=X5.isNode});function hT(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function dT(t=6){return BigInt(hT(t))}function gT(t,e,r){return{id:r||hT(),jsonrpc:"2.0",method:t,params:e}}function Lse(t,e){return{id:t,jsonrpc:"2.0",result:e}}function pT(t,e,r){return{id:t,jsonrpc:"2.0",error:tL(e,r)}}function tL(t,e){return typeof t>"u"?my(hy):(typeof t=="string"&&(t=Object.assign(Object.assign({},my(zh)),{message:t})),typeof e<"u"&&(t.data=e),py(t.code)&&(t=yy(t.code)),t)}var rL=de(()=>{h();cT();gy()});function Fse(t){return t.includes("*")?Ay(t):!/\W/g.test(t)}function vy(t){return t==="*"}function Ay(t){return vy(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function Use(t){return!vy(t)&&Ay(t)&&!t.split("*")[0].trim()}function qse(t){return!vy(t)&&Ay(t)&&!t.split("*")[1].trim()}var nL=de(()=>{h()});var Kh,mT,Ey,Wh,iL=de(()=>{h();Kh=class{},mT=class extends Kh{constructor(e){super()}},Ey=class extends Kh{constructor(){super()}},Wh=class extends Ey{constructor(e){super()}}});var sL=de(()=>{h();iL()});function Hse(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function oL(t,e){let r=Hse(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Gse(t){return oL(t,Vse)}function by(t){return oL(t,kse)}function yT(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var Vse,kse,aL=de(()=>{h();Vse="^https?:",kse="^wss?:"});function wT(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function jse(t){return wT(t)&&"method"in t}function vT(t){return wT(t)&&(uL(t)||Sy(t))}function uL(t){return"result"in t}function Sy(t){return"error"in t}function zse(t){return"error"in t&&t.valid===!1}var cL=de(()=>{h()});var Ur={};Ot(Ur,{DEFAULT_ERROR:()=>Qh,IBaseJsonRpcProvider:()=>Ey,IEvents:()=>Kh,IJsonRpcConnection:()=>mT,IJsonRpcProvider:()=>Wh,INTERNAL_ERROR:()=>hy,INVALID_PARAMS:()=>j5,INVALID_REQUEST:()=>H5,METHOD_NOT_FOUND:()=>G5,PARSE_ERROR:()=>k5,RESERVED_ERROR_CODES:()=>aT,SERVER_ERROR:()=>zh,SERVER_ERROR_CODE_RANGE:()=>dy,STANDARD_ERROR_MAP:()=>Go,formatErrorMessage:()=>tL,formatJsonRpcError:()=>pT,formatJsonRpcRequest:()=>gT,formatJsonRpcResult:()=>Lse,getBigIntRpcId:()=>dT,getError:()=>my,getErrorByCode:()=>yy,isHttpUrl:()=>Gse,isJsonRpcError:()=>Sy,isJsonRpcPayload:()=>wT,isJsonRpcRequest:()=>jse,isJsonRpcResponse:()=>vT,isJsonRpcResult:()=>uL,isJsonRpcValidationInvalid:()=>zse,isLocalhostUrl:()=>yT,isNodeJs:()=>Z5,isReservedErrorCode:()=>py,isServerErrorCode:()=>Pse,isValidDefaultRoute:()=>vy,isValidErrorCode:()=>z5,isValidLeadingWildcardRoute:()=>Use,isValidRoute:()=>Fse,isValidTrailingWildcardRoute:()=>qse,isValidWildcardRoute:()=>Ay,isWsUrl:()=>by,parseConnectionError:()=>uT,payloadId:()=>hT,validateJsonRpcError:()=>Rse});var $h=de(()=>{h();gy();cT();eL();Tr(Ur,br);rL();nL();sL();aL();cL()});var fL={};Ot(fL,{JsonRpcProvider:()=>AT,default:()=>AT});var lL,AT,hL=de(()=>{h();lL=ge(Os());$h();AT=class extends Wh{constructor(e){super(e),this.events=new lL.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(gT(e.method,e.params||[],e.id||dT().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Sy(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),vT(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}});var gL=D((HIe,dL)=>{"use strict";h();dL.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var wL={};Ot(wL,{WsConnection:()=>ET,default:()=>ET});var yL,Qse,Kse,pL,mL,Wse,ET,vL=de(()=>{h();yL=ge(Os());Nc();$h();Qse=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:gL(),Kse=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",pL=t=>t.split("?")[0],mL=10,Wse=Qse(),ET=class{constructor(e){if(this.url=e,this.events=new yL.EventEmitter,this.registering=!1,!by(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Si(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!by(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=new URLSearchParams(e).get("origin"),s=(0,Ur.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!yT(e)},o=new Wse(e,[],s);Kse()?o.onerror=u=>{let a=u;n(this.emitError(a.error))}:o.on("error",u=>{n(this.emitError(u))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Po(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=pT(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return uT(e,pL(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>mL&&this.events.setMaxListeners(mL)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${pL(this.url)}`));return this.events.emit("register_error",r),r}}});var eF=D((Yh,pl)=>{h();var $se=200,PT="__lodash_hash_undefined__",Dy=1,DL=2,PL=9007199254740991,Iy="[object Arguments]",_T="[object Array]",Yse="[object AsyncFunction]",RL="[object Boolean]",BL="[object Date]",ML="[object Error]",LL="[object Function]",Jse="[object GeneratorFunction]",_y="[object Map]",FL="[object Number]",Xse="[object Null]",gl="[object Object]",AL="[object Promise]",Zse="[object Proxy]",UL="[object RegExp]",Ty="[object Set]",qL="[object String]",eoe="[object Symbol]",toe="[object Undefined]",TT="[object WeakMap]",VL="[object ArrayBuffer]",Cy="[object DataView]",roe="[object Float32Array]",noe="[object Float64Array]",ioe="[object Int8Array]",soe="[object Int16Array]",ooe="[object Int32Array]",aoe="[object Uint8Array]",uoe="[object Uint8ClampedArray]",coe="[object Uint16Array]",loe="[object Uint32Array]",foe=/[\\^$.*+?()[\]{}|]/g,hoe=/^\[object .+?Constructor\]$/,doe=/^(?:0|[1-9]\d*)$/,Mt={};Mt[roe]=Mt[noe]=Mt[ioe]=Mt[soe]=Mt[ooe]=Mt[aoe]=Mt[uoe]=Mt[coe]=Mt[loe]=!0;Mt[Iy]=Mt[_T]=Mt[VL]=Mt[RL]=Mt[Cy]=Mt[BL]=Mt[ML]=Mt[LL]=Mt[_y]=Mt[FL]=Mt[gl]=Mt[UL]=Mt[Ty]=Mt[qL]=Mt[TT]=!1;var kL=typeof global=="object"&&global&&global.Object===Object&&global,goe=typeof self=="object"&&self&&self.Object===Object&&self,Js=kL||goe||Function("return this")(),HL=typeof Yh=="object"&&Yh&&!Yh.nodeType&&Yh,EL=HL&&typeof pl=="object"&&pl&&!pl.nodeType&&pl,GL=EL&&EL.exports===HL,bT=GL&&kL.process,bL=function(){try{return bT&&bT.binding&&bT.binding("util")}catch{}}(),SL=bL&&bL.isTypedArray;function poe(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function zoe(t,e){var r=this.__data__,n=Ry(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Xs.prototype.clear=koe;Xs.prototype.delete=Hoe;Xs.prototype.get=Goe;Xs.prototype.has=joe;Xs.prototype.set=zoe;function iu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++eu))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,d=!0,w=r&DL?new xy:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=PL}function XL(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Zh(t){return t!=null&&typeof t=="object"}var ZL=SL?voe(SL):uae;function bae(t){return Aae(t)?iae(t):cae(t)}function Sae(){return[]}function Iae(){return!1}pl.exports=Eae});var RT=D((WIe,tF)=>{h();tF.exports=function(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],o=[],u={},a=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:a,headers:{keys:function(){return s},entries:function(){return o},get:function(f){return u[f.toLowerCase()]},has:function(f){return f.toLowerCase()in u}}}};for(var c in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(f,d,w){s.push(d=d.toLowerCase()),o.push([d,w]),u[d]=u[d]?u[d]+","+w:w}),r(a())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(c,e.headers[c]);i.send(e.body||null)})}});var nF=D((YIe,rF)=>{h();rF.exports=self.fetch||(self.fetch=RT().default||RT())});var cU=D(he=>{"use strict";h();Object.defineProperty(he,"__esModule",{value:!0});var ou=Os(),_ae=(s8(),xe(i8)),nd=(S8(),xe(b8)),wt=(xS(),xe(NS)),ws=WS(),iF=(Nc(),xe(r8)),Tae=(lB(),xe(cB)),ne=jh(),Cae=(n_(),xe(r_)),Oe=Bc(),Nae=(hL(),xe(fL)),un=($h(),xe(Ur)),xae=(vL(),xe(wL)),Oae=eF(),Dae=nF();function id(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function Pae(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var Rae=id(ou),Bae=id(_ae),My=Pae(Tae),Mae=id(xae),Lae=id(Oae),Fae=id(Dae);function Uae(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(Q);V!==U;){for(var k=_[V],H=0,q=Q-1;(k!==0||H>>0,L[q]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");P=H,V++}for(var v=Q-P;v!==Q&&L[v]===0;)v++;for(var C=a.repeat(N);v>>0,Q=new Uint8Array(U);_[N];){var L=r[_.charCodeAt(N)];if(L===255)return;for(var k=0,H=U-1;(L!==0||k>>0,Q[H]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");V=k,N++}if(_[N]!==" "){for(var q=U-V;q!==U&&Q[q]===0;)q++;for(var v=new Uint8Array(P+(U-q)),C=P;q!==U;)v[C++]=Q[q++];return v}}}function A(_){var N=w(_);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:w,decode:A}}var qae=Uae,Vae=qae,EF=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},kae=t=>new TextEncoder().encode(t),Hae=t=>new TextDecoder().decode(t),LT=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},FT=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return bF(this,e)}},UT=class{constructor(e){this.decoders=e}or(e){return bF(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},bF=(t,e)=>new UT({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),qT=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new LT(e,r,n),this.decoder=new FT(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Yy=({name:t,prefix:e,encode:r,decode:n})=>new qT(t,e,r,n),sd=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Vae(r,e);return Yy({prefix:t,name:e,encode:n,decode:s=>EF(i(s))})},Gae=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(u-=8,o[c++]=255&a>>u)}if(u>=r||255&a<<8-u)throw new SyntaxError("Unexpected end of data");return o},jae=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&u>>o];if(o&&(s+=e[i&u<Yy({prefix:e,name:t,encode(i){return jae(i,n,r)},decode(i){return Gae(i,n,r,t)}}),zae=Yy({prefix:"\0",name:"identity",encode:t=>Hae(t),decode:t=>kae(t)}),Qae=Object.freeze({__proto__:null,identity:zae}),Kae=xr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Wae=Object.freeze({__proto__:null,base2:Kae}),$ae=xr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Yae=Object.freeze({__proto__:null,base8:$ae}),Jae=sd({prefix:"9",name:"base10",alphabet:"0123456789"}),Xae=Object.freeze({__proto__:null,base10:Jae}),Zae=xr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),eue=xr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),tue=Object.freeze({__proto__:null,base16:Zae,base16upper:eue}),rue=xr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nue=xr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iue=xr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sue=xr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oue=xr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aue=xr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uue=xr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cue=xr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lue=xr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),fue=Object.freeze({__proto__:null,base32:rue,base32upper:nue,base32pad:iue,base32padupper:sue,base32hex:oue,base32hexupper:aue,base32hexpad:uue,base32hexpadupper:cue,base32z:lue}),hue=sd({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),due=sd({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),gue=Object.freeze({__proto__:null,base36:hue,base36upper:due}),pue=sd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mue=sd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yue=Object.freeze({__proto__:null,base58btc:pue,base58flickr:mue}),wue=xr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vue=xr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Aue=xr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Eue=xr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),bue=Object.freeze({__proto__:null,base64:wue,base64pad:vue,base64url:Aue,base64urlpad:Eue}),SF=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}"),Sue=SF.reduce((t,e,r)=>(t[r]=e,t),[]),Iue=SF.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function _ue(t){return t.reduce((e,r)=>(e+=Sue[r],e),"")}function Tue(t){let e=[];for(let r of t){let n=Iue[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Cue=Yy({prefix:"\u{1F680}",name:"base256emoji",encode:_ue,decode:Tue}),Nue=Object.freeze({__proto__:null,base256emoji:Cue}),xue=IF,sF=128,Oue=127,Due=~Oue,Pue=Math.pow(2,31);function IF(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Pue;)e[r++]=t&255|sF,t/=128;for(;t&Due;)e[r++]=t&255|sF,t>>>=7;return e[r]=t|0,IF.bytes=r-n+1,e}var Rue=VT,Bue=128,oF=127;function VT(t,n){var r=0,n=n||0,i=0,s=n,o,u=t.length;do{if(s>=u)throw VT.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&oF)<=Bue);return VT.bytes=s-n,r}var Mue=Math.pow(2,7),Lue=Math.pow(2,14),Fue=Math.pow(2,21),Uue=Math.pow(2,28),que=Math.pow(2,35),Vue=Math.pow(2,42),kue=Math.pow(2,49),Hue=Math.pow(2,56),Gue=Math.pow(2,63),jue=function(t){return t(_F.encode(t,e,r),e),uF=t=>_F.encodingLength(t),kT=(t,e)=>{let r=e.byteLength,n=uF(t),i=n+uF(r),s=new Uint8Array(i+r);return aF(t,s,0),aF(r,s,n),s.set(e,i),new HT(t,r,e,s)},HT=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},TF=({name:t,code:e,encode:r})=>new GT(t,e,r),GT=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?kT(this.code,r):r.then(n=>kT(this.code,n))}else throw Error("Unknown type, must be binary type")}},CF=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Que=TF({name:"sha2-256",code:18,encode:CF("SHA-256")}),Kue=TF({name:"sha2-512",code:19,encode:CF("SHA-512")}),Wue=Object.freeze({__proto__:null,sha256:Que,sha512:Kue}),NF=0,$ue="identity",xF=EF,Yue=t=>kT(NF,xF(t)),Jue={code:NF,name:$ue,encode:xF,digest:Yue},Xue=Object.freeze({__proto__:null,identity:Jue});new TextEncoder,new TextDecoder;var cF={...Qae,...Wae,...Yae,...Xae,...tue,...fue,...gue,...yue,...bue,...Nue};({...Wue,...Xue});function Zue(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function OF(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var lF=OF("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),BT=OF("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Zue(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=wt.generateChildLogger(r,this.name)}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},qy=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=BF,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=My.generateKeyPair(i);return My.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ne.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=My.generateKeyPair(s),u=ne.generateRandomBytes32(),a=MF;return await My.signJWT(u,i,a,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let u=this.getPrivateKey(i),a=ne.deriveSymKey(u,s);return this.setSymKey(a,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ne.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let u=ne.validateEncoding(o),a=iF.safeJsonStringify(s);if(ne.isTypeOneEnvelope(u)){let w=u.senderPublicKey,A=u.receiverPublicKey;i=await this.generateSharedKey(w,A)}let c=this.getSymKey(i),{type:f,senderPublicKey:d}=u;return ne.encrypt({type:f,symKey:c,message:a,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let u=ne.validateDecoding(s,o);if(ne.isTypeOneEnvelope(u)){let a=u.receiverPublicKey,c=u.senderPublicKey;i=await this.generateSharedKey(a,c)}try{let a=this.getSymKey(i),c=ne.decrypt({symKey:a,encoded:s});return iF.safeJsonParse(c)}catch(a){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(a)}},this.getPayloadType=i=>{let s=ne.deserialize(i);return ne.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ne.deserialize(i);return s.senderPublicKey?Cae.toString(s.senderPublicKey,ne.BASE16):void 0},this.core=e,this.logger=wt.generateChildLogger(r,this.name),this.keychain=n||new Uy(this.core,this.logger)}get context(){return wt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(jT)}catch{e=ne.generateRandomBytes32(),await this.keychain.set(jT,e)}return tce(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Vy=class extends ws.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=UF,this.version=qF,this.initialized=!1,this.storagePrefix=Zs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ne.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ne.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=wt.generateChildLogger(e,this.name),this.core=r}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},QT=class extends ws.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new ou.EventEmitter,this.name=kF,this.queue=new Map,this.publishTimeout=Oe.toMiliseconds(Oe.ONE_MINUTE),this.failedPublishTimeout=Oe.toMiliseconds(Oe.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});let u=s?.ttl||VF,a=ne.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,d=s?.id||un.getBigIntRpcId().toString(),w={topic:n,message:i,opts:{ttl:u,relay:a,prompt:c,tag:f,id:d}},A=`Failed to publish payload, please try again. id:${d} tag:${f}`,_=Date.now(),N,P=1;try{for(;N===void 0;){if(Date.now()-_>this.publishTimeout)throw new Error(A);this.logger.trace({id:d,attempts:P},`publisher.publish - attempt ${P}`),N=await await ne.createExpiringPromise(this.rpcPublish(n,i,u,a,c,f,d).catch(V=>this.logger.warn(V)),this.publishTimeout,A),P++,N||await new Promise(V=>setTimeout(V,this.failedPublishTimeout))}this.relayer.events.emit(vn.publish,w),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:d,topic:n,message:i,opts:s}})}catch(V){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(V),(o=s?.internal)!=null&&o.throwOnFailedPublish)throw V;this.queue.set(d,w)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=wt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return wt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,u){var a,c,f,d;let w={method:ne.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:u};return ne.isUndefined((a=w.params)==null?void 0:a.prompt)&&((c=w.params)==null||delete c.prompt),ne.isUndefined((f=w.params)==null?void 0:f.tag)&&((d=w.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:w}),this.relayer.request(w)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(vn.connection_stalled);return}this.checkQueue()}),this.relayer.on(vn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},KT=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},oce=Object.defineProperty,ace=Object.defineProperties,uce=Object.getOwnPropertyDescriptors,fF=Object.getOwnPropertySymbols,cce=Object.prototype.hasOwnProperty,lce=Object.prototype.propertyIsEnumerable,hF=(t,e,r)=>e in t?oce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,td=(t,e)=>{for(var r in e||(e={}))cce.call(e,r)&&hF(t,r,e[r]);if(fF)for(var r of fF(e))lce.call(e,r)&&hF(t,r,e[r]);return t},MT=(t,e)=>ace(t,uce(e)),ky=class extends ws.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new KT,this.events=new ou.EventEmitter,this.name=JF,this.version=XF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Zs,this.subscribeTimeout=Oe.toMiliseconds(Oe.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ne.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let u=await this.rpcSubscribe(n,s);return typeof u=="string"&&(this.onSubscribe(u,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),u}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;let i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{let u=new Oe.Watch;u.start(i);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),u.stop(i),s(!0)),u.elapsed(i)>=ZF&&(clearInterval(a),u.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=wt.generateChildLogger(r,this.name),this.clientId=""}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ne.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ne.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ne.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ne.createExpiringPromise(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?ne.hashMessage(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(vn.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ne.createExpiringPromise(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(vn.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ne.createExpiringPromise(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(vn.connection_stalled)}return i}rpcUnsubscribe(e,r,n){let i={method:ne.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,MT(td({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,td({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,td({},r)),this.topicMap.set(r.topic,e),this.events.emit(xi.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(xi.deleted,MT(td({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(xi.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ne.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>MT(td({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(xi.created,async e=>{let r=xi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(xi.deleted,async e=>{let r=xi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},fce=Object.defineProperty,dF=Object.getOwnPropertySymbols,hce=Object.prototype.hasOwnProperty,dce=Object.prototype.propertyIsEnumerable,gF=(t,e,r)=>e in t?fce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gce=(t,e)=>{for(var r in e||(e={}))hce.call(e,r)&&gF(t,r,e[r]);if(dF)for(var r of dF(e))dce.call(e,r)&&gF(t,r,e[r]);return t},Hy=class extends ws.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new ou.EventEmitter,this.name=jF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Oe.toMiliseconds(Oe.THIRTY_SECONDS+Oe.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");let s=r.id||un.getBigIntRpcId().toString();await this.toEstablishConnection();try{let o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");let u=await new Promise(async(a,c)=>{let f=()=>{c(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(wn.disconnect,f);let d=await o;this.provider.off(wn.disconnect,f),a(d)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),u}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(ne.isNode())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(vn.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(vn.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(wn.payload,this.onPayloadHandler),this.provider.on(wn.connect,this.onConnectHandler),this.provider.on(wn.disconnect,this.onDisconnectHandler),this.provider.on(wn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?wt.generateChildLogger(e.logger,this.name):wt.pino(wt.getDefaultLoggerOptions({level:e.logger||GF})),this.messages=new Vy(this.logger,e.core),this.subscriber=new ky(this,this.logger),this.publisher=new QT(this,this.logger),this.relayUrl=e?.relayUrl||$T,this.projectId=e.projectId,this.bundleId=ne.getBundleId(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${zT}...`),await this.restartTransport(zT)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},WF)}get context(){return wt.getLoggerContext(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",s,o=u=>{u.topic===e&&(this.subscriber.off(xi.created,o),s())};return await Promise.all([new Promise(u=>{s=u,this.subscriber.on(xi.created,o)}),new Promise(async u=>{i=await this.subscriber.subscribe(e,r)||i,u()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await ne.createExpiringPromise(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{let i=()=>{this.provider.off(wn.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(wn.disconnect,i),await ne.createExpiringPromise(this.provider.connect(),Oe.toMiliseconds(Oe.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);let n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ne.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}let r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(let n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}startPingTimeout(){var e,r,n,i,s;if(ne.isNode())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Nae.JsonRpcProvider(new Mae.default(ne.formatRelayRpcUrl({sdkVersion:KF,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),un.isJsonRpcRequest(e)){if(!e.method.endsWith(zF))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(gce({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else un.isJsonRpcResponse(e)&&this.events.emit(vn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(vn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=un.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(wn.payload,this.onPayloadHandler),this.provider.off(wn.connect,this.onConnectHandler),this.provider.off(wn.disconnect,this.onDisconnectHandler),this.provider.off(wn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await ne.isOnline();ne.subscribeToNetworkChange(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(vn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Oe.toMiliseconds(QF))}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}},pce=Object.defineProperty,pF=Object.getOwnPropertySymbols,mce=Object.prototype.hasOwnProperty,yce=Object.prototype.propertyIsEnumerable,mF=(t,e,r)=>e in t?pce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yF=(t,e)=>{for(var r in e||(e={}))mce.call(e,r)&&mF(t,r,e[r]);if(pF)for(var r of pF(e))yce.call(e,r)&&mF(t,r,e[r]);return t},Gy=class extends ws.IStore{constructor(e,r,n,i=Zs,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=$F,this.cached=[],this.initialized=!1,this.storagePrefix=Zs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ne.isUndefined(o)?this.map.set(this.getKey(o),o):ne.isProposalStruct(o)?this.map.set(o.id,o):ne.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,u)=>{this.isInitialized(),this.map.has(o)?await this.update(o,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:u}),this.map.set(o,u),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(u=>Object.keys(o).every(a=>Lae.default(u[a],o[a]))):this.values),this.update=async(o,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:u});let a=yF(yF({},this.getData(o)),u);this.map.set(o,a),await this.persist()},this.delete=async(o,u)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:u}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=wt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},jy=class{constructor(e,r){this.core=e,this.logger=r,this.name=eU,this.version=tU,this.events=new Rae.default,this.initialized=!1,this.storagePrefix=Zs,this.ignoredPayloadTypes=[ne.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();let i=ne.generateRandomBytes32(),s=await this.core.crypto.setSymKey(i),o=ne.calcExpiry(Oe.FIVE_MINUTES),u={protocol:HF},a={topic:s,expiry:o,relay:u,active:!1},c=ne.formatUri({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:u,expiryTimestamp:o,methods:n?.methods});return this.core.expirer.set(s,o),await this.pairings.set(s,a),await this.core.relayer.subscribe(s),{topic:s,uri:c}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o,expiryTimestamp:u,methods:a}=ne.parseUri(n.uri),c;if(this.pairings.keys.includes(i)&&(c=this.pairings.get(i),c.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);let f=u||ne.calcExpiry(Oe.FIVE_MINUTES),d={topic:i,relay:o,expiry:f,active:!1,methods:a};return this.core.expirer.set(i,f),await this.pairings.set(i,d),n.activatePairing&&await this.activate({topic:i}),this.events.emit(rd.create,d),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),d},this.activate=async({topic:n})=>{this.isInitialized();let i=ne.calcExpiry(Oe.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:u,reject:a}=ne.createDelayedPromise();this.events.once(ne.engineEvent("pairing_ping",s),({error:c})=>{c?a(c):u()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ne.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=un.formatJsonRpcRequest(i,s),u=await this.core.crypto.encode(n,o),a=yl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,u,a),o.id},this.sendResult=async(n,i,s)=>{let o=un.formatJsonRpcResult(n,s),u=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),c=yl[a.request.method].res;await this.core.relayer.publish(i,u,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=un.formatJsonRpcError(n,s),u=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),c=yl[a.request.method]?yl[a.request.method].res:yl.unregistered_method.res;await this.core.relayer.publish(i,u,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ne.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ne.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(rd.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{un.isJsonRpcResult(i)?this.events.emit(ne.engineEvent("pairing_ping",s),{}):un.isJsonRpcError(i)&&this.events.emit(ne.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(rd.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let u=ne.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,u),this.logger.error(u)}catch(u){await this.sendError(s,n,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ne.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!ne.isValidParams(n)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!ne.isValidUrl(n.uri)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}let s=ne.parseUri(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(o)}if(!(s!=null&&s.symKey)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(o)}if(s!=null&&s.expiryTimestamp&&Oe.toMiliseconds(s?.expiryTimestamp){if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ne.isValidString(n,!1)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ne.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ne.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ne.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=wt.generateChildLogger(r,this.name),this.pairings=new Gy(this.core,this.logger,this.name,this.storagePrefix)}get context(){return wt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(vn.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{un.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):un.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(ei.expired,async e=>{let{topic:r}=ne.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(rd.expire,{topic:r}))})}},zy=class extends ws.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new ou.EventEmitter,this.name=rU,this.version=nU,this.cached=[],this.initialized=!1,this.storagePrefix=Zs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ne.calcExpiry(Oe.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Zn.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=un.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Zn.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Zn.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=wt.generateChildLogger(r,this.name)}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:un.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zn.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Zn.created,e=>{let r=Zn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Zn.updated,e=>{let r=Zn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Zn.deleted,e=>{let r=Zn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{Oe.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Zn.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Qy=class extends ws.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new ou.EventEmitter,this.name=iU,this.version=sU,this.cached=[],this.initialized=!1,this.storagePrefix=Zs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(ei.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(ei.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=wt.generateChildLogger(r,this.name)}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ne.formatTopicTarget(e);if(typeof e=="number")return ne.formatIdTarget(e);let{message:r}=ne.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ei.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Oe.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(ei.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(ei.created,e=>{let r=ei.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ei.expired,e=>{let r=ei.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ei.deleted,e=>{let r=ei.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ky=class extends ws.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=Ly,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||ne.isReactNative()||!ne.isBrowser())return;let i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Fy;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=this.getVerifyUrl(n?.verifyUrl),s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,Fy)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(Oe.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{let o=document.getElementById(Ly);if(o)return this.iframe=o,this.onInit(),s();window.addEventListener("message",i);let u=document.createElement("iframe");u.id=Ly,u.src=`${this.verifyUrl}/${this.projectId}`,u.style.display="none",document.body.append(u),this.iframe=u,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},Oe.toMiliseconds(Oe.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||wl;return oU.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${wl}`),i=wl),i},this.logger=wt.generateChildLogger(r,this.name),this.verifyUrl=wl,this.abortController=new AbortController,this.isDevEnv=ne.isNode()&&S.default.env.IS_VITEST}get context(){return wt.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Oe.toMiliseconds(e))}},Wy=class extends ws.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=aU,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:u=!1}=n,a=`${uU}/${this.projectId}/clients`;await Fae.default(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:u})})},this.logger=wt.generateChildLogger(r,this.context)}},wce=Object.defineProperty,wF=Object.getOwnPropertySymbols,vce=Object.prototype.hasOwnProperty,Ace=Object.prototype.propertyIsEnumerable,vF=(t,e,r)=>e in t?wce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AF=(t,e)=>{for(var r in e||(e={}))vce.call(e,r)&&vF(t,r,e[r]);if(wF)for(var r of wF(e))Ace.call(e,r)&&vF(t,r,e[r]);return t},$y=class t extends ws.ICore{constructor(e){var r;super(e),this.protocol=WT,this.version=DF,this.name=Jy,this.events=new ou.EventEmitter,this.initialized=!1,this.on=(o,u)=>this.events.on(o,u),this.once=(o,u)=>this.events.once(o,u),this.off=(o,u)=>this.events.off(o,u),this.removeListener=(o,u)=>this.events.removeListener(o,u),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||$T,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let n=wt.getDefaultLoggerOptions({level:typeof e?.logger=="string"&&e.logger?e.logger:PF.logger}),{logger:i,chunkLoggerController:s}=wt.generatePlatformLogger({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,u;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((u=this.logChunkController)==null||u.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=wt.generateChildLogger(i,this.name),this.heartbeat=new nd.HeartBeat,this.crypto=new qy(this,this.logger,e?.keychain),this.history=new zy(this,this.logger),this.expirer=new Qy(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Bae.default(AF(AF({},RF),e?.storageOptions)),this.relayer=new Hy({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new jy(this,this.logger),this.verify=new Ky(this.projectId||"",this.logger),this.echoClient=new Wy(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(YF,n),r}get context(){return wt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}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}}},Ece=$y;he.CORE_CONTEXT=Jy,he.CORE_DEFAULT=PF,he.CORE_PROTOCOL=WT,he.CORE_STORAGE_OPTIONS=RF,he.CORE_STORAGE_PREFIX=Zs,he.CORE_VERSION=DF,he.CRYPTO_CLIENT_SEED=jT,he.CRYPTO_CONTEXT=BF,he.CRYPTO_JWT_TTL=MF,he.Core=Ece,he.Crypto=qy,he.ECHO_CONTEXT=aU,he.ECHO_URL=uU,he.EXPIRER_CONTEXT=iU,he.EXPIRER_DEFAULT_TTL=sce,he.EXPIRER_EVENTS=ei,he.EXPIRER_STORAGE_VERSION=sU,he.EchoClient=Wy,he.Expirer=Qy,he.HISTORY_CONTEXT=rU,he.HISTORY_EVENTS=Zn,he.HISTORY_STORAGE_VERSION=nU,he.JsonRpcHistory=zy,he.KEYCHAIN_CONTEXT=LF,he.KEYCHAIN_STORAGE_VERSION=FF,he.KeyChain=Uy,he.MESSAGES_CONTEXT=UF,he.MESSAGES_STORAGE_VERSION=qF,he.MessageTracker=Vy,he.PAIRING_CONTEXT=eU,he.PAIRING_DEFAULT_TTL=ice,he.PAIRING_EVENTS=rd,he.PAIRING_RPC_OPTS=yl,he.PAIRING_STORAGE_VERSION=tU,he.PENDING_SUB_RESOLUTION_TIMEOUT=ZF,he.PUBLISHER_CONTEXT=kF,he.PUBLISHER_DEFAULT_TTL=VF,he.Pairing=jy,he.RELAYER_CONTEXT=jF,he.RELAYER_DEFAULT_LOGGER=GF,he.RELAYER_DEFAULT_PROTOCOL=HF,he.RELAYER_DEFAULT_RELAY_URL=$T,he.RELAYER_EVENTS=vn,he.RELAYER_FAILOVER_RELAY_URL=zT,he.RELAYER_PROVIDER_EVENTS=wn,he.RELAYER_RECONNECT_TIMEOUT=QF,he.RELAYER_SDK_VERSION=KF,he.RELAYER_STORAGE_OPTIONS=rce,he.RELAYER_SUBSCRIBER_SUFFIX=zF,he.RELAYER_TRANSPORT_CUTOFF=WF,he.Relayer=Hy,he.STORE_STORAGE_VERSION=$F,he.SUBSCRIBER_CONTEXT=JF,he.SUBSCRIBER_DEFAULT_TTL=nce,he.SUBSCRIBER_EVENTS=xi,he.SUBSCRIBER_STORAGE_VERSION=XF,he.Store=Gy,he.Subscriber=ky,he.TRUSTED_VERIFY_URLS=oU,he.VERIFY_CONTEXT=Ly,he.VERIFY_FALLBACK_SERVER=Fy,he.VERIFY_SERVER=wl,he.Verify=Ky,he.WALLETCONNECT_CLIENT_ID=YF,he.default=$y});var _U=D(Be=>{"use strict";h();Object.defineProperty(Be,"__esModule",{value:!0});var cn=cU(),Xy=(xS(),xe(NS)),hU=WS(),G=jh(),dU=Os(),je=Bc(),qe=($h(),xe(Ur));function bce(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var Sce=bce(dU),i2="wc",s2=2,o2="client",n1=`${i2}@${s2}:${o2}:`,Zy={name:o2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},Ice={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",session_authenticate:"session_authenticate",session_request_expire:"session_request_expire"},_ce={database:":memory:"},YT="WALLETCONNECT_DEEPLINK_CHOICE",Tce={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Cce="history",Nce="0.3",gU="proposal",xce=je.THIRTY_DAYS,pU="Proposal expired",mU="session",uu=je.SEVEN_DAYS,yU="engine",Sr={wc_sessionPropose:{req:{ttl:je.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1104},res:{ttl:je.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1106},res:{ttl:je.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:je.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:je.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1112},res:{ttl:je.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1114},res:{ttl:je.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:je.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:je.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1119}}},e1={min:je.FIVE_MINUTES,max:je.SEVEN_DAYS},Oi={idle:"IDLE",active:"ACTIVE"},wU="request",vU=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],AU="wc",Oce=1.5,EU="auth",bU="authKeys",SU="pairingTopics",IU="requests",ad=`${AU}@${1.5}:${EU}:`,od=`${ad}:PUB_KEY`,Dce=Object.defineProperty,Pce=Object.defineProperties,Rce=Object.getOwnPropertyDescriptors,lU=Object.getOwnPropertySymbols,Bce=Object.prototype.hasOwnProperty,Mce=Object.prototype.propertyIsEnumerable,fU=(t,e,r)=>e in t?Dce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gr=(t,e)=>{for(var r in e||(e={}))Bce.call(e,r)&&fU(t,r,e[r]);if(lU)for(var r of lU(e))Mce.call(e,r)&&fU(t,r,e[r]);return t},au=(t,e)=>Pce(t,Rce(e)),JT=class extends hU.IEngine{constructor(e){super(e),this.name=yU,this.events=new Sce.default,this.initialized=!1,this.requestQueue={state:Oi.idle,queue:[]},this.sessionRequestQueue={state:Oi.idle,queue:[]},this.requestQueueDelay=je.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Sr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},je.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=au(gr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:u,relays:a}=n,c=i,f,d=!1;try{c&&(d=this.client.core.pairing.pairings.get(c).active)}catch(L){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),L}if(!c||!d){let{topic:L,uri:k}=await this.client.core.pairing.create();c=L,f=k}if(!c){let{message:L}=G.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(L)}let w=await this.client.core.crypto.generateKeyPair(),A=Sr.wc_sessionPropose.req.ttl||je.FIVE_MINUTES,_=G.calcExpiry(A),N=gr({requiredNamespaces:s,optionalNamespaces:o,relays:a??[{protocol:cn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:w,metadata:this.client.metadata},expiryTimestamp:_,pairingTopic:c},u&&{sessionProperties:u}),{reject:P,resolve:V,done:U}=G.createDelayedPromise(A,pU);this.events.once(G.engineEvent("session_connect"),async({error:L,session:k})=>{if(L)P(L);else if(k){k.self.publicKey=w;let H=au(gr({},k),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces});await this.client.session.set(k.topic,H),await this.setExpiry(k.topic,k.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:k.peer.metadata}),this.cleanupDuplicatePairings(H),V(H)}});let Q=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(Q,gr({id:Q},N)),{uri:f,approval:U}},this.pair=async r=>{await this.isInitialized();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{await this.isInitialized();try{await this.isValidApprove(r)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),U}let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o,sessionConfig:u}=r,a;try{a=this.client.proposal.get(n)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${n}) failed`),U}let{pairingTopic:c,proposer:f,requiredNamespaces:d,optionalNamespaces:w}=a,A=await this.client.core.crypto.generateKeyPair(),_=f.publicKey,N=await this.client.core.crypto.generateSharedKey(A,_),P=gr(gr({relay:{protocol:i??"irn"},namespaces:s,controller:{publicKey:A,metadata:this.client.metadata},expiry:G.calcExpiry(uu)},o&&{sessionProperties:o}),u&&{sessionConfig:u});await this.client.core.relayer.subscribe(N);let V=au(gr({},P),{topic:N,requiredNamespaces:d,optionalNamespaces:w,pairingTopic:c,acknowledged:!1,self:P.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:A});await this.client.session.set(N,V);try{await this.sendResult({id:n,topic:c,result:{relay:{protocol:i??"irn"},responderPublicKey:A},throwOnFailedPublish:!0}),await this.sendRequest({topic:N,method:"wc_sessionSettle",params:P,throwOnFailedPublish:!0})}catch(U){throw this.client.logger.error(U),this.client.session.delete(N,G.getSdkError("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(N),U}return await this.client.core.pairing.updateMetadata({topic:c,metadata:f.metadata}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:c}),await this.setExpiry(N,G.calcExpiry(uu)),{topic:N,acknowledged:()=>new Promise(U=>setTimeout(()=>U(this.client.session.get(N)),500))}},this.reject=async r=>{await this.isInitialized();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}let{id:n,reason:i}=r,s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Sr.wc_sessionPropose.reject}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized();try{await this.isValidUpdate(r)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}let{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:u}=G.createDelayedPromise(),a=qe.payloadId(),c=qe.getBigIntRpcId().toString(),f=this.client.session.get(n).namespaces;return this.events.once(G.engineEvent("session_update",a),({error:d})=>{d?u(d):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:c}).catch(d=>{this.client.logger.error(d),this.client.session.update(n,{namespaces:f}),u(d)}),{acknowledged:s}},this.extend=async r=>{await this.isInitialized();try{await this.isValidExtend(r)}catch(a){throw this.client.logger.error("extend() -> isValidExtend() failed"),a}let{topic:n}=r,i=qe.payloadId(),{done:s,resolve:o,reject:u}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_extend",i),({error:a})=>{a?u(a):o()}),await this.setExpiry(n,G.calcExpiry(uu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(a=>{u(a)}),{acknowledged:s}},this.request=async r=>{await this.isInitialized();try{await this.isValidRequest(r)}catch(A){throw this.client.logger.error("request() -> isValidRequest() failed"),A}let{chainId:n,request:i,topic:s,expiry:o=Sr.wc_sessionRequest.req.ttl}=r,u=this.client.session.get(s),a=qe.payloadId(),c=qe.getBigIntRpcId().toString(),{done:f,resolve:d,reject:w}=G.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(G.engineEvent("session_request",a),({error:A,result:_})=>{A?w(A):d(_)}),await Promise.all([new Promise(async A=>{await this.sendRequest({clientRpcId:a,relayRpcId:c,topic:s,method:"wc_sessionRequest",params:{request:au(gr({},i),{expiryTimestamp:G.calcExpiry(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(_=>w(_)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),A()}),new Promise(async A=>{var _;if(!((_=u.sessionConfig)!=null&&_.disableDeepLink)){let N=await G.getDeepLink(this.client.core.storage,YT);G.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:N})}A()}),f()]).then(A=>A[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;qe.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):qe.isJsonRpcError(i)&&await this.sendError({id:s,topic:n,error:i.error}),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=qe.payloadId(),s=qe.getBigIntRpcId().toString(),{done:o,resolve:u,reject:a}=G.createDelayedPromise();this.events.once(G.engineEvent("session_ping",i),({error:c})=>{c?a(c):u()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r,o=qe.getBigIntRpcId().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:G.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{let{message:i}=G.getInternalError("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>G.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async r=>{this.isInitialized(),this.isValidAuthenticate(r);let{chains:n,statement:i="",uri:s,domain:o,nonce:u,type:a,exp:c,nbf:f,methods:d=[],expiry:w}=r,A=[...r.resources||[]],{topic:_,uri:N}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:_,uri:N}});let P=await this.client.core.crypto.generateKeyPair(),V=G.hashKey(P);if(await Promise.all([this.client.auth.authKeys.set(od,{responseTopic:V,publicKey:P}),this.client.auth.pairingTopics.set(V,{topic:V,pairingTopic:_})]),await this.client.core.relayer.subscribe(V),this.client.logger.info(`sending request to new pairing topic: ${_}`),d.length>0){let{namespace:l}=G.parseChainId(n[0]),g=G.createEncodedRecap(l,"request",d);G.getRecapFromResources(A)&&(g=G.mergeEncodedRecaps(g,A.pop())),A.push(g)}let U=w&&w>Sr.wc_sessionAuthenticate.req.ttl?w:Sr.wc_sessionAuthenticate.req.ttl,Q={authPayload:{type:a??"caip122",chains:n,statement:i,aud:s,domain:o,version:"1",nonce:u,iat:new Date().toISOString(),exp:c,nbf:f,resources:A},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:G.calcExpiry(U)},L={eip155:{chains:n,methods:[...new Set(["personal_sign",...d])],events:["chainChanged","accountsChanged"]}},k={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:_,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:G.calcExpiry(Sr.wc_sessionPropose.req.ttl)},{done:H,resolve:q,reject:v}=G.createDelayedPromise(U,"Request expired"),C=async({error:l,session:g})=>{if(this.events.off(G.engineEvent("session_request",F),R),l)v(l);else if(g){g.self.publicKey=P,await this.client.session.set(g.topic,g),await this.setExpiry(g.topic,g.expiry),_&&await this.client.core.pairing.updateMetadata({topic:_,metadata:g.peer.metadata});let y=this.client.session.get(g.topic);await this.deleteProposal(B),q({session:y})}},R=async l=>{if(await this.deletePendingAuthRequest(F,{message:"fulfilled",code:0}),l.error){let x=G.getSdkError("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return l.error.code===x.code?void 0:(this.events.off(G.engineEvent("session_connect"),C),v(l.error.message))}await this.deleteProposal(B),this.events.off(G.engineEvent("session_connect"),C);let{cacaos:g,responder:y}=l.result,E=[],I=[];for(let x of g){await G.validateSignedCacao({cacao:x,projectId:this.client.core.projectId})||(this.client.logger.error(x,"Signature verification failed"),v(G.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:m}=x,O=G.getRecapFromResources(m.resources),Y=[G.getNamespacedDidChainId(m.iss)],$=G.getDidAddress(m.iss);if(O){let b=G.getMethodsFromRecap(O),j=G.getChainsFromRecap(O);E.push(...b),Y.push(...j)}for(let b of Y)I.push(`${b}:${$}`)}let T=await this.client.core.crypto.generateSharedKey(P,y.publicKey),M;E.length>0&&(M={topic:T,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:y,controller:y.publicKey,expiry:G.calcExpiry(uu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:_,namespaces:G.buildNamespacesFromAuth([...new Set(E)],[...new Set(I)])},await this.client.core.relayer.subscribe(T),await this.client.session.set(T,M),M=this.client.session.get(T)),q({auths:g,session:M})},F=qe.payloadId(),B=qe.payloadId();this.events.once(G.engineEvent("session_connect"),C),this.events.once(G.engineEvent("session_request",F),R);try{await Promise.all([this.sendRequest({topic:_,method:"wc_sessionAuthenticate",params:Q,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:F}),this.sendRequest({topic:_,method:"wc_sessionPropose",params:k,expiry:Sr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:B})])}catch(l){throw this.events.off(G.engineEvent("session_connect"),C),this.events.off(G.engineEvent("session_request",F),R),l}return await this.setProposal(B,gr({id:B},k)),await this.setAuthRequest(F,{request:au(gr({},Q),{verifyContext:{}}),pairingTopic:_}),{uri:N,response:H}},this.approveSessionAuthenticate=async r=>{this.isInitialized();let{id:n,auths:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);let o=s.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),a=G.hashKey(o),c={type:G.TYPE_1,receiverPublicKey:o,senderPublicKey:u},f=[],d=[];for(let _ of i){if(!await G.validateSignedCacao({cacao:_,projectId:this.client.core.projectId})){let Q=G.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:a,error:Q,encodeOpts:c}),new Error(Q.message)}let{p:N}=_,P=G.getRecapFromResources(N.resources),V=[G.getNamespacedDidChainId(N.iss)],U=G.getDidAddress(N.iss);if(P){let Q=G.getMethodsFromRecap(P),L=G.getChainsFromRecap(P);f.push(...Q),V.push(...L)}for(let Q of V)d.push(`${Q}:${U}`)}let w=await this.client.core.crypto.generateSharedKey(u,o),A;return f?.length>0&&(A={topic:w,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:o,metadata:s.requester.metadata},controller:o,expiry:G.calcExpiry(uu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:G.buildNamespacesFromAuth([...new Set(f)],[...new Set(d)])},await this.client.core.relayer.subscribe(w),await this.client.session.set(w,A)),await this.sendResult({topic:a,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:c,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),{session:A}},this.rejectSessionAuthenticate=async r=>{await this.isInitialized();let{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);let o=s.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),a=G.hashKey(o),c={type:G.TYPE_1,receiverPublicKey:o,senderPublicKey:u};await this.sendError({id:n,topic:a,error:i,encodeOpts:c,rpcOpts:Sr.wc_sessionAuthenticate.reject}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();let{request:n,iss:i}=r;return G.formatMessage(n,i)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,u;return((o=s.peerMetadata)==null?void 0:o.url)&&((u=s.peerMetadata)==null?void 0:u.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;let{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:u=0}=r,{self:a}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,G.getSdkError("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(YT).catch(c=>this.client.logger.warn(c)),this.getPendingSessionRequests().forEach(c=>{c.topic===i&&this.deletePendingSessionRequest(c.id,G.getSdkError("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Oi.idle),o&&this.client.events.emit("session_delete",{id:u,topic:i})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,G.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Oi.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,G.calcExpiry(Sr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{let{request:i,pairingTopic:s}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext})},this.setPendingSessionRequest=async r=>{let{id:n,topic:i,params:s,verifyContext:o}=r,u=s.request.expiryTimestamp||G.calcExpiry(Sr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,u),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:u,clientRpcId:a,throwOnFailedPublish:c}=r,f=qe.formatJsonRpcRequest(i,s,a);if(G.isBrowser()&&vU.includes(i)){let A=G.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:A})}let d;try{d=await this.client.core.crypto.encode(n,f)}catch(A){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),A}let w=Sr[i].req;return o&&(w.ttl=o),u&&(w.id=u),this.client.core.history.set(n,f),c?(w.internal=au(gr({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,w)):this.client.core.relayer.publish(n,d,w).catch(A=>this.client.logger.error(A)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:u}=r,a=qe.formatJsonRpcResult(n,s),c;try{c=await this.client.core.crypto.encode(i,a,u)}catch(w){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),w}let f;try{f=await this.client.core.history.get(i,n)}catch(w){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),w}let d=Sr[f.request.method].res;o?(d.internal=au(gr({},d.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,c,d)):this.client.core.relayer.publish(i,c,d).catch(w=>this.client.logger.error(w)),await this.client.core.history.resolve(a)},this.sendError=async r=>{let{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:u}=r,a=qe.formatJsonRpcError(n,s),c;try{c=await this.client.core.crypto.encode(i,a,o)}catch(w){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),w}let f;try{f=await this.client.core.history.get(i,n)}catch(w){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),w}let d=u||Sr[f.request.method].res;this.client.core.relayer.publish(i,c,d),await this.client.core.history.resolve(a)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;G.isExpired(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{G.isExpired(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Oi.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Oi.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Oi.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:s}))switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=G.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{let{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(gr({},n.params));let o=i.expiryTimestamp||G.calcExpiry(Sr.wc_sessionPropose.req.ttl),u=gr({id:s,pairingTopic:r,expiryTimestamp:o},i);await this.setProposal(s,u);let a=G.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(a,u.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:u,verifyContext:c})}catch(o){await this.sendError({id:s,topic:r,error:o,rpcOpts:Sr.wc_sessionPropose.autoReject}),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(qe.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let u=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});let a=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});let c=await this.client.core.crypto.generateSharedKey(u,a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else if(qe.isJsonRpcError(n)){await this.client.proposal.delete(i,G.getSdkError("USER_DISCONNECTED"));let s=G.engineEvent("session_connect");if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners, 954`);this.events.emit(G.engineEvent("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:u,expiry:a,namespaces:c,sessionProperties:f,sessionConfig:d}=n.params,w=gr(gr({topic:r,relay:o,expiry:a,namespaces:c,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},f&&{sessionProperties:f}),d&&{sessionConfig:d});await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0});let A=G.engineEvent("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(G.engineEvent("session_connect"),{session:w})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;qe.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(G.engineEvent("session_approve",i),{})):qe.isJsonRpcError(n)&&(await this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,u=G.MemoryStore.get(o);if(u&&this.isRequestOutOfSync(u,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:G.getSdkError("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(gr({topic:r},i));try{G.MemoryStore.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(a){throw G.MemoryStore.delete(o),a}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_update",i),{}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,G.calcExpiry(uu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_extend",i),{}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_ping",i),{}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(cn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:G.getSdkError("USER_DISCONNECTED")})])}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{var i;let{id:s,params:o}=n;try{await this.isValidRequest(gr({topic:r},o));let u=G.hashMessage(JSON.stringify(qe.formatJsonRpcRequest("wc_sessionRequest",o,s))),a=this.client.session.get(r),c=await this.getVerifyContext(u,a.peer.metadata),f={id:s,topic:r,params:o,verifyContext:c};await this.setPendingSessionRequest(f),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(f):(this.addSessionRequestToSessionRequestQueue(f),this.processSessionRequestQueue())}catch(u){await this.sendError({id:s,topic:r,error:u}),this.client.logger.error(u)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,u=G.MemoryStore.get(o);if(u&&this.isRequestOutOfSync(u,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(gr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),G.MemoryStore.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{let{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async(r,n)=>{try{let{requester:i,authPayload:s,expiryTimestamp:o}=n.params,u=G.hashMessage(JSON.stringify(n)),a=await this.getVerifyContext(u,this.client.metadata),c={requester:i,pairingTopic:r,id:n.id,authPayload:s,verifyContext:a,expiryTimestamp:o};await this.setAuthRequest(n.id,{request:c,pairingTopic:r}),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id})}catch(i){this.client.logger.error(i);let s=n.params.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),u={type:G.TYPE_1,receiverPublicKey:s,senderPublicKey:o};await this.sendError({id:n.id,topic:r,error:i,encodeOpts:u,rpcOpts:Sr.wc_sessionAuthenticate.autoReject})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Oi.idle,this.processSessionRequestQueue()},je.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{let i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{let o=s.request.id,u=G.engineEvent("session_request",o);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(G.engineEvent("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Oi.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Oi.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,qe.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!G.isValidParams(r)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:u}=r;if(G.isUndefined(n)||await this.isValidPairingTopic(n),!G.isValidRelays(u,!0)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(a)}!G.isUndefined(i)&&G.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!G.isUndefined(s)&&G.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=G.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!G.isValidParams(r))throw new Error(G.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);let u=this.client.proposal.get(n),a=G.isValidNamespaces(i,"approve()");if(a)throw new Error(a.message);let c=G.isConformingNamespaces(u.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!G.isValidString(s,!0)){let{message:f}=G.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!G.isValidParams(r)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!G.isValidErrorReason(i)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!G.isValidParams(r)){let{message:c}=G.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!G.isValidRelay(n)){let{message:c}=G.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let u=G.isValidController(i,"onSessionSettleRequest()");if(u)throw new Error(u.message);let a=G.isValidNamespaces(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);if(G.isExpired(o)){let{message:c}=G.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!G.isValidParams(r)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(a)}let{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=G.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let u=G.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!G.isValidParams(r)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(a)}let{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let{namespaces:u}=this.client.session.get(n);if(!G.isValidNamespacesChainId(u,s)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!G.isValidRequest(i)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!G.isValidNamespacesRequest(u,s,i.method)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(a)}if(o&&!G.isValidRequestExpiry(o,e1)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${e1.min} and ${e1.max}`);throw new Error(a)}},this.isValidRespond=async r=>{var n;if(!G.isValidParams(r)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!G.isValidResponse(s)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!G.isValidParams(r)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(u)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!G.isValidNamespacesChainId(o,s)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(u)}if(!G.isValidEvent(i)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}if(!G.isValidNamespacesEvent(o,s,i.name)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}},this.isValidDisconnect=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{let{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!G.isValidString(i,!1))throw new Error("uri is required parameter");if(!G.isValidString(s,!1))throw new Error("domain is required parameter");if(!G.isValidString(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(a=>G.parseChainId(a).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:u}=G.parseChainId(n[0]);if(u!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||cn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!G.isValidString(i,!1)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{let n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0,s=this.recentlyDeletedLimit/2;for(let o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{let n=this.recentlyDeletedMap.get(r);if(n){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){let{message:e}=G.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(cn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(od)?this.client.auth.authKeys.get(od):{responseTopic:void 0,publicKey:void 0},s=await this.client.core.crypto.decode(r,n,{receiverPublicKey:i});try{qe.isJsonRpcRequest(s)?(this.client.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):qe.isJsonRpcResponse(s)?(await this.client.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.client.core.history.delete(r,s.id)):this.onRelayEventUnknownPayload({topic:r,payload:s})}catch(o){this.client.logger.error(o)}})}registerExpirerEvents(){this.client.core.expirer.on(cn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=G.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,G.getInternalError("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,G.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(cn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(cn.PAIRING_EVENTS.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=G.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:r}=G.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),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(G.isValidString(e,!1)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!G.isValidId(e)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:r}=G.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},XT=class extends cn.Store{constructor(e,r){super(e,r,gU,n1),this.core=e,this.logger=r}},t1=class extends cn.Store{constructor(e,r){super(e,r,mU,n1),this.core=e,this.logger=r}},ZT=class extends cn.Store{constructor(e,r){super(e,r,wU,n1,n=>n.id),this.core=e,this.logger=r}},e2=class extends cn.Store{constructor(e,r){super(e,r,bU,ad,()=>od),this.core=e,this.logger=r}},t2=class extends cn.Store{constructor(e,r){super(e,r,SU,ad),this.core=e,this.logger=r}},r2=class extends cn.Store{constructor(e,r){super(e,r,IU,ad,n=>n.id),this.core=e,this.logger=r}},n2=class{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new e2(this.core,this.logger),this.pairingTopics=new t2(this.core,this.logger),this.requests=new r2(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}},r1=class t extends hU.ISignClient{constructor(e){super(e),this.protocol=i2,this.version=s2,this.name=Zy.name,this.events=new dU.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async n=>{try{return await this.engine.authenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||Zy.name,this.metadata=e?.metadata||G.getAppMetadata(),this.signConfig=e?.signConfig;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xy.pino(Xy.getDefaultLoggerOptions({level:e?.logger||Zy.logger}));this.core=e?.core||new cn.Core(e),this.logger=Xy.generateChildLogger(r,this.name),this.session=new t1(this.core,this.logger),this.proposal=new XT(this.core,this.logger),this.pendingRequest=new ZT(this.core,this.logger),this.engine=new JT(this),this.auth=new n2(this.core,this.logger)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Xy.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(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},Lce=t1,Fce=r1;Be.AUTH_CONTEXT=EU,Be.AUTH_KEYS_CONTEXT=bU,Be.AUTH_PAIRING_TOPIC_CONTEXT=SU,Be.AUTH_PROTOCOL=AU,Be.AUTH_PUBLIC_KEY_NAME=od,Be.AUTH_REQUEST_CONTEXT=IU,Be.AUTH_STORAGE_PREFIX=ad,Be.AUTH_VERSION=Oce,Be.ENGINE_CONTEXT=yU,Be.ENGINE_QUEUE_STATES=Oi,Be.ENGINE_RPC_OPTS=Sr,Be.HISTORY_CONTEXT=Cce,Be.HISTORY_EVENTS=Tce,Be.HISTORY_STORAGE_VERSION=Nce,Be.METHODS_TO_VERIFY=vU,Be.PROPOSAL_CONTEXT=gU,Be.PROPOSAL_EXPIRY=xce,Be.PROPOSAL_EXPIRY_MESSAGE=pU,Be.REQUEST_CONTEXT=wU,Be.SESSION_CONTEXT=mU,Be.SESSION_EXPIRY=uu,Be.SESSION_REQUEST_EXPIRY_BOUNDARIES=e1,Be.SIGN_CLIENT_CONTEXT=o2,Be.SIGN_CLIENT_DEFAULT=Zy,Be.SIGN_CLIENT_EVENTS=Ice,Be.SIGN_CLIENT_PROTOCOL=i2,Be.SIGN_CLIENT_STORAGE_OPTIONS=_ce,Be.SIGN_CLIENT_STORAGE_PREFIX=n1,Be.SIGN_CLIENT_VERSION=s2,Be.SessionStore=Lce,Be.SignClient=Fce,Be.WALLETCONNECT_DEEPLINK_CHOICE=YT,Be.default=r1});var i1=D(Wo=>{"use strict";h();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.OptionalOperation=Wo.Operation=void 0;var Uce;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(Uce=Wo.Operation||(Wo.Operation={}));var qce;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(qce=Wo.OptionalOperation||(Wo.OptionalOperation={}))});var a2=D(vs=>{"use strict";h();Object.defineProperty(vs,"__esModule",{value:!0});vs.WALLETCONNECT_SIGN_LOGIN_DELAY=vs.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=vs.WALLETCONNECT_MULTIVERSX_METHODS=vs.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var TU=i1();vs.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";vs.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(TU.Operation);vs.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(TU.OptionalOperation);vs.WALLETCONNECT_SIGN_LOGIN_DELAY=500});var l2=D(Di=>{"use strict";h();Object.defineProperty(Di,"__esModule",{value:!0});Di.WalletConnectV2ProviderErrorMessagesEnum=Di.ErrBadAddress=Di.ErrNotImplemented=Di.Err=void 0;var ud=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Di.Err=ud;var u2=class extends ud{constructor(){super("Method not yet implemented")}};Di.ErrNotImplemented=u2;var c2=class extends ud{constructor(e,r){super(`Bad address: ${e}`,r)}};Di.ErrBadAddress=c2;var Vce;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(Vce=Di.WalletConnectV2ProviderErrorMessagesEnum||(Di.WalletConnectV2ProviderErrorMessagesEnum={}))});var h2=D(s1=>{"use strict";h();Object.defineProperty(s1,"__esModule",{value:!0});s1.Logger=void 0;var f2=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};s1.Logger=f2});var CU=D(()=>{"use strict";h();global.Buffer||(global.Buffer=no().Buffer)});var p2=D(vl=>{"use strict";h();Object.defineProperty(vl,"__esModule",{value:!0});vl.SmartContractQueryResponse=vl.SmartContractQuery=void 0;var d2=class{constructor(e){this.contract=e.contract,this.caller=e.caller,this.value=e.value,this.function=e.function,this.arguments=e.arguments}};vl.SmartContractQuery=d2;var g2=class{constructor(e){this.function=e.function,this.returnCode=e.returnCode,this.returnMessage=e.returnMessage,this.returnDataParts=e.returnDataParts}};vl.SmartContractQueryResponse=g2});var xU=D(o1=>{"use strict";h();Object.defineProperty(o1,"__esModule",{value:!0});o1.QueryRunnerAdapter=void 0;var NU=ke(),kce=p2(),m2=class{constructor(e){this.networkProvider=e.networkProvider}async runQuery(e){let r={address:NU.Address.fromBech32(e.contract),caller:e.caller?NU.Address.fromBech32(e.caller):void 0,func:e.function,value:e.value,getEncodedArguments:()=>e.arguments.map(i=>p.Buffer.from(i).toString("hex"))},n=await this.networkProvider.queryContract(r);return new kce.SmartContractQueryResponse({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.getReturnDataParts()})}};o1.QueryRunnerAdapter=m2});var OU=D(cu=>{"use strict";h();var Hce=cu&&cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gce=cu&&cu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hce(e,t,r)};Object.defineProperty(cu,"__esModule",{value:!0});Gce(xU(),cu)});var DU=D(lu=>{"use strict";h();var jce=lu&&lu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zce=lu&&lu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jce(e,t,r)};Object.defineProperty(lu,"__esModule",{value:!0});zce(ab(),lu)});var RU=D(fu=>{"use strict";h();Object.defineProperty(fu,"__esModule",{value:!0});fu.GasEstimator=fu.DefaultGasConfiguration=void 0;fu.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Qce=1e5,PU=8e5,y2=class{constructor(e){this.gasConfiguration=e||fu.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Qce}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+PU}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+PU)*r+this.gasConfiguration.gasPerDataByte*e}};fu.GasEstimator=y2});var MU=D(BU=>{"use strict";h();Object.defineProperty(BU,"__esModule",{value:!0})});var FU=D(LU=>{"use strict";h();Object.defineProperty(LU,"__esModule",{value:!0})});var UU=D(a1=>{"use strict";h();Object.defineProperty(a1,"__esModule",{value:!0});a1.RelayedTransactionV1Builder=void 0;var w2=ke(),Kce=Ie(),Wce=en(),$ce=Bs(),Yce=mE(),v2=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new Kce.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${p.Buffer.from(e).toString("hex")}`,n=new $ce.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new Wce.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new w2.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new w2.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:BigInt(this.innerTransaction.getValue().toString()),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:p.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new w2.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?p.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?p.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return Yce.stringify(e)}};a1.RelayedTransactionV1Builder=v2});var VU=D(u1=>{"use strict";h();Object.defineProperty(u1,"__esModule",{value:!0});u1.RelayedTransactionV2Builder=void 0;var qU=Ie(),cd=Vn(),Jce=en(),Xce=Bs(),A2=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new qU.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new qU.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new cd.ArgSerializer().valuesToString([new cd.AddressValue(this.innerTransaction.getReceiver()),new cd.U64Value(this.innerTransaction.getNonce().valueOf()),new cd.BytesValue(this.innerTransaction.getData().valueOf()),new cd.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new Xce.TransactionPayload(r),i=new Jce.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID,version:this.innerTransaction.getVersion(),options:this.innerTransaction.getOptions()});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};u1.RelayedTransactionV2Builder=A2});var HU=D(l1=>{"use strict";h();Object.defineProperty(l1,"__esModule",{value:!0});l1.SmartContractQueriesController=void 0;var kU=Ie(),Zce=p2(),c1=Vn(),ele=$t(),E2=class{constructor(e){this.abi=e.abi,this.queryRunner=e.queryRunner,this.legacyResultsParser=new c1.ResultsParser}async query(e){let r=this.createQuery(e),n=await this.runQuery(r);return this.raiseForStatus(n),this.parseQueryResponse(n)}raiseForStatus(e){if(!(e.returnCode==="ok"))throw new kU.ErrSmartContractQuery(e.returnCode,e.returnMessage)}createQuery(e){let r=this.encodeArguments(e.function,e.arguments);return new Zce.SmartContractQuery({contract:e.contract,caller:e.caller,function:e.function,arguments:r,value:e.value})}encodeArguments(e,r){let n=this.abi?.getEndpoint(e);if(n){let i=c1.NativeSerializer.nativeToTypedValues(r,n);return new c1.ArgSerializer().valuesToBuffers(i)}if(this.areArgsOfTypedValue(r))return new c1.ArgSerializer().valuesToBuffers(r);if(this.areArgsBuffers(r))return r.map(i=>p.Buffer.from(i));throw new kU.Err("cannot encode arguments: when ABI is not available, they must be either typed values or buffers")}areArgsOfTypedValue(e){return e.every(r=>ele.isTyped(r))}areArgsBuffers(e){for(let r of e)if(!ArrayBuffer.isView(r))return!1;return!0}async runQuery(e){return await this.queryRunner.runQuery(e)}parseQueryResponse(e){if(!this.abi)return e.returnDataParts;let r={returnCode:e.returnCode,returnMessage:e.returnMessage,getReturnDataParts:()=>e.returnDataParts.map(u=>p.Buffer.from(u))},n=e.function,i=this.abi.getEndpoint(n);return this.legacyResultsParser.parseQueryResponse(r,i).values.map(u=>u.valueOf())}};l1.SmartContractQueriesController=E2});var GU=D(Ve=>{"use strict";h();var tle=Ve&&Ve.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xt=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tle(e,t,r)};Object.defineProperty(Ve,"__esModule",{value:!0});CU();xt(Sc(),Ve);xt(OU(),Ve);xt(ke(),Ve);xt(Wb(),Ve);xt(Wd(),Ve);xt(DU(),Ve);xt(Ie(),Ve);xt(RU(),Ve);xt(MU(),Ve);xt(FU(),Ve);xt(so(),Ve);xt(zb(),Ve);xt(Jl(),Ve);xt(UU(),Ve);xt(VU(),Ve);xt(H0(),Ve);xt(HU(),Ve);xt(Vn(),Ve);xt(Fb(),Ve);xt(Ia(),Ve);xt(en(),Ve);xt(N0(),Ve);xt(Bs(),Ve);xt(V0(),Ve);xt(d0(),Ve);xt(Hb(),Ve);xt(Bn(),Ve)});var $U=D(cr=>{"use strict";h();var rle=cr&&cr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(cr,"__esModule",{value:!0});cr.sleep=cr.getMetadata=cr.applyTransactionSignature=cr.getAddressFromSession=cr.addressIsValid=cr.getConnectionParams=cr.getCurrentTopic=cr.getCurrentSession=void 0;var QU=GU(),jU=Yf(),nle=jh(),f1=a2(),eo=l2(),b2=h2(),zU=i1();function KU(t,e){if(!e)throw new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(WU(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw b2.Logger.error(eo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}cr.getCurrentSession=KU;function ile(t,e){if(!e)throw new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=KU(t,e);if(!r?.topic)throw new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}cr.getCurrentTopic=ile;function WU(t,e){var r,n,i;let s=[...f1.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(zU.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(zU.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${f1.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],u=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[f1.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:u}}}}cr.getConnectionParams=WU;function sle(t){try{return!QU.Address.fromBech32(t).isEmpty()}catch{return!1}}cr.addressIsValid=sle;function ole(t){let e=t.namespaces[f1.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}cr.getAddressFromSession=ole;function ale({transaction:t,response:e}){if(!e)throw b2.Logger.error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,u=t.getGuardian().bech32();if(u&&u!==o)throw b2.Logger.error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(QU.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new jU.Signature(r)),n&&t.applyGuardianSignature(new jU.Signature(n)),t}cr.applyTransactionSignature=ale;function ule(t){if(t)return Object.assign(Object.assign({},t),{url:nle.getAppMetadata().url})}cr.getMetadata=ule;function cle(t){return rle(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}cr.sleep=cle});var ld=D(ln=>{"use strict";h();var rr=ln&&ln.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})},lle=ln&&ln.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ln,"__esModule",{value:!0});ln.WalletConnectV2Provider=ln.OptionalOperation=ln.Operation=ln.WalletConnectV2ProviderErrorMessagesEnum=void 0;var fle=Yf(),hle=lle(_U()),S2=jh(),hu=a2(),fe=l2();Object.defineProperty(ln,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return fe.WalletConnectV2ProviderErrorMessagesEnum}});var Me=h2(),$o=i1();Object.defineProperty(ln,"Operation",{enumerable:!0,get:function(){return $o.Operation}});Object.defineProperty(ln,"OptionalOperation",{enumerable:!0,get:function(){return $o.OptionalOperation}});var Or=$U(),I2=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return rr(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Or.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield hle.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=Or.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},i))}catch{if(e?.topic)try{(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.expirer)===null||n===void 0||n.set(e.topic,0)}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}throw this.reset(),Me.Logger.error(e?.topic?fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return rr(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield Or.sleep(hu.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Or.getAddressFromSession(n),o=n.namespaces[hu.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes($o.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?$o.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:$o.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:u}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!u)throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:u})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Or.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:S2.getSdkError("USER_DISCONNECTED")});else{let r=Or.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:S2.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$o.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new fle.Signature(n))}catch{throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$o.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Or.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$o.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Or.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Or.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return rr(this,void 0,void 0,function*(){return e?Or.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Me.Logger.error(`${fe.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return rr(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Or.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&Or.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return rr(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:u})=>{var a;if(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)return;let{namespaces:c}=u,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>rr(this,void 0,void 0,function*(){var u;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)&&(Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>rr(this,void 0,void 0,function*(){var u;!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o||(Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return rr(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Or.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,u,a,c;return rr(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!S2.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(c=(a=(u=this.walletConnector.core)===null||u===void 0?void 0:u.relayer)===null||a===void 0?void 0:a.subscriber)===null||c===void 0?void 0:c.unsubscribe(d.topic)}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};ln.WalletConnectV2Provider=I2});var JU=D((q_e,YU)=>{"use strict";h();YU.exports=Error});var ZU=D((k_e,XU)=>{"use strict";h();XU.exports=EvalError});var tq=D((G_e,eq)=>{"use strict";h();eq.exports=RangeError});var nq=D((z_e,rq)=>{"use strict";h();rq.exports=ReferenceError});var _2=D((K_e,iq)=>{"use strict";h();iq.exports=SyntaxError});var Al=D(($_e,sq)=>{"use strict";h();sq.exports=TypeError});var aq=D((J_e,oq)=>{"use strict";h();oq.exports=URIError});var cq=D((Z_e,uq)=>{"use strict";h();uq.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var hq=D((tTe,fq)=>{"use strict";h();var lq=typeof Symbol<"u"&&Symbol,dle=cq();fq.exports=function(){return typeof lq!="function"||typeof Symbol!="function"||typeof lq("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:dle()}});var gq=D((nTe,dq)=>{"use strict";h();var T2={__proto__:null,foo:{}},gle=Object;dq.exports=function(){return{__proto__:T2}.foo===T2.foo&&!(T2 instanceof gle)}});var yq=D((sTe,mq)=>{"use strict";h();var ple="Function.prototype.bind called on incompatible ",mle=Object.prototype.toString,yle=Math.max,wle="[object Function]",pq=function(e,r){for(var n=[],i=0;i{"use strict";h();var Ele=yq();wq.exports=Function.prototype.bind||Ele});var Aq=D((cTe,vq)=>{"use strict";h();var ble=Function.prototype.call,Sle=Object.prototype.hasOwnProperty,Ile=h1();vq.exports=Ile.call(ble,Sle)});var pu=D((fTe,_q)=>{"use strict";h();var Re,_le=JU(),Tle=ZU(),Cle=tq(),Nle=nq(),Il=_2(),Sl=Al(),xle=aq(),Iq=Function,C2=function(t){try{return Iq('"use strict"; return ('+t+").constructor;")()}catch{}},du=Object.getOwnPropertyDescriptor;if(du)try{du({},"")}catch{du=null}var N2=function(){throw new Sl},Ole=du?function(){try{return arguments.callee,N2}catch{try{return du(arguments,"callee").get}catch{return N2}}}():N2,El=hq()(),Dle=gq()(),Ir=Object.getPrototypeOf||(Dle?function(t){return t.__proto__}:null),bl={},Ple=typeof Uint8Array>"u"||!Ir?Re:Ir(Uint8Array),gu={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Re:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Re:ArrayBuffer,"%ArrayIteratorPrototype%":El&&Ir?Ir([][Symbol.iterator]()):Re,"%AsyncFromSyncIteratorPrototype%":Re,"%AsyncFunction%":bl,"%AsyncGenerator%":bl,"%AsyncGeneratorFunction%":bl,"%AsyncIteratorPrototype%":bl,"%Atomics%":typeof Atomics>"u"?Re:Atomics,"%BigInt%":typeof BigInt>"u"?Re:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Re:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Re:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Re:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":_le,"%eval%":eval,"%EvalError%":Tle,"%Float32Array%":typeof Float32Array>"u"?Re:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Re:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Re:FinalizationRegistry,"%Function%":Iq,"%GeneratorFunction%":bl,"%Int8Array%":typeof Int8Array>"u"?Re:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Re:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Re:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":El&&Ir?Ir(Ir([][Symbol.iterator]())):Re,"%JSON%":typeof JSON=="object"?JSON:Re,"%Map%":typeof Map>"u"?Re:Map,"%MapIteratorPrototype%":typeof Map>"u"||!El||!Ir?Re:Ir(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Re:Promise,"%Proxy%":typeof Proxy>"u"?Re:Proxy,"%RangeError%":Cle,"%ReferenceError%":Nle,"%Reflect%":typeof Reflect>"u"?Re:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Re:Set,"%SetIteratorPrototype%":typeof Set>"u"||!El||!Ir?Re:Ir(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Re:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":El&&Ir?Ir(""[Symbol.iterator]()):Re,"%Symbol%":El?Symbol:Re,"%SyntaxError%":Il,"%ThrowTypeError%":Ole,"%TypedArray%":Ple,"%TypeError%":Sl,"%Uint8Array%":typeof Uint8Array>"u"?Re:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Re:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Re:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Re:Uint32Array,"%URIError%":xle,"%WeakMap%":typeof WeakMap>"u"?Re:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Re:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Re:WeakSet};if(Ir)try{null.error}catch(t){Eq=Ir(Ir(t)),gu["%Error.prototype%"]=Eq}var Eq,Rle=function t(e){var r;if(e==="%AsyncFunction%")r=C2("async function () {}");else if(e==="%GeneratorFunction%")r=C2("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=C2("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ir&&(r=Ir(i.prototype))}return gu[e]=r,r},bq={__proto__:null,"%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"]},fd=h1(),d1=Aq(),Ble=fd.call(Function.call,Array.prototype.concat),Mle=fd.call(Function.apply,Array.prototype.splice),Sq=fd.call(Function.call,String.prototype.replace),g1=fd.call(Function.call,String.prototype.slice),Lle=fd.call(Function.call,RegExp.prototype.exec),Fle=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ule=/\\(\\)?/g,qle=function(e){var r=g1(e,0,1),n=g1(e,-1);if(r==="%"&&n!=="%")throw new Il("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Il("invalid intrinsic syntax, expected opening `%`");var i=[];return Sq(e,Fle,function(s,o,u,a){i[i.length]=u?Sq(a,Ule,"$1"):o||s}),i},Vle=function(e,r){var n=e,i;if(d1(bq,n)&&(i=bq[n],n="%"+i[0]+"%"),d1(gu,n)){var s=gu[n];if(s===bl&&(s=Rle(n)),typeof s>"u"&&!r)throw new Sl("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Il("intrinsic "+e+" does not exist!")};_q.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Sl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Sl('"allowMissing" argument must be a boolean');if(Lle(/^%?[^%]*%?$/,e)===null)throw new Il("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=qle(e),i=n.length>0?n[0]:"",s=Vle("%"+i+"%",r),o=s.name,u=s.value,a=!1,c=s.alias;c&&(i=c[0],Mle(n,Ble([0,1],c)));for(var f=1,d=!0;f=n.length){var N=du(u,w);d=!!N,d&&"get"in N&&!("originalValue"in N.get)?u=N.get:u=u[w]}else d=d1(u,w),u=u[w];d&&!a&&(gu[o]=u)}}return u}});var m1=D((dTe,Tq)=>{"use strict";h();var kle=pu(),p1=kle("%Object.defineProperty%",!0)||!1;if(p1)try{p1({},"a",{value:1})}catch{p1=!1}Tq.exports=p1});var x2=D((pTe,Cq)=>{"use strict";h();var Hle=pu(),y1=Hle("%Object.getOwnPropertyDescriptor%",!0);if(y1)try{y1([],"length")}catch{y1=null}Cq.exports=y1});var Dq=D((yTe,Oq)=>{"use strict";h();var Nq=m1(),Gle=_2(),_l=Al(),xq=x2();Oq.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new _l("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new _l("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new _l("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new _l("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new _l("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new _l("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,a=!!xq&&xq(e,r);if(Nq)Nq(e,r,{configurable:o===null&&a?a.configurable:!o,enumerable:i===null&&a?a.enumerable:!i,value:n,writable:s===null&&a?a.writable:!s});else if(u||!i&&!s&&!o)e[r]=n;else throw new Gle("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Bq=D((vTe,Rq)=>{"use strict";h();var O2=m1(),Pq=function(){return!!O2};Pq.hasArrayLengthDefineBug=function(){if(!O2)return null;try{return O2([],"length",{value:1}).length!==1}catch{return!0}};Rq.exports=Pq});var qq=D((ETe,Uq)=>{"use strict";h();var jle=pu(),Mq=Dq(),zle=Bq()(),Lq=x2(),Fq=Al(),Qle=jle("%Math.floor%");Uq.exports=function(e,r){if(typeof e!="function")throw new Fq("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Qle(r)!==r)throw new Fq("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Lq){var o=Lq(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(zle?Mq(e,"length",r,!0,!0):Mq(e,"length",r)),e}});var zq=D((STe,w1)=>{"use strict";h();var D2=h1(),v1=pu(),Kle=qq(),Wle=Al(),Hq=v1("%Function.prototype.apply%"),Gq=v1("%Function.prototype.call%"),jq=v1("%Reflect.apply%",!0)||D2.call(Gq,Hq),Vq=m1(),$le=v1("%Math.max%");w1.exports=function(e){if(typeof e!="function")throw new Wle("a function is required");var r=jq(D2,Gq,arguments);return Kle(r,1+$le(0,e.length-(arguments.length-1)),!0)};var kq=function(){return jq(D2,Hq,arguments)};Vq?Vq(w1.exports,"apply",{value:kq}):w1.exports.apply=kq});var $q=D((_Te,Wq)=>{"use strict";h();var Qq=pu(),Kq=zq(),Yle=Kq(Qq("String.prototype.indexOf"));Wq.exports=function(e,r){var n=Qq(e,!!r);return typeof n=="function"&&Yle(e,".prototype.")>-1?Kq(n):n}});var Yq=D(()=>{h()});var m7=D((OTe,p7)=>{h();var k2=typeof Map=="function"&&Map.prototype,P2=Object.getOwnPropertyDescriptor&&k2?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,E1=k2&&P2&&typeof P2.get=="function"?P2.get:null,Jq=k2&&Map.prototype.forEach,H2=typeof Set=="function"&&Set.prototype,R2=Object.getOwnPropertyDescriptor&&H2?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,b1=H2&&R2&&typeof R2.get=="function"?R2.get:null,Xq=H2&&Set.prototype.forEach,Jle=typeof WeakMap=="function"&&WeakMap.prototype,dd=Jle?WeakMap.prototype.has:null,Xle=typeof WeakSet=="function"&&WeakSet.prototype,gd=Xle?WeakSet.prototype.has:null,Zle=typeof WeakRef=="function"&&WeakRef.prototype,Zq=Zle?WeakRef.prototype.deref:null,efe=Boolean.prototype.valueOf,tfe=Object.prototype.toString,rfe=Function.prototype.toString,nfe=String.prototype.match,G2=String.prototype.slice,Jo=String.prototype.replace,ife=String.prototype.toUpperCase,e7=String.prototype.toLowerCase,c7=RegExp.prototype.test,t7=Array.prototype.concat,As=Array.prototype.join,sfe=Array.prototype.slice,r7=Math.floor,L2=typeof BigInt=="function"?BigInt.prototype.valueOf:null,B2=Object.getOwnPropertySymbols,F2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Tl=typeof Symbol=="function"&&typeof Symbol.iterator=="object",qr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Tl||!0)?Symbol.toStringTag:null,l7=Object.prototype.propertyIsEnumerable,n7=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function i7(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||c7.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-r7(-t):r7(t);if(n!==t){var i=String(n),s=G2.call(e,i.length+1);return Jo.call(i,r,"$&_")+"."+Jo.call(Jo.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Jo.call(e,r,"$&_")}var U2=Yq(),s7=U2.custom,o7=h7(s7)?s7:null;p7.exports=function t(e,r,n,i){var s=r||{};if(Yo(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Yo(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=Yo(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(Yo(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(Yo(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=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 g7(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return u?i7(e,a):a}if(typeof e=="bigint"){var c=String(e)+"n";return u?i7(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return q2(e)?"[Array]":"[Object]";var d=Sfe(s,n);if(typeof i>"u")i=[];else if(d7(i,e)>=0)return"[Circular]";function w(l,g,y){if(g&&(i=sfe.call(i),i.push(g)),y){var E={depth:s.depth};return Yo(s,"quoteStyle")&&(E.quoteStyle=s.quoteStyle),t(l,E,n+1,i)}return t(l,s,n+1,i)}if(typeof e=="function"&&!a7(e)){var A=gfe(e),_=A1(e,w);return"[Function"+(A?": "+A:" (anonymous)")+"]"+(_.length>0?" { "+As.call(_,", ")+" }":"")}if(h7(e)){var N=Tl?Jo.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):F2.call(e);return typeof e=="object"&&!Tl?hd(N):N}if(Afe(e)){for(var P="<"+e7.call(String(e.nodeName)),V=e.attributes||[],U=0;U",P}if(q2(e)){if(e.length===0)return"[]";var Q=A1(e,w);return d&&!bfe(Q)?"["+V2(Q,d)+"]":"[ "+As.call(Q,", ")+" ]"}if(ufe(e)){var L=A1(e,w);return!("cause"in Error.prototype)&&"cause"in e&&!l7.call(e,"cause")?"{ ["+String(e)+"] "+As.call(t7.call("[cause]: "+w(e.cause),L),", ")+" }":L.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+As.call(L,", ")+" }"}if(typeof e=="object"&&o){if(o7&&typeof e[o7]=="function"&&U2)return U2(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(pfe(e)){var k=[];return Jq&&Jq.call(e,function(l,g){k.push(w(g,e,!0)+" => "+w(l,e))}),u7("Map",E1.call(e),k,d)}if(wfe(e)){var H=[];return Xq&&Xq.call(e,function(l){H.push(w(l,e))}),u7("Set",b1.call(e),H,d)}if(mfe(e))return M2("WeakMap");if(vfe(e))return M2("WeakSet");if(yfe(e))return M2("WeakRef");if(lfe(e))return hd(w(Number(e)));if(hfe(e))return hd(w(L2.call(e)));if(ffe(e))return hd(efe.call(e));if(cfe(e))return hd(w(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!afe(e)&&!a7(e)){var q=A1(e,w),v=n7?n7(e)===Object.prototype:e instanceof Object||e.constructor===Object,C=e instanceof Object?"":"null prototype",R=!v&&qr&&Object(e)===e&&qr in e?G2.call(Xo(e),8,-1):C?"Object":"",F=v||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",B=F+(R||C?"["+As.call(t7.call([],R||[],C||[]),": ")+"] ":"");return q.length===0?B+"{}":d?B+"{"+V2(q,d)+"}":B+"{ "+As.call(q,", ")+" }"}return String(e)};function f7(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function ofe(t){return Jo.call(String(t),/"/g,""")}function q2(t){return Xo(t)==="[object Array]"&&(!qr||!(typeof t=="object"&&qr in t))}function afe(t){return Xo(t)==="[object Date]"&&(!qr||!(typeof t=="object"&&qr in t))}function a7(t){return Xo(t)==="[object RegExp]"&&(!qr||!(typeof t=="object"&&qr in t))}function ufe(t){return Xo(t)==="[object Error]"&&(!qr||!(typeof t=="object"&&qr in t))}function cfe(t){return Xo(t)==="[object String]"&&(!qr||!(typeof t=="object"&&qr in t))}function lfe(t){return Xo(t)==="[object Number]"&&(!qr||!(typeof t=="object"&&qr in t))}function ffe(t){return Xo(t)==="[object Boolean]"&&(!qr||!(typeof t=="object"&&qr in t))}function h7(t){if(Tl)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!F2)return!1;try{return F2.call(t),!0}catch{}return!1}function hfe(t){if(!t||typeof t!="object"||!L2)return!1;try{return L2.call(t),!0}catch{}return!1}var dfe=Object.prototype.hasOwnProperty||function(t){return t in this};function Yo(t,e){return dfe.call(t,e)}function Xo(t){return tfe.call(t)}function gfe(t){if(t.name)return t.name;var e=nfe.call(rfe.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function d7(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return g7(G2.call(t,0,e.maxStringLength),e)+n}var i=Jo.call(Jo.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Efe);return f7(i,"single",e)}function Efe(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+ife.call(e.toString(16))}function hd(t){return"Object("+t+")"}function M2(t){return t+" { ? }"}function u7(t,e,r,n){var i=n?V2(r,n):As.call(r,", ");return t+" ("+e+") {"+i+"}"}function bfe(t){for(var e=0;e=0)return!1;return!0}function Sfe(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=As.call(Array(t.indent+1)," ");else return null;return{base:r,prev:As.call(Array(e+1),r)}}function V2(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+As.call(t,","+r)+` -`+e.prev}function A1(t,e){var r=q2(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";h();var y7=pu(),Cl=$q(),Ife=m7(),_fe=Al(),S1=y7("%WeakMap%",!0),I1=y7("%Map%",!0),Tfe=Cl("WeakMap.prototype.get",!0),Cfe=Cl("WeakMap.prototype.set",!0),Nfe=Cl("WeakMap.prototype.has",!0),xfe=Cl("Map.prototype.get",!0),Ofe=Cl("Map.prototype.set",!0),Dfe=Cl("Map.prototype.has",!0),j2=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Pfe=function(t,e){var r=j2(t,e);return r&&r.value},Rfe=function(t,e,r){var n=j2(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Bfe=function(t,e){return!!j2(t,e)};w7.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new _fe("Side channel does not contain "+Ife(s))},get:function(s){if(S1&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Tfe(e,s)}else if(I1){if(r)return xfe(r,s)}else if(n)return Pfe(n,s)},has:function(s){if(S1&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Nfe(e,s)}else if(I1){if(r)return Dfe(r,s)}else if(n)return Bfe(n,s);return!1},set:function(s,o){S1&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new S1),Cfe(e,s,o)):I1?(r||(r=new I1),Ofe(r,s,o)):(n||(n={key:{},next:null}),Rfe(n,s,o))}};return i}});var _1=D((BTe,A7)=>{"use strict";h();var Mfe=String.prototype.replace,Lfe=/%20/g,z2={RFC1738:"RFC1738",RFC3986:"RFC3986"};A7.exports={default:z2.RFC3986,formatters:{RFC1738:function(t){return Mfe.call(t,Lfe,"+")},RFC3986:function(t){return String(t)}},RFC1738:z2.RFC1738,RFC3986:z2.RFC3986}});var K2=D((LTe,b7)=>{"use strict";h();var Ffe=_1(),Q2=Object.prototype.hasOwnProperty,mu=Array.isArray,Es=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Ufe=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(mu(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===Ffe.RFC1738&&(c===40||c===41)){u+=o.charAt(a);continue}if(c<128){u=u+Es[c];continue}if(c<2048){u=u+(Es[192|c>>6]+Es[128|c&63]);continue}if(c<55296||c>=57344){u=u+(Es[224|c>>12]+Es[128|c>>6&63]+Es[128|c&63]);continue}a+=1,c=65536+((c&1023)<<10|o.charCodeAt(a)&1023),u+=Es[240|c>>18]+Es[128|c>>12&63]+Es[128|c>>6&63]+Es[128|c&63]}return u},Gfe=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";h();var _7=v7(),$2=K2(),pd=_1(),Wfe=Object.prototype.hasOwnProperty,S7={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},yu=Array.isArray,$fe=String.prototype.split,Yfe=Array.prototype.push,T7=function(t,e){Yfe.apply(t,yu(e)?e:[e])},Jfe=Date.prototype.toISOString,I7=pd.default,Dr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:$2.encode,encodeValuesOnly:!1,format:I7,formatter:pd.formatters[I7],indices:!1,serializeDate:function(e){return Jfe.call(e)},skipNulls:!1,strictNullHandling:!1},Xfe=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},W2={},Zfe=function t(e,r,n,i,s,o,u,a,c,f,d,w,A,_,N){for(var P=e,V=N,U=0,Q=!1;(V=V.get(W2))!==void 0&&!Q;){var L=V.get(e);if(U+=1,typeof L<"u"){if(L===U)throw new RangeError("Cyclic object value");Q=!0}typeof V.get(W2)>"u"&&(U=0)}if(typeof u=="function"?P=u(r,P):P instanceof Date?P=f(P):n==="comma"&&yu(P)&&(P=$2.maybeMap(P,function(I){return I instanceof Date?f(I):I})),P===null){if(i)return o&&!A?o(r,Dr.encoder,_,"key",d):r;P=""}if(Xfe(P)||$2.isBuffer(P)){if(o){var k=A?r:o(r,Dr.encoder,_,"key",d);if(n==="comma"&&A){for(var H=$fe.call(String(P),","),q="",v=0;v"u")return C;var R;if(n==="comma"&&yu(P))R=[{value:P.length>0?P.join(",")||null:void 0}];else if(yu(u))R=u;else{var F=Object.keys(P);R=a?F.sort(a):F}for(var B=0;B"u"?Dr.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Dr.charsetSentinel,delimiter:typeof e.delimiter>"u"?Dr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Dr.encode,encoder:typeof e.encoder=="function"?e.encoder:Dr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Dr.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Dr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Dr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Dr.strictNullHandling}};C7.exports=function(t,e){var r=t,n=ehe(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):yu(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var u;e&&e.arrayFormat in S7?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var a=S7[u];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=_7(),f=0;f0?A+w:""}});var D7=D((VTe,O7)=>{"use strict";h();var Nl=K2(),Y2=Object.prototype.hasOwnProperty,the=Array.isArray,_r={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Nl.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},rhe=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},x7=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},nhe="utf8=%26%2310003%3B",ihe="utf8=%E2%9C%93",she=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),u=-1,a,c=r.charset;if(r.charsetSentinel)for(a=0;a-1&&(_=the(_)?[_]:_),Y2.call(n,A)?n[A]=Nl.combine(n[A],_):n[A]=_}return n},ohe=function(t,e,r,n){for(var i=n?e:x7(e,r),s=t.length-1;s>=0;--s){var o,u=t[s];if(u==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var a=u.charAt(0)==="["&&u.charAt(u.length-1)==="]"?u.slice(1,-1):u,c=parseInt(a,10);!r.parseArrays&&a===""?o={0:i}:!isNaN(c)&&u!==a&&String(c)===a&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):a!=="__proto__"&&(o[a]=i)}i=o}return i},ahe=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,u=/(\[[^[\]]*])/g,a=n.depth>0&&o.exec(s),c=a?s.slice(0,a.index):s,f=[];if(c){if(!n.plainObjects&&Y2.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var d=0;n.depth>0&&(a=u.exec(s))!==null&&d"u"?_r.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?_r.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:_r.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:_r.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:_r.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:_r.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:_r.comma,decoder:typeof e.decoder=="function"?e.decoder:_r.decoder,delimiter:typeof e.delimiter=="string"||Nl.isRegExp(e.delimiter)?e.delimiter:_r.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:_r.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:_r.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:_r.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:_r.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:_r.strictNullHandling}};O7.exports=function(t,e){var r=uhe(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?she(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";h();var che=N7(),lhe=D7(),fhe=_1();P7.exports={formats:fhe,parse:lhe,stringify:che}});var J2=D(ze=>{"use strict";h();Object.defineProperty(ze,"__esModule",{value:!0});ze.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ze.WALLET_PROVIDER_CALLBACK_PARAM=ze.WALLET_PROVIDER_SIGN_MESSAGE_URL=ze.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ze.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ze.WALLET_PROVIDER_SEND_TRANSACTION_URL=ze.WALLET_PROVIDER_DISCONNECT_URL=ze.WALLET_PROVIDER_CONNECT_URL=ze.XALIAS_PROVIDER_TESTNET=ze.XALIAS_PROVIDER_DEVNET=ze.XALIAS_PROVIDER_MAINNET=ze.WALLET_PROVIDER_TESTNET=ze.WALLET_PROVIDER_DEVNET=ze.WALLET_PROVIDER_MAINNET=void 0;ze.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ze.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ze.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ze.XALIAS_PROVIDER_MAINNET="https://xalias.com";ze.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";ze.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";ze.WALLET_PROVIDER_CONNECT_URL="hook/login";ze.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ze.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ze.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ze.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ze.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ze.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ze.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var B7=D(xl=>{"use strict";h();Object.defineProperty(xl,"__esModule",{value:!0});xl.ErrCannotSignedMessage=xl.ErrCannotGetSignedTransactions=void 0;var X2=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};xl.ErrCannotGetSignedTransactions=X2;var Z2=class extends Error{constructor(){super("Cannot get signed message")}};xl.ErrCannotSignedMessage=Z2});var M7=D(T1=>{"use strict";h();Object.defineProperty(T1,"__esModule",{value:!0});T1.PlainSignedTransaction=void 0;var eC=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};T1.PlainSignedTransaction=eC});var Ol=D(ta=>{"use strict";h();var Zo=ta&&ta.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})},hhe=ta&&ta.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ta,"__esModule",{value:!0});ta.WalletProvider=void 0;var tC=hhe(R7()),ea=J2(),rC=B7(),dhe=M7(),nC=class t{constructor(e){this.walletUrl=e}login(e){return Zo(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ea.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Zo(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return Zo(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Zo(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ea.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Zo(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ea.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=tC.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new rC.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Zo(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ea.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Zo(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ea.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Zo(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(e=window.location.search){let r=tC.default.parse(e.slice(1));return t.isTxSignReturnSuccess(r)?this.getTxSignReturnValue(r):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ea.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ea.WALLET_PROVIDER_CALLBACK_PARAM]===ea.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new rC.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new rC.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let u=t.prepareWalletTransaction(o);for(let a in u)u.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(u[a])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};ta.WalletProvider=nC});var p9=D((XTe,g9)=>{"use strict";h();function K7(t,e){return function(){return t.apply(e,arguments)}}var{toString:ghe}=Object.prototype,{getPrototypeOf:pC}=Object,O1=(t=>e=>{let r=ghe.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Ss=t=>(t=t.toLowerCase(),e=>O1(e)===t),D1=t=>e=>typeof e===t,{isArray:Bl}=Array,yd=D1("undefined");function phe(t){return t!==null&&!yd(t)&&t.constructor!==null&&!yd(t.constructor)&&ti(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var W7=Ss("ArrayBuffer");function mhe(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&W7(t.buffer),e}var yhe=D1("string"),ti=D1("function"),$7=D1("number"),P1=t=>t!==null&&typeof t=="object",whe=t=>t===!0||t===!1,C1=t=>{if(O1(t)!=="object")return!1;let e=pC(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},vhe=Ss("Date"),Ahe=Ss("File"),Ehe=Ss("Blob"),bhe=Ss("FileList"),She=t=>P1(t)&&ti(t.pipe),Ihe=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ti(t.append)&&((e=O1(t))==="formdata"||e==="object"&&ti(t.toString)&&t.toString()==="[object FormData]"))},_he=Ss("URLSearchParams"),The=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wd(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Bl(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var J7=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,X7=t=>!yd(t)&&t!==J7;function uC(){let{caseless:t}=X7(this)&&this||{},e={},r=(n,i)=>{let s=t&&Y7(e,i)||i;C1(e[s])&&C1(n)?e[s]=uC(e[s],n):C1(n)?e[s]=uC({},n):Bl(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(wd(e,(i,s)=>{r&&ti(i)?t[s]=K7(i,r):t[s]=i},{allOwnKeys:n}),t),Nhe=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),xhe=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Ohe=(t,e,r,n)=>{let i,s,o,u={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!u[o]&&(e[o]=t[o],u[o]=!0);t=r!==!1&&pC(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Dhe=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},Phe=t=>{if(!t)return null;if(Bl(t))return t;let e=t.length;if(!$7(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Rhe=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&pC(Uint8Array)),Bhe=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},Mhe=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Lhe=Ss("HTMLFormElement"),Fhe=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),L7=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Uhe=Ss("RegExp"),Z7=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};wd(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},qhe=t=>{Z7(t,(e,r)=>{if(ti(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(ti(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Vhe=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Bl(t)?n(t):n(String(t).split(e)),r},khe=()=>{},Hhe=(t,e)=>(t=+t,Number.isFinite(t)?t:e),iC="abcdefghijklmnopqrstuvwxyz",F7="0123456789",e9={DIGIT:F7,ALPHA:iC,ALPHA_DIGIT:iC+iC.toUpperCase()+F7},Ghe=(t=16,e=e9.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function jhe(t){return!!(t&&ti(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var zhe=t=>{let e=new Array(10),r=(n,i)=>{if(P1(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=Bl(n)?[]:{};return wd(n,(o,u)=>{let a=r(o,i+1);!yd(a)&&(s[u]=a)}),e[i]=void 0,s}}return n};return r(t,0)},Qhe=Ss("AsyncFunction"),Khe=t=>t&&(P1(t)||ti(t))&&ti(t.then)&&ti(t.catch),re={isArray:Bl,isArrayBuffer:W7,isBuffer:phe,isFormData:Ihe,isArrayBufferView:mhe,isString:yhe,isNumber:$7,isBoolean:whe,isObject:P1,isPlainObject:C1,isUndefined:yd,isDate:vhe,isFile:Ahe,isBlob:Ehe,isRegExp:Uhe,isFunction:ti,isStream:She,isURLSearchParams:_he,isTypedArray:Rhe,isFileList:bhe,forEach:wd,merge:uC,extend:Che,trim:The,stripBOM:Nhe,inherits:xhe,toFlatObject:Ohe,kindOf:O1,kindOfTest:Ss,endsWith:Dhe,toArray:Phe,forEachEntry:Bhe,matchAll:Mhe,isHTMLForm:Lhe,hasOwnProperty:L7,hasOwnProp:L7,reduceDescriptors:Z7,freezeMethods:qhe,toObjectSet:Vhe,toCamelCase:Fhe,noop:khe,toFiniteNumber:Hhe,findKey:Y7,global:J7,isContextDefined:X7,ALPHABET:e9,generateString:Ghe,isSpecCompliantForm:jhe,toJSONObject:zhe,isAsyncFn:Qhe,isThenable:Khe};function Le(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}re.inherits(Le,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var t9=Le.prototype,r9={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{r9[t]={value:t}});Object.defineProperties(Le,r9);Object.defineProperty(t9,"isAxiosError",{value:!0});Le.from=(t,e,r,n,i,s)=>{let o=Object.create(t9);return re.toFlatObject(t,o,function(a){return a!==Error.prototype},u=>u!=="isAxiosError"),Le.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var Whe=null;function cC(t){return re.isPlainObject(t)||re.isArray(t)}function n9(t){return re.endsWith(t,"[]")?t.slice(0,-2):t}function U7(t,e,r){return t?t.concat(e).map(function(i,s){return i=n9(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function $he(t){return re.isArray(t)&&!t.some(cC)}var Yhe=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function R1(t,e,r){if(!re.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=re.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,P){return!re.isUndefined(P[N])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,a=(r.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function c(_){if(_===null)return"";if(re.isDate(_))return _.toISOString();if(!a&&re.isBlob(_))throw new Le("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(_)||re.isTypedArray(_)?a&&typeof Blob=="function"?new Blob([_]):p.Buffer.from(_):_}function f(_,N,P){let V=_;if(_&&!P&&typeof _=="object"){if(re.endsWith(N,"{}"))N=n?N:N.slice(0,-2),_=JSON.stringify(_);else if(re.isArray(_)&&$he(_)||(re.isFileList(_)||re.endsWith(N,"[]"))&&(V=re.toArray(_)))return N=n9(N),V.forEach(function(Q,L){!(re.isUndefined(Q)||Q===null)&&e.append(o===!0?U7([N],L,s):o===null?N:N+"[]",c(Q))}),!1}return cC(_)?!0:(e.append(U7(P,N,s),c(_)),!1)}let d=[],w=Object.assign(Yhe,{defaultVisitor:f,convertValue:c,isVisitable:cC});function A(_,N){if(!re.isUndefined(_)){if(d.indexOf(_)!==-1)throw Error("Circular reference detected in "+N.join("."));d.push(_),re.forEach(_,function(V,U){(!(re.isUndefined(V)||V===null)&&i.call(e,V,re.isString(U)?U.trim():U,N,w))===!0&&A(V,N?N.concat(U):[U])}),d.pop()}}if(!re.isObject(t))throw new TypeError("data must be an object");return A(t),e}function q7(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function mC(t,e){this._pairs=[],t&&R1(t,this,e)}var i9=mC.prototype;i9.append=function(e,r){this._pairs.push([e,r])};i9.toString=function(e){let r=e?function(n){return e.call(this,n,q7)}:q7;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Jhe(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function s9(t,e,r){if(!e)return t;let n=r&&r.encode||Jhe,i=r&&r.serialize,s;if(i?s=i(e,r):s=re.isURLSearchParams(e)?e.toString():new mC(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var lC=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(n){n!==null&&e(n)})}},V7=lC,o9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xhe=typeof URLSearchParams<"u"?URLSearchParams:mC,Zhe=typeof FormData<"u"?FormData:null,ede=typeof Blob<"u"?Blob:null,tde={isBrowser:!0,classes:{URLSearchParams:Xhe,FormData:Zhe,Blob:ede},protocols:["http","https","file","blob","url","data"]},a9=typeof window<"u"&&typeof document<"u",rde=(t=>a9&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),nde=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ide=Object.freeze({__proto__:null,hasBrowserEnv:a9,hasStandardBrowserWebWorkerEnv:nde,hasStandardBrowserEnv:rde}),bs={...ide,...tde};function sde(t,e){return R1(t,new bs.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return bs.isNode&&re.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function ode(t){return re.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function ade(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&re.isArray(i)?i.length:o,a?(re.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!u):((!i[o]||!re.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&re.isArray(i[o])&&(i[o]=ade(i[o])),!u)}if(re.isFormData(t)&&re.isFunction(t.entries)){let r={};return re.forEachEntry(t,(n,i)=>{e(ode(n),i,r,0)}),r}return null}function ude(t,e,r){if(re.isString(t))try{return(e||JSON.parse)(t),re.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var yC={transitional:o9,adapter:["xhr","http"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=re.isObject(e);if(s&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(u9(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return sde(e,this.formSerializer).toString();if((u=re.isFileList(e))||n.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return R1(u?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),ude(e)):e}],transformResponse:[function(e){let r=this.transitional||yC.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&re.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(u){if(o)throw u.name==="SyntaxError"?Le.from(u,Le.ERR_BAD_RESPONSE,this,null,this.response):u}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bs.classes.FormData,Blob:bs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],t=>{yC.headers[t]={}});var wC=yC,cde=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),lde=t=>{let e={},r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&cde[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},k7=Symbol("internals");function md(t){return t&&String(t).trim().toLowerCase()}function N1(t){return t===!1||t==null?t:re.isArray(t)?t.map(N1):String(t)}function fde(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var hde=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function sC(t,e,r,n,i){if(re.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!re.isString(e)){if(re.isString(n))return e.indexOf(n)!==-1;if(re.isRegExp(n))return n.test(e)}}function dde(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function gde(t,e){let r=re.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Dl=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(u,a,c){let f=md(a);if(!f)throw new Error("header name must be a non-empty string");let d=re.findKey(i,f);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||a]=N1(u))}let o=(u,a)=>re.forEach(u,(c,f)=>s(c,f,a));return re.isPlainObject(e)||e instanceof this.constructor?o(e,r):re.isString(e)&&(e=e.trim())&&!hde(e)?o(lde(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=md(e),e){let n=re.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return fde(i);if(re.isFunction(r))return r.call(this,i,n);if(re.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=md(e),e){let n=re.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||sC(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=md(o),o){let u=re.findKey(n,o);u&&(!r||sC(n,n[u],u,r))&&(delete n[u],i=!0)}}return re.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||sC(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return re.forEach(this,(i,s)=>{let o=re.findKey(n,s);if(o){r[o]=N1(i),delete r[s];return}let u=e?dde(s):String(s).trim();u!==s&&delete r[s],r[u]=N1(i),n[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return re.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&re.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[k7]=this[k7]={accessors:{}}).accessors,i=this.prototype;function s(o){let u=md(o);n[u]||(gde(i,o),n[u]=!0)}return re.isArray(e)?e.forEach(s):s(e),this}};Dl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);re.reduceDescriptors(Dl.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});re.freezeMethods(Dl);var to=Dl;function oC(t,e){let r=this||wC,n=e||r,i=to.from(n.headers),s=n.data;return re.forEach(t,function(u){s=u.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function c9(t){return!!(t&&t.__CANCEL__)}function vd(t,e,r){Le.call(this,t??"canceled",Le.ERR_CANCELED,e,r),this.name="CanceledError"}re.inherits(vd,Le,{__CANCEL__:!0});function pde(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Le("Request failed with status code "+r.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var mde=bs.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];re.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),re.isString(n)&&o.push("path="+n),re.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function yde(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function wde(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function l9(t,e){return t&&!yde(e)?wde(t,e):e}var vde=bs.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let u=re.isString(o)?i(o):o;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}();function Ade(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Ede(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(a){let c=Date.now(),f=n[s];o||(o=c),r[i]=a,n[i]=c;let d=s,w=0;for(;d!==i;)w+=r[d++],d=d%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o{let s=i.loaded,o=i.lengthComputable?i.total:void 0,u=s-r,a=n(u),c=s<=o;r=s;let f={loaded:s,total:o,progress:o?s/o:void 0,bytes:u,rate:a||void 0,estimated:a&&o&&c?(o-s)/a:void 0,event:i};f[e?"download":"upload"]=!0,t(f)}}var bde=typeof XMLHttpRequest<"u",Sde=bde&&function(t){return new Promise(function(r,n){let i=t.data,s=to.from(t.headers).normalize(),{responseType:o,withXSRFToken:u}=t,a;function c(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a)}let f;if(re.isFormData(i)){if(bs.hasStandardBrowserEnv||bs.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((f=s.getContentType())!==!1){let[N,...P]=f?f.split(";").map(V=>V.trim()).filter(Boolean):[];s.setContentType([N||"multipart/form-data",...P].join("; "))}}let d=new XMLHttpRequest;if(t.auth){let N=t.auth.username||"",P=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(N+":"+P))}let w=l9(t.baseURL,t.url);d.open(t.method.toUpperCase(),s9(w,t.params,t.paramsSerializer),!0),d.timeout=t.timeout;function A(){if(!d)return;let N=to.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),V={data:!o||o==="text"||o==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:N,config:t,request:d};pde(function(Q){r(Q),c()},function(Q){n(Q),c()},V),d=null}if("onloadend"in d?d.onloadend=A:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(A)},d.onabort=function(){d&&(n(new Le("Request aborted",Le.ECONNABORTED,t,d)),d=null)},d.onerror=function(){n(new Le("Network Error",Le.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let P=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",V=t.transitional||o9;t.timeoutErrorMessage&&(P=t.timeoutErrorMessage),n(new Le(P,V.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,t,d)),d=null},bs.hasStandardBrowserEnv&&(u&&re.isFunction(u)&&(u=u(t)),u||u!==!1&&vde(w))){let N=t.xsrfHeaderName&&t.xsrfCookieName&&mde.read(t.xsrfCookieName);N&&s.set(t.xsrfHeaderName,N)}i===void 0&&s.setContentType(null),"setRequestHeader"in d&&re.forEach(s.toJSON(),function(P,V){d.setRequestHeader(V,P)}),re.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),o&&o!=="json"&&(d.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&d.addEventListener("progress",H7(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",H7(t.onUploadProgress)),(t.cancelToken||t.signal)&&(a=N=>{d&&(n(!N||N.type?new vd(null,t,d):N),d.abort(),d=null)},t.cancelToken&&t.cancelToken.subscribe(a),t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a)));let _=Ade(w);if(_&&bs.protocols.indexOf(_)===-1){n(new Le("Unsupported protocol "+_+":",Le.ERR_BAD_REQUEST,t));return}d.send(i||null)})},fC={http:Whe,xhr:Sde};re.forEach(fC,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var G7=t=>`- ${t}`,Ide=t=>re.isFunction(t)||t===null||t===!1,f9={getAdapter:t=>{t=re.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${u} `+(a===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : -`+s.map(G7).join(` -`):" "+G7(s[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:fC};function aC(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new vd(null,t)}function j7(t){return aC(t),t.headers=to.from(t.headers),t.data=oC.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),f9.getAdapter(t.adapter||wC.adapter)(t).then(function(n){return aC(t),n.data=oC.call(t,t.transformResponse,n),n.headers=to.from(n.headers),n},function(n){return c9(n)||(aC(t),n&&n.response&&(n.response.data=oC.call(t,t.transformResponse,n.response),n.response.headers=to.from(n.response.headers))),Promise.reject(n)})}var z7=t=>t instanceof to?{...t}:t;function Pl(t,e){e=e||{};let r={};function n(c,f,d){return re.isPlainObject(c)&&re.isPlainObject(f)?re.merge.call({caseless:d},c,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function i(c,f,d){if(re.isUndefined(f)){if(!re.isUndefined(c))return n(void 0,c,d)}else return n(c,f,d)}function s(c,f){if(!re.isUndefined(f))return n(void 0,f)}function o(c,f){if(re.isUndefined(f)){if(!re.isUndefined(c))return n(void 0,c)}else return n(void 0,f)}function u(c,f,d){if(d in e)return n(c,f);if(d in t)return n(void 0,c)}let a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u,headers:(c,f)=>i(z7(c),z7(f),!0)};return re.forEach(Object.keys(Object.assign({},t,e)),function(f){let d=a[f]||i,w=d(t[f],e[f],f);re.isUndefined(w)&&d!==u||(r[f]=w)}),r}var h9="1.6.8",vC={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{vC[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Q7={};vC.transitional=function(e,r,n){function i(s,o){return"[Axios v"+h9+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,u)=>{if(e===!1)throw new Le(i(o," has been removed"+(r?" in "+r:"")),Le.ERR_DEPRECATED);return r&&!Q7[o]&&(Q7[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,u):!0}};function _de(t,e,r){if(typeof t!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let u=t[s],a=u===void 0||o(u,s,t);if(a!==!0)throw new Le("option "+s+" must be "+a,Le.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Le("Unknown option "+s,Le.ERR_BAD_OPTION)}}var hC={assertOptions:_de,validators:vC},ra=hC.validators,Rl=class{constructor(e){this.defaults=e,this.interceptors={request:new V7,response:new V7}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let s=i.stack?i.stack.replace(/^.+\n/,""):"";n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Pl(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&hC.assertOptions(n,{silentJSONParsing:ra.transitional(ra.boolean),forcedJSONParsing:ra.transitional(ra.boolean),clarifyTimeoutError:ra.transitional(ra.boolean)},!1),i!=null&&(re.isFunction(i)?r.paramsSerializer={serialize:i}:hC.assertOptions(i,{encode:ra.function,serialize:ra.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&re.merge(s.common,s[r.method]);s&&re.forEach(["delete","get","head","post","put","patch","common"],_=>{delete s[_]}),r.headers=to.concat(o,s);let u=[],a=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(a=a&&N.synchronous,u.unshift(N.fulfilled,N.rejected))});let c=[];this.interceptors.response.forEach(function(N){c.push(N.fulfilled,N.rejected)});let f,d=0,w;if(!a){let _=[j7.bind(this),void 0];for(_.unshift.apply(_,u),_.push.apply(_,c),w=_.length,f=Promise.resolve(r);d{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(u=>{n.subscribe(u),s=u}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,u){n.reason||(n.reason=new vd(s,o,u),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Tde=dC;function Cde(t){return function(r){return t.apply(null,r)}}function Nde(t){return re.isObject(t)&&t.isAxiosError===!0}var gC={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gC).forEach(([t,e])=>{gC[e]=t});var xde=gC;function d9(t){let e=new x1(t),r=K7(x1.prototype.request,e);return re.extend(r,x1.prototype,e,{allOwnKeys:!0}),re.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return d9(Pl(t,i))},r}var lr=d9(wC);lr.Axios=x1;lr.CanceledError=vd;lr.CancelToken=Tde;lr.isCancel=c9;lr.VERSION=h9;lr.toFormData=R1;lr.AxiosError=Le;lr.Cancel=lr.CanceledError;lr.all=function(e){return Promise.all(e)};lr.spread=Cde;lr.isAxiosError=Nde;lr.mergeConfig=Pl;lr.AxiosHeaders=to;lr.formToJSON=t=>u9(re.isHTMLForm(t)?new FormData(t):t);lr.getAdapter=f9.getAdapter;lr.HttpStatusCode=xde;lr.default=lr;g9.exports=lr});var m9=D(B1=>{"use strict";h();Object.defineProperty(B1,"__esModule",{value:!0});B1.NativeAuthClientConfig=void 0;var AC=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};B1.NativeAuthClientConfig=AC});var bC=D(Ml=>{"use strict";h();var wu=Ml&&Ml.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ml,"__esModule",{value:!0});Ml.NativeAuthClient=void 0;var Ode=p9(),Dde=m9(),EC=class{constructor(e){this.config=Object.assign(new Dde.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return wu(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return wu(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return wu(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return wu(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return wu(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return wu(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(p.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return wu(this,void 0,void 0,function*(){return yield Ode.default.get(e,{headers:this.config.extraRequestHeaders})})}};Ml.NativeAuthClient=EC});var A9=D(L1=>{"use strict";h();Object.defineProperty(L1,"__esModule",{value:!0});L1.TransactionStatus=void 0;var IC=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};L1.TransactionStatus=IC});var b9=D(F1=>{"use strict";h();Object.defineProperty(F1,"__esModule",{value:!0});F1.TransactionReceipt=void 0;var E9=_c(),_C=class t{constructor(){this.value="",this.sender=new E9.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new E9.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};F1.TransactionReceipt=_C});var S9=D(Is=>{"use strict";h();Object.defineProperty(Is,"__esModule",{value:!0});Is.ErrContractQuery=Is.ErrNetworkProvider=Is.ErrUnexpectedCondition=Is.Err=void 0;var Fl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Is.Err=Fl;var TC=class extends Fl{constructor(e){super(`Unexpected condition: [${e}]`)}};Is.ErrUnexpectedCondition=TC;var CC=class extends Fl{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Is.ErrNetworkProvider=CC;var NC=class extends Fl{constructor(e){super(e.message.replace("executeQuery:",""))}};Is.ErrContractQuery=NC});var _9=D(na=>{"use strict";h();Object.defineProperty(na,"__esModule",{value:!0});na.TransactionEventTopic=na.TransactionEventData=na.TransactionEvent=void 0;var I9=_c(),xC=class t{constructor(e){this.address=new I9.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new Ul(p.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new I9.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new U1(n)),r.dataPayload=Ul.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(Ul.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};na.TransactionEvent=xC;var Ul=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(p.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};na.TransactionEventData=Ul;var U1=class{constructor(e){this.raw=p.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};na.TransactionEventTopic=U1});var DC=D(q1=>{"use strict";h();Object.defineProperty(q1,"__esModule",{value:!0});q1.TransactionLogs=void 0;var Bde=S9(),T9=_c(),Mde=_9(),OC=class t{constructor(e){this.address=new T9.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new T9.Address(e.address),r.events=(e.events||[]).map(n=>Mde.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new Bde.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};q1.TransactionLogs=OC});var N9=D(ql=>{"use strict";h();Object.defineProperty(ql,"__esModule",{value:!0});ql.ContractResultItem=ql.ContractResults=void 0;var C9=DC(),V1=_c(),PC=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>Ad.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Ad.fromApiHttpResponse(n));return new t(r)}};ql.ContractResults=PC;var Ad=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new V1.Address(""),this.sender=new V1.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new C9.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=p.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new V1.Address(e.receiver),r.sender=new V1.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=C9.TransactionLogs.fromHttpResponse(e.logs||{}),r}};ql.ContractResultItem=Ad});var x9=D(k1=>{"use strict";h();Object.defineProperty(k1,"__esModule",{value:!0});k1.ContractQueryRequest=void 0;var RC=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};k1.ContractQueryRequest=RC});var k9=D((tCe,V9)=>{h();V9.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ia=D(Au=>{h();var BC,Lde=[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];Au.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};Au.getSymbolTotalCodewords=function(e){return Lde[e]};Au.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Au.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');BC=e};Au.isKanjiModeEnabled=function(){return typeof BC<"u"};Au.toSJIS=function(e){return BC(e)}});var z1=D(ri=>{h();ri.L={bit:1};ri.M={bit:0};ri.Q={bit:3};ri.H={bit:2};function Fde(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return ri.L;case"m":case"medium":return ri.M;case"q":case"quartile":return ri.Q;case"h":case"high":return ri.H;default:throw new Error("Unknown EC Level: "+t)}}ri.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};ri.from=function(e,r){if(ri.isValid(e))return e;try{return Fde(e)}catch{return r}}});var j9=D((aCe,G9)=>{h();function H9(){this.buffer=[],this.length=0}H9.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};G9.exports=H9});var Q9=D((cCe,z9)=>{h();function Ed(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Ed.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Ed.prototype.get=function(t,e){return this.data[t*this.size+e]};Ed.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Ed.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};z9.exports=Ed});var K9=D(Q1=>{h();var Ude=ia().getSymbolSize;Q1.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=Ude(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{h();var qde=ia().getSymbolSize,W9=7;$9.getPositions=function(e){let r=qde(e);return[[0,0],[r-W9,0],[0,r-W9]]}});var J9=D(Bt=>{h();Bt.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Eu={N1:3,N2:3,N3:40,N4:10};Bt.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};Bt.from=function(e){return Bt.isValid(e)?parseInt(e,10):void 0};Bt.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,u=null;for(let a=0;a=5&&(n+=Eu.N1+(i-5)),o=f,i=1),f=e.get(c,a),f===u?s++:(s>=5&&(n+=Eu.N1+(s-5)),u=f,s=1)}i>=5&&(n+=Eu.N1+(i-5)),s>=5&&(n+=Eu.N1+(s-5))}return n};Bt.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(u,o),u>=10&&(s===1488||s===93)&&n++}return n*Eu.N3};Bt.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{h();var sa=z1(),K1=[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],W1=[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];MC.getBlocksCount=function(e,r){switch(r){case sa.L:return K1[(e-1)*4+0];case sa.M:return K1[(e-1)*4+1];case sa.Q:return K1[(e-1)*4+2];case sa.H:return K1[(e-1)*4+3];default:return}};MC.getTotalCodewordsCount=function(e,r){switch(r){case sa.L:return W1[(e-1)*4+0];case sa.M:return W1[(e-1)*4+1];case sa.Q:return W1[(e-1)*4+2];case sa.H:return W1[(e-1)*4+3];default:return}}});var X9=D(Y1=>{h();var bd=new Uint8Array(512),$1=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)bd[r]=e,$1[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)bd[r]=bd[r-255]})();Y1.log=function(e){if(e<1)throw new Error("log("+e+")");return $1[e]};Y1.exp=function(e){return bd[e]};Y1.mul=function(e,r){return e===0||r===0?0:bd[$1[e]+$1[r]]}});var Z9=D(Sd=>{h();var FC=X9();Sd.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{h();var eV=Z9();function UC(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}UC.prototype.initialize=function(e){this.degree=e,this.genPoly=eV.generateECPolynomial(this.degree)};UC.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=eV.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};tV.exports=UC});var qC=D(nV=>{h();nV.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var VC=D(ro=>{h();var iV="[0-9]+",kde="[A-Z $%*+\\-./:]+",Id="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Id=Id.replace(/u/g,"\\u");var Hde="(?:(?![A-Z0-9 $%*+\\-./:]|"+Id+`)(?:.|[\r -]))+`;ro.KANJI=new RegExp(Id,"g");ro.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ro.BYTE=new RegExp(Hde,"g");ro.NUMERIC=new RegExp(iV,"g");ro.ALPHANUMERIC=new RegExp(kde,"g");var Gde=new RegExp("^"+Id+"$"),jde=new RegExp("^"+iV+"$"),zde=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ro.testKanji=function(e){return Gde.test(e)};ro.testNumeric=function(e){return jde.test(e)};ro.testAlphanumeric=function(e){return zde.test(e)}});var oa=D(fr=>{h();var Qde=qC(),kC=VC();fr.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};fr.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};fr.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};fr.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};fr.MIXED={bit:-1};fr.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Qde.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};fr.getBestModeForData=function(e){return kC.testNumeric(e)?fr.NUMERIC:kC.testAlphanumeric(e)?fr.ALPHANUMERIC:kC.testKanji(e)?fr.KANJI:fr.BYTE};fr.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};fr.isValid=function(e){return e&&e.bit&&e.ccBits};function Kde(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return fr.NUMERIC;case"alphanumeric":return fr.ALPHANUMERIC;case"kanji":return fr.KANJI;case"byte":return fr.BYTE;default:throw new Error("Unknown mode: "+t)}}fr.from=function(e,r){if(fr.isValid(e))return e;try{return Kde(e)}catch{return r}}});var cV=D(bu=>{h();var J1=ia(),Wde=LC(),sV=z1(),aa=oa(),HC=qC(),aV=7973,oV=J1.getBCHDigit(aV);function $de(t,e,r){for(let n=1;n<=40;n++)if(e<=bu.getCapacity(n,r,t))return n}function uV(t,e){return aa.getCharCountIndicator(t,e)+4}function Yde(t,e){let r=0;return t.forEach(function(n){let i=uV(n.mode,e);r+=i+n.getBitsLength()}),r}function Jde(t,e){for(let r=1;r<=40;r++)if(Yde(t,r)<=bu.getCapacity(r,e,aa.MIXED))return r}bu.from=function(e,r){return HC.isValid(e)?parseInt(e,10):r};bu.getCapacity=function(e,r,n){if(!HC.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=aa.BYTE);let i=J1.getSymbolTotalCodewords(e),s=Wde.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===aa.MIXED)return o;let u=o-uV(n,e);switch(n){case aa.NUMERIC:return Math.floor(u/10*3);case aa.ALPHANUMERIC:return Math.floor(u/11*2);case aa.KANJI:return Math.floor(u/13);case aa.BYTE:default:return Math.floor(u/8)}};bu.getBestVersionForData=function(e,r){let n,i=sV.from(r,sV.M);if(Array.isArray(e)){if(e.length>1)return Jde(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return $de(n.mode,n.getLength(),i)};bu.getEncodedBits=function(e){if(!HC.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;J1.getBCHDigit(r)-oV>=0;)r^=aV<{h();var GC=ia(),fV=1335,Xde=21522,lV=GC.getBCHDigit(fV);hV.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;GC.getBCHDigit(i)-lV>=0;)i^=fV<{h();var Zde=oa();function kl(t){this.mode=Zde.NUMERIC,this.data=t.toString()}kl.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};kl.prototype.getLength=function(){return this.data.length};kl.prototype.getBitsLength=function(){return kl.getBitsLength(this.data.length)};kl.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};gV.exports=kl});var yV=D((FCe,mV)=>{h();var ege=oa(),jC=["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 Hl(t){this.mode=ege.ALPHANUMERIC,this.data=t}Hl.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Hl.prototype.getLength=function(){return this.data.length};Hl.prototype.getBitsLength=function(){return Hl.getBitsLength(this.data.length)};Hl.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=jC.indexOf(this.data[r])*45;n+=jC.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(jC.indexOf(this.data[r]),6)};mV.exports=Hl});var vV=D((qCe,wV)=>{"use strict";h();wV.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var EV=D((kCe,AV)=>{h();var tge=vV(),rge=oa();function Gl(t){this.mode=rge.BYTE,typeof t=="string"&&(t=tge(t)),this.data=new Uint8Array(t)}Gl.getBitsLength=function(e){return e*8};Gl.prototype.getLength=function(){return this.data.length};Gl.prototype.getBitsLength=function(){return Gl.getBitsLength(this.data.length)};Gl.prototype.write=function(t){for(let e=0,r=this.data.length;e{h();var nge=oa(),ige=ia();function jl(t){this.mode=nge.KANJI,this.data=t}jl.getBitsLength=function(e){return e*13};jl.prototype.getLength=function(){return this.data.length};jl.prototype.getBitsLength=function(){return jl.getBitsLength(this.data.length)};jl.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};bV.exports=jl});var IV=D((zCe,zC)=>{"use strict";h();var _d={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=_d.PriorityQueue.make();s.push(e,0);for(var o,u,a,c,f,d,w,A,_;!s.empty();){o=s.pop(),u=o.value,c=o.cost,f=t[u]||{};for(a in f)f.hasOwnProperty(a)&&(d=f[a],w=c+d,A=i[a],_=typeof i[a]>"u",(_||A>w)&&(i[a]=w,s.push(a,w),n[a]=u))}if(typeof r<"u"&&typeof i[r]>"u"){var N=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(N)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=_d.single_source_shortest_paths(t,e,r);return _d.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=_d.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof zC<"u"&&(zC.exports=_d)});var PV=D(zl=>{h();var Qe=oa(),CV=pV(),NV=yV(),xV=EV(),OV=SV(),Td=VC(),X1=ia(),sge=IV();function _V(t){return unescape(encodeURIComponent(t)).length}function Cd(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function DV(t){let e=Cd(Td.NUMERIC,Qe.NUMERIC,t),r=Cd(Td.ALPHANUMERIC,Qe.ALPHANUMERIC,t),n,i;return X1.isKanjiModeEnabled()?(n=Cd(Td.BYTE,Qe.BYTE,t),i=Cd(Td.KANJI,Qe.KANJI,t)):(n=Cd(Td.BYTE_KANJI,Qe.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,u){return o.index-u.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function QC(t,e){switch(e){case Qe.NUMERIC:return CV.getBitsLength(t);case Qe.ALPHANUMERIC:return NV.getBitsLength(t);case Qe.KANJI:return OV.getBitsLength(t);case Qe.BYTE:return xV.getBitsLength(t)}}function oge(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function age(t){let e=[];for(let r=0;r{h();var ew=ia(),KC=z1(),cge=j9(),lge=Q9(),fge=K9(),hge=Y9(),YC=J9(),JC=LC(),dge=rV(),Z1=cV(),gge=dV(),pge=oa(),WC=PV();function mge(t,e){let r=t.size,n=hge.getPositions(e);for(let i=0;i=0&&u<=6&&(a===0||a===6)||a>=0&&a<=6&&(u===0||u===6)||u>=2&&u<=4&&a>=2&&a<=4?t.set(s+u,o+a,!0,!0):t.set(s+u,o+a,!1,!0))}}function yge(t){let e=t.size;for(let r=8;r>u&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function $C(t,e,r){let n=t.size,i=gge.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function Age(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let u=r-1;u>0;u-=2)for(u===6&&u--;;){for(let a=0;a<2;a++)if(!t.isReserved(i,u-a)){let c=!1;o>>s&1)===1),t.set(i,u-a,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Ege(t,e,r){let n=new cge;r.forEach(function(a){n.put(a.mode.bit,4),n.put(a.getLength(),pge.getCharCountIndicator(a.mode,t)),a.write(n)});let i=ew.getSymbolTotalCodewords(t),s=JC.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let u=(o-n.getLengthInBits())/8;for(let a=0;a{if(!p.includes(":")||n)return;let S=yu(e[p].accounts);S.includes(p)||(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} + Required: ${p} + Approved: ${S.toString()}`))}),o.forEach(p=>{n||(Ka(i[p].methods,s[p].methods)?Ka(i[p].events,s[p].events)||(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function Vge(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function oU(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Hge(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:yu(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function Gge(t,e){return wb(t,!1)&&t<=e.max&&t>=e.min}function zge(){let t=gu();return new Promise(e=>{switch(t){case _n.browser:e(Kk());break;case _n.reactNative:e(Wk());break;case _n.node:e($k());break;default:e(!0)}})}function Kk(){return K0()&&navigator?.onLine}async function Wk(){return rd()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function $k(){return!0}function jge(t){switch(gu()){case _n.browser:Yk(t);break;case _n.reactNative:Jk(t);break;case _n.node:break}}function Yk(t){!rd()&&K0()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Jk(t){rd()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var t8={},f8=class{static get(e){return t8[e]}static set(e,r){t8[e]=r}static delete(e){delete t8[e]}};K.BASE10=N8,K.BASE16=Tn,K.BASE64=O8,K.BASE64URL=Vpe,K.COLON=vde,K.DEFAULT_DEPTH=p8,K.EMPTY_SPACE=ib,K.ENV_MAP=_n,K.INTERNAL_ERRORS=Fk,K.MemoryStore=f8,K.ONE_THOUSAND=bde,K.REACT_NATIVE_PRODUCT=mU,K.RELAYER_DEFAULT_PROTOCOL=Ck,K.SDK_ERRORS=Lk,K.SDK_TYPE=vU,K.SLASH=yU,K.TYPE_0=P8,K.TYPE_1=cd,K.TYPE_2=$0,K.UTF8=ad,K.addResourceToRecap=Ek,K.appendToQueryString=bU,K.assertType=Tde,K.assignAbilityToActions=I8,K.base64Decode=wk,K.base64Encode=bk,K.buildApprovedNamespaces=Sge,K.buildAuthObject=Mpe,K.buildNamespacesFromAuth=_ge,K.buildRecapStatement=_k,K.calcExpiry=Fde,K.capitalize=Pde,K.capitalizeWord=TU,K.createDelayedPromise=Rde,K.createEncodedRecap=Fpe,K.createExpiringPromise=Mde,K.createRecap=Ak,K.decodeRecap=$a,K.decodeTypeByte=hu,K.decodeTypeTwoEnvelope=Jpe,K.decrypt=Ype,K.deriveSymKey=jpe,K.deserialize=vb,K.encodeRecap=mb,K.encodeTypeByte=M8,K.encodeTypeTwoEnvelope=$pe,K.encrypt=Wpe,K.engineEvent=Ude,K.enumify=Ode,K.formatAccountId=dU,K.formatAccountWithChain=lde,K.formatChainId=fU,K.formatDeeplinkUrl=IU,K.formatExpirerTarget=m8,K.formatIdTarget=Bde,K.formatMessage=gk,K.formatMessageContext=Ide,K.formatRelayParams=Ok,K.formatRelayRpcUrl=Sde,K.formatStatementFromRecap=x8,K.formatTopicTarget=Dde,K.formatUA=EU,K.formatUri=hge,K.fromBase64=y8,K.generateKeyPair=Gpe,K.generateRandomBytes32=zpe,K.getAccountsChains=yu,K.getAccountsFromNamespaces=dde,K.getAddressFromAccount=hU,K.getAddressesFromAccounts=fde,K.getAppMetadata=Ade,K.getBrowserOnlineStatus=Kk,K.getBundleId=wde,K.getChainFromAccount=pU,K.getChainsFromAccounts=gU,K.getChainsFromNamespace=hb,K.getChainsFromNamespaces=hde,K.getChainsFromRecap=kpe,K.getChainsFromRequiredNamespaces=pde,K.getCommonValuesInArrays=r8,K.getCryptoKeyFromKeyData=Ik,K.getDecodedRecapFromResources=mk,K.getDeepLink=Vde,K.getDidAddress=T8,K.getDidAddressSegments=gb,K.getDidChainId=_8,K.getEnvironment=gu,K.getHttpUrl=_de,K.getInternalError=Wo,K.getJavascriptID=AU,K.getJavascriptOS=wU,K.getLastItems=_U,K.getLinkModeURL=pge,K.getMethodsFromRecap=Upe,K.getNamespacedDidChainId=Ppe,K.getNamespacesChains=Pk,K.getNamespacesEventsForChainId=Mk,K.getNamespacesFromAccounts=Bk,K.getNamespacesMethodsForChainId=Rk,K.getNodeOnlineStatus=$k,K.getReCapActions=vk,K.getReactNativeOnlineStatus=Wk,K.getRecapAbilitiesFromResource=Lpe,K.getRecapFromResources=yb,K.getRecapResource=yk,K.getRelayClientMetadata=Ede,K.getRelayProtocolApi=sge,K.getRelayProtocolName=ige,K.getRequiredNamespacesFromNamespaces=Ege,K.getSdkError=pu,K.getSearchParamFromURL=Hde,K.getUniqueValues=h8,K.handleDeeplinkRedirect=kde,K.hasOverlap=Ka,K.hashKey=Qpe,K.hashMessage=Kpe,K.isBrowser=K0,K.isCaipNamespace=B8,K.isConformingNamespaces=Qk,K.isExpired=qde,K.isNode=g8,K.isOnline=zge,K.isProposalStruct=Cge,K.isReactNative=rd,K.isRecap=C8,K.isSessionCompatible=Tge,K.isSessionStruct=xge,K.isTelegram=CU,K.isTestRun=zde,K.isTypeOneEnvelope=Zpe,K.isTypeTwoEnvelope=ege,K.isUndefined=Wa,K.isValidAccountId=qk,K.isValidAccounts=Vk,K.isValidActions=Gk,K.isValidArray=Y0,K.isValidChainId=Q0,K.isValidChains=Uk,K.isValidController=Nge,K.isValidEip1271Signature=hk,K.isValidEip191Signature=dk,K.isValidErrorReason=Dge,K.isValidEvent=Fge,K.isValidId=Rge,K.isValidNamespaceAccounts=Hk,K.isValidNamespaceActions=L8,K.isValidNamespaceChains=kk,K.isValidNamespaceMethodsOrEvents=l8,K.isValidNamespaces=zk,K.isValidNamespacesChainId=qge,K.isValidNamespacesEvent=kge,K.isValidNamespacesRequest=Uge,K.isValidNumber=wb,K.isValidObject=bb,K.isValidParams=Mge,K.isValidRecap=uo,K.isValidRelay=jk,K.isValidRelays=Pge,K.isValidRequest=Bge,K.isValidRequestExpiry=Gge,K.isValidRequiredNamespaces=Oge,K.isValidResponse=Lge,K.isValidString=ti,K.isValidUrl=Ige,K.mapEntries=Nde,K.mapToObj=Cde,K.mergeArrays=$o,K.mergeEncodedRecaps=qpe,K.mergeRecaps=Sk,K.normalizeNamespaces=u8,K.objToMap=xde,K.parseAccountId=d8,K.parseChainId=lU,K.parseContextNames=SU,K.parseExpirerTarget=Lde,K.parseNamespaceKey=Dk,K.parseRelayParams=xk,K.parseTopic=Nk,K.parseUri=dge,K.populateAuthPayload=Dpe,K.recapHasResource=Bpe,K.serialize=D8,K.subscribeToBrowserNetworkChange=Yk,K.subscribeToNetworkChange=jge,K.subscribeToReactNativeNetworkChange=Jk,K.toBase64=xU,K.uuidv4=Gde,K.validateDecoding=Xpe,K.validateEncoding=Tk,K.validateSignedCacao=Rpe,K.verifyP256Jwt=nge,K.verifySignature=fk});var Xk,Zk,eV,tV,Ab,X0,F8,Eb,Ya,Z0,Sb=pe(()=>{h();Xk="PARSE_ERROR",Zk="INVALID_REQUEST",eV="METHOD_NOT_FOUND",tV="INVALID_PARAMS",Ab="INTERNAL_ERROR",X0="SERVER_ERROR",F8=[-32700,-32600,-32601,-32602,-32603],Eb=[-32e3,-32099],Ya={[Xk]:{code:-32700,message:"Parse error"},[Zk]:{code:-32600,message:"Invalid Request"},[eV]:{code:-32601,message:"Method not found"},[tV]:{code:-32602,message:"Invalid params"},[Ab]:{code:-32603,message:"Internal error"},[X0]:{code:-32e3,message:"Server error"}},Z0=X0});function Qge(t){return t<=Eb[0]&&t>=Eb[1]}function _b(t){return F8.includes(t)}function rV(t){return typeof t=="number"}function Tb(t){return Object.keys(Ya).includes(t)?Ya[t]:Ya[Z0]}function Ib(t){let e=Object.values(Ya).find(r=>r.code===t);return e||Ya[Z0]}function Kge(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!rV(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(_b(t.error.code)){let e=Ib(t.error.code);if(e.message!==Ya[Z0].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function q8(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var U8=pe(()=>{h();Sb()});var iV=L(Ja=>{"use strict";h();Object.defineProperty(Ja,"__esModule",{value:!0});Ja.isBrowserCryptoAvailable=Ja.getSubtleCrypto=Ja.getBrowerCrypto=void 0;function k8(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Ja.getBrowerCrypto=k8;function nV(){let t=k8();return t.subtle||t.webkitSubtle}Ja.getSubtleCrypto=nV;function Wge(){return!!k8()&&!!nV()}Ja.isBrowserCryptoAvailable=Wge});var aV=L(Xa=>{"use strict";h();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.isBrowser=Xa.isNode=Xa.isReactNative=void 0;function sV(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Xa.isReactNative=sV;function oV(){return typeof O.default<"u"&&typeof O.default.versions<"u"&&typeof O.default.versions.node<"u"}Xa.isNode=oV;function $ge(){return!sV()&&!oV()}Xa.isBrowser=$ge});var V8=L(Cb=>{"use strict";h();Object.defineProperty(Cb,"__esModule",{value:!0});var cV=(hf(),qe(df));cV.__exportStar(iV(),Cb);cV.__exportStar(aV(),Cb)});var Qr={};Zt(Qr,{isNodeJs:()=>lV});var uV,lV,fV=pe(()=>{h();uV=ge(V8());$r(Qr,ge(V8()));lV=uV.isNode});function H8(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function G8(t=6){return BigInt(H8(t))}function z8(t,e,r){return{id:r||H8(),jsonrpc:"2.0",method:t,params:e}}function Yge(t,e){return{id:t,jsonrpc:"2.0",result:e}}function j8(t,e,r){return{id:t,jsonrpc:"2.0",error:dV(e,r)}}function dV(t,e){return typeof t>"u"?Tb(Ab):(typeof t=="string"&&(t=Object.assign(Object.assign({},Tb(X0)),{message:t})),typeof e<"u"&&(t.data=e),_b(t.code)&&(t=Ib(t.code)),t)}var hV=pe(()=>{h();U8();Sb()});function Jge(t){return t.includes("*")?Nb(t):!/\W/g.test(t)}function xb(t){return t==="*"}function Nb(t){return xb(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function Xge(t){return!xb(t)&&Nb(t)&&!t.split("*")[0].trim()}function Zge(t){return!xb(t)&&Nb(t)&&!t.split("*")[1].trim()}var pV=pe(()=>{h()});var ep,Q8,Ob,tp,gV=pe(()=>{h();ep=class{},Q8=class extends ep{constructor(e){super()}},Ob=class extends ep{constructor(){super()}},tp=class extends Ob{constructor(e){super()}}});var mV=pe(()=>{h();gV()});function rme(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function yV(t,e){let r=rme(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function nme(t){return yV(t,eme)}function Pb(t){return yV(t,tme)}function K8(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var eme,tme,vV=pe(()=>{h();eme="^https?:",tme="^wss?:"});function W8(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function ime(t){return W8(t)&&"method"in t}function $8(t){return W8(t)&&(bV(t)||Rb(t))}function bV(t){return"result"in t}function Rb(t){return"error"in t}function sme(t){return"error"in t&&t.valid===!1}var wV=pe(()=>{h()});var yn={};Zt(yn,{DEFAULT_ERROR:()=>Z0,IBaseJsonRpcProvider:()=>Ob,IEvents:()=>ep,IJsonRpcConnection:()=>Q8,IJsonRpcProvider:()=>tp,INTERNAL_ERROR:()=>Ab,INVALID_PARAMS:()=>tV,INVALID_REQUEST:()=>Zk,METHOD_NOT_FOUND:()=>eV,PARSE_ERROR:()=>Xk,RESERVED_ERROR_CODES:()=>F8,SERVER_ERROR:()=>X0,SERVER_ERROR_CODE_RANGE:()=>Eb,STANDARD_ERROR_MAP:()=>Ya,formatErrorMessage:()=>dV,formatJsonRpcError:()=>j8,formatJsonRpcRequest:()=>z8,formatJsonRpcResult:()=>Yge,getBigIntRpcId:()=>G8,getError:()=>Tb,getErrorByCode:()=>Ib,isHttpUrl:()=>nme,isJsonRpcError:()=>Rb,isJsonRpcPayload:()=>W8,isJsonRpcRequest:()=>ime,isJsonRpcResponse:()=>$8,isJsonRpcResult:()=>bV,isJsonRpcValidationInvalid:()=>sme,isLocalhostUrl:()=>K8,isNodeJs:()=>lV,isReservedErrorCode:()=>_b,isServerErrorCode:()=>Qge,isValidDefaultRoute:()=>xb,isValidErrorCode:()=>rV,isValidLeadingWildcardRoute:()=>Xge,isValidRoute:()=>Jge,isValidTrailingWildcardRoute:()=>Zge,isValidWildcardRoute:()=>Nb,isWsUrl:()=>Pb,parseConnectionError:()=>q8,payloadId:()=>H8,validateJsonRpcError:()=>Kge});var rp=pe(()=>{h();Sb();U8();fV();$r(yn,Qr);hV();pV();mV();vV();wV()});var EV={};Zt(EV,{JsonRpcProvider:()=>Y8,default:()=>Y8});var AV,Y8,SV=pe(()=>{h();AV=ge(_o());rp();Y8=class extends tp{constructor(e){super(e),this.events=new AV.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(z8(e.method,e.params||[],e.id||G8().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Rb(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),$8(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}});var TV=L((EPe,_V)=>{"use strict";h();_V.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var NV={};Zt(NV,{WsConnection:()=>J8,default:()=>J8});var xV,ome,ame,IV,CV,cme,J8,OV=pe(()=>{h();xV=ge(_o());vf();rp();ome=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:TV(),ame=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",IV=t=>t.split("?")[0],CV=10,cme=ome(),J8=class{constructor(e){if(this.url=e,this.events=new xV.EventEmitter,this.registering=!1,!Pb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ns(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!Pb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=new URLSearchParams(e).get("origin"),s=(0,yn.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!K8(e)},o=new cme(e,[],s);ame()?o.onerror=c=>{let a=c;n(this.emitError(a.error))}:o.on("error",c=>{n(this.emitError(c))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Ra(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=j8(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return q8(e,IV(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>CV&&this.events.setMaxListeners(CV)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${IV(this.url)}`));return this.events.emit("register_error",r),r}}});var fH=L((np,ld)=>{h();var ume=200,c4="__lodash_hash_undefined__",kb=1,HV=2,GV=9007199254740991,Mb="[object Arguments]",t4="[object Array]",lme="[object AsyncFunction]",zV="[object Boolean]",jV="[object Date]",QV="[object Error]",KV="[object Function]",fme="[object GeneratorFunction]",Db="[object Map]",WV="[object Number]",dme="[object Null]",ud="[object Object]",PV="[object Promise]",hme="[object Proxy]",$V="[object RegExp]",Bb="[object Set]",YV="[object String]",pme="[object Symbol]",gme="[object Undefined]",r4="[object WeakMap]",JV="[object ArrayBuffer]",Lb="[object DataView]",mme="[object Float32Array]",yme="[object Float64Array]",vme="[object Int8Array]",bme="[object Int16Array]",wme="[object Int32Array]",Ame="[object Uint8Array]",Eme="[object Uint8ClampedArray]",Sme="[object Uint16Array]",_me="[object Uint32Array]",Tme=/[\\^$.*+?()[\]{}|]/g,Ime=/^\[object .+?Constructor\]$/,Cme=/^(?:0|[1-9]\d*)$/,sr={};sr[mme]=sr[yme]=sr[vme]=sr[bme]=sr[wme]=sr[Ame]=sr[Eme]=sr[Sme]=sr[_me]=!0;sr[Mb]=sr[t4]=sr[JV]=sr[zV]=sr[Lb]=sr[jV]=sr[QV]=sr[KV]=sr[Db]=sr[WV]=sr[ud]=sr[$V]=sr[Bb]=sr[YV]=sr[r4]=!1;var XV=typeof global=="object"&&global&&global.Object===Object&&global,xme=typeof self=="object"&&self&&self.Object===Object&&self,Yo=XV||xme||Function("return this")(),ZV=typeof np=="object"&&np&&!np.nodeType&&np,RV=ZV&&typeof ld=="object"&&ld&&!ld.nodeType&&ld,eH=RV&&RV.exports===ZV,X8=eH&&XV.process,MV=function(){try{return X8&&X8.binding&&X8.binding("util")}catch{}}(),DV=MV&&MV.isTypedArray;function Nme(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function s1e(t,e){var r=this.__data__,n=Hb(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Jo.prototype.clear=t1e;Jo.prototype.delete=r1e;Jo.prototype.get=n1e;Jo.prototype.has=i1e;Jo.prototype.set=s1e;function wu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ec))return!1;var u=s.get(t);if(u&&s.get(e))return u==e;var f=-1,p=!0,S=r&HV?new qb:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=GV}function uH(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function op(t){return t!=null&&typeof t=="object"}var lH=DV?Mme(DV):E1e;function L1e(t){return D1e(t)?v1e(t):S1e(t)}function F1e(){return[]}function q1e(){return!1}ld.exports=B1e});var SG=L(le=>{"use strict";h();Object.defineProperty(le,"__esModule",{value:!0});var Eu=_o(),pd=(GD(),qe(HD)),U1e=(c9(),qe(a9)),Vt=(N6(),qe(x6)),gs=$6(),Ge=yf(),u4=(vf(),qe(s9)),d4=($T(),qe(WT)),ne=J0(),k1e=(aI(),qe(oI)),V1e=(SV(),qe(EV)),zn=(rp(),qe(yn)),H1e=(OV(),qe(NV)),G1e=fH();function sw(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function z1e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var j1e=sw(Eu),Q1e=sw(U1e),zb=z1e(d4),K1e=sw(H1e),W1e=sw(G1e),T4="wc",I4=2,ow="core",ps=`${T4}@2:${ow}:`,OH={name:ow,logger:"error"},PH={database:":memory:"},RH="crypto",h4="client_ed25519_seed",MH=Ge.ONE_DAY,DH="keychain",BH="0.3",LH="messages",FH="0.3",qH=Ge.SIX_HOURS,UH="publisher",kH="irn",VH="error",C4="wss://relay.walletconnect.org",HH="relayer",jn={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},GH="_subscription",ri={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},zH=.1,$1e={database:":memory:"},jb="2.17.0",Y1e=1e4,tc={link_mode:"link_mode",relay:"relay"},jH="0.3",QH="WALLETCONNECT_CLIENT_ID",p4="WALLETCONNECT_LINK_MODE_APPS",hs={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},J1e=Ge.THIRTY_DAYS,KH="subscription",WH="0.3",$H=Ge.FIVE_SECONDS*1e3,YH="pairing",JH="0.3",X1e=Ge.THIRTY_DAYS,dd={wc_pairingDelete:{req:{ttl:Ge.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Ge.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Ge.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Ge.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Ge.ONE_DAY,prompt:!1,tag:0},res:{ttl:Ge.ONE_DAY,prompt:!1,tag:0}}},hd={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Bi={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},XH="history",ZH="0.3",eG="expirer",Li={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},tG="0.3",Z1e=Ge.ONE_DAY,rG="verify-api",eye="https://verify.walletconnect.com",nG="https://verify.walletconnect.org",lp=nG,iG=`${lp}/v3`,sG=[eye,nG],oG="echo",aG="https://echo.walletconnect.com",tye="event-client",ho={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Xo={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},rye={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},nye={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},iye={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},sye={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},cG=.1,uG="event-client",lG=86400,fG="https://pulse.walletconnect.org/batch";function oye(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,H=new Uint8Array(z);U!==k;){for(var F=N[U],V=0,q=z-1;(F!==0||V>>0,H[q]=F%c>>>0,F=F/c>>>0;if(F!==0)throw new Error("Non-zero carry");D=V,U++}for(var C=z-D;C!==z&&H[C]===0;)C++;for(var B=a.repeat(R);C>>0,z=new Uint8Array(k);N[R];){var H=r[N.charCodeAt(R)];if(H===255)return;for(var F=0,V=k-1;(H!==0||F>>0,z[V]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");U=F,R++}if(N[R]!==" "){for(var q=k-U;q!==k&&z[q]===0;)q++;for(var C=new Uint8Array(D+(k-q)),B=D;q!==k;)C[B++]=z[q++];return C}}}function I(N){var R=S(N);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:S,decode:I}}var aye=oye,cye=aye,dG=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},uye=t=>new TextEncoder().encode(t),lye=t=>new TextDecoder().decode(t),g4=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},m4=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hG(this,e)}},y4=class{constructor(e){this.decoders=e}or(e){return hG(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},hG=(t,e)=>new y4({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),v4=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new g4(e,r,n),this.decoder=new m4(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},aw=({name:t,prefix:e,encode:r,decode:n})=>new v4(t,e,r,n),fp=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=cye(r,e);return aw({prefix:t,name:e,encode:n,decode:s=>dG(i(s))})},fye=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(c-=8,o[u++]=255&a>>c)}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return o},dye=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&c>>o];if(o&&(s+=e[i&c<aw({prefix:e,name:t,encode(i){return dye(i,n,r)},decode(i){return fye(i,n,r,t)}}),hye=aw({prefix:"\0",name:"identity",encode:t=>lye(t),decode:t=>uye(t)}),pye=Object.freeze({__proto__:null,identity:hye}),gye=en({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),mye=Object.freeze({__proto__:null,base2:gye}),yye=en({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),vye=Object.freeze({__proto__:null,base8:yye}),bye=fp({prefix:"9",name:"base10",alphabet:"0123456789"}),wye=Object.freeze({__proto__:null,base10:bye}),Aye=en({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Eye=en({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Sye=Object.freeze({__proto__:null,base16:Aye,base16upper:Eye}),_ye=en({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Tye=en({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Iye=en({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cye=en({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),xye=en({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Nye=en({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Oye=en({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Pye=en({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Rye=en({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Mye=Object.freeze({__proto__:null,base32:_ye,base32upper:Tye,base32pad:Iye,base32padupper:Cye,base32hex:xye,base32hexupper:Nye,base32hexpad:Oye,base32hexpadupper:Pye,base32z:Rye}),Dye=fp({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bye=fp({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Lye=Object.freeze({__proto__:null,base36:Dye,base36upper:Bye}),Fye=fp({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),qye=fp({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Uye=Object.freeze({__proto__:null,base58btc:Fye,base58flickr:qye}),kye=en({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Vye=en({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hye=en({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gye=en({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),zye=Object.freeze({__proto__:null,base64:kye,base64pad:Vye,base64url:Hye,base64urlpad:Gye}),pG=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}"),jye=pG.reduce((t,e,r)=>(t[r]=e,t),[]),Qye=pG.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Kye(t){return t.reduce((e,r)=>(e+=jye[r],e),"")}function Wye(t){let e=[];for(let r of t){let n=Qye[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var $ye=aw({prefix:"\u{1F680}",name:"base256emoji",encode:Kye,decode:Wye}),Yye=Object.freeze({__proto__:null,base256emoji:$ye}),Jye=gG,dH=128,Xye=127,Zye=~Xye,eve=Math.pow(2,31);function gG(t,e,r){e=e||[],r=r||0;for(var n=r;t>=eve;)e[r++]=t&255|dH,t/=128;for(;t&Zye;)e[r++]=t&255|dH,t>>>=7;return e[r]=t|0,gG.bytes=r-n+1,e}var tve=b4,rve=128,hH=127;function b4(t,n){var r=0,n=n||0,i=0,s=n,o,c=t.length;do{if(s>=c)throw b4.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&hH)<=rve);return b4.bytes=s-n,r}var nve=Math.pow(2,7),ive=Math.pow(2,14),sve=Math.pow(2,21),ove=Math.pow(2,28),ave=Math.pow(2,35),cve=Math.pow(2,42),uve=Math.pow(2,49),lve=Math.pow(2,56),fve=Math.pow(2,63),dve=function(t){return t(mG.encode(t,e,r),e),gH=t=>mG.encodingLength(t),w4=(t,e)=>{let r=e.byteLength,n=gH(t),i=n+gH(r),s=new Uint8Array(i+r);return pH(t,s,0),pH(r,s,n),s.set(e,i),new A4(t,r,e,s)},A4=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},yG=({name:t,code:e,encode:r})=>new E4(t,e,r),E4=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?w4(this.code,r):r.then(n=>w4(this.code,n))}else throw Error("Unknown type, must be binary type")}},vG=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),pve=yG({name:"sha2-256",code:18,encode:vG("SHA-256")}),gve=yG({name:"sha2-512",code:19,encode:vG("SHA-512")}),mve=Object.freeze({__proto__:null,sha256:pve,sha512:gve}),bG=0,yve="identity",wG=dG,vve=t=>w4(bG,wG(t)),bve={code:bG,name:yve,encode:wG,digest:vve},wve=Object.freeze({__proto__:null,identity:bve});new TextEncoder,new TextDecoder;var mH={...pye,...mye,...vye,...wye,...Sye,...Mye,...Lye,...Uye,...zye,...Yye};({...mve,...wve});function Ave(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function AG(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var yH=AG("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),l4=AG("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ave(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Vt.generateChildLogger(r,this.name)}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Kb=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=RH,this.randomSessionIdentifier=ne.generateRandomBytes32(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=zb.generateKeyPair(i);return zb.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ne.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=zb.generateKeyPair(s),c=this.randomSessionIdentifier,a=MH;return await zb.signJWT(c,i,a,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let c=this.getPrivateKey(i),a=ne.deriveSymKey(c,s);return this.setSymKey(a,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ne.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let c=ne.validateEncoding(o),a=u4.safeJsonStringify(s);if(ne.isTypeTwoEnvelope(c))return ne.encodeTypeTwoEnvelope(a,o?.encoding);if(ne.isTypeOneEnvelope(c)){let S=c.senderPublicKey,I=c.receiverPublicKey;i=await this.generateSharedKey(S,I)}let u=this.getSymKey(i),{type:f,senderPublicKey:p}=c;return ne.encrypt({type:f,symKey:u,message:a,senderPublicKey:p,encoding:o?.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();let c=ne.validateDecoding(s,o);if(ne.isTypeTwoEnvelope(c)){let a=ne.decodeTypeTwoEnvelope(s,o?.encoding);return u4.safeJsonParse(a)}if(ne.isTypeOneEnvelope(c)){let a=c.receiverPublicKey,u=c.senderPublicKey;i=await this.generateSharedKey(a,u)}try{let a=this.getSymKey(i),u=ne.decrypt({symKey:a,encoded:s,encoding:o?.encoding});return u4.safeJsonParse(u)}catch(a){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(a)}},this.getPayloadType=(i,s=ne.BASE64)=>{let o=ne.deserialize({encoded:i,encoding:s});return ne.decodeTypeByte(o.type)},this.getPayloadSenderPublicKey=(i,s=ne.BASE64)=>{let o=ne.deserialize({encoded:i,encoding:s});return o.senderPublicKey?k1e.toString(o.senderPublicKey,ne.BASE16):void 0},this.core=e,this.logger=Vt.generateChildLogger(r,this.name),this.keychain=n||new Qb(this.core,this.logger)}get context(){return Vt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(h4)}catch{e=ne.generateRandomBytes32(),await this.keychain.set(h4,e)}return Sve(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Wb=class extends gs.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=LH,this.version=FH,this.initialized=!1,this.storagePrefix=ps,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ne.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ne.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Vt.generateChildLogger(e,this.name),this.core=r}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},S4=class extends gs.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Eu.EventEmitter,this.name=UH,this.queue=new Map,this.publishTimeout=Ge.toMiliseconds(Ge.ONE_MINUTE),this.failedPublishTimeout=Ge.toMiliseconds(Ge.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});let c=s?.ttl||qH,a=ne.getRelayProtocolName(s),u=s?.prompt||!1,f=s?.tag||0,p=s?.id||zn.getBigIntRpcId().toString(),S={topic:n,message:i,opts:{ttl:c,relay:a,prompt:u,tag:f,id:p,attestation:s?.attestation}},I=`Failed to publish payload, please try again. id:${p} tag:${f}`,N=Date.now(),R,D=1;try{for(;R===void 0;){if(Date.now()-N>this.publishTimeout)throw new Error(I);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),R=await await ne.createExpiringPromise(this.rpcPublish(n,i,c,a,u,f,p,s?.attestation).catch(U=>this.logger.warn(U)),this.publishTimeout,I),D++,R||await new Promise(U=>setTimeout(U,this.failedPublishTimeout))}this.relayer.events.emit(jn.publish,S),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(U){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(U),(o=s?.internal)!=null&&o.throwOnFailedPublish)throw U;this.queue.set(p,S)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Vt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Vt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,c,a){var u,f,p,S;let I={method:ne.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:a},id:c};return ne.isUndefined((u=I.params)==null?void 0:u.prompt)&&((f=I.params)==null||delete f.prompt),ne.isUndefined((p=I.params)==null?void 0:p.tag)&&((S=I.params)==null||delete S.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:I}),this.relayer.request(I)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(jn.connection_stalled);return}this.checkQueue()}),this.relayer.on(jn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},_4=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},_ve=Object.defineProperty,Tve=Object.defineProperties,Ive=Object.getOwnPropertyDescriptors,vH=Object.getOwnPropertySymbols,Cve=Object.prototype.hasOwnProperty,xve=Object.prototype.propertyIsEnumerable,bH=(t,e,r)=>e in t?_ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cp=(t,e)=>{for(var r in e||(e={}))Cve.call(e,r)&&bH(t,r,e[r]);if(vH)for(var r of vH(e))xve.call(e,r)&&bH(t,r,e[r]);return t},f4=(t,e)=>Tve(t,Ive(e)),$b=class extends gs.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new _4,this.events=new Eu.EventEmitter,this.name=KH,this.version=WH,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ps,this.subscribeTimeout=Ge.toMiliseconds(Ge.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ne.getRelayProtocolName(i),o={topic:n,relay:s,transportType:i?.transportType};this.pending.set(n,o);let c=await this.rpcSubscribe(n,s,i?.transportType);return typeof c=="string"&&(this.onSubscribe(c,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),c}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;let i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{let c=new Ge.Watch;c.start(i);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),c.stop(i),s(!0)),c.elapsed(i)>=$H&&(clearInterval(a),c.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Vt.generateChildLogger(r,this.name),this.clientId=""}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ne.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ne.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n=tc.relay){n===tc.relay&&await this.restartToComplete();let i={method:ne.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{let s=ne.hashMessage(e+this.clientId);return n===tc.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch(o=>this.logger.warn(o))},Ge.toMiliseconds(Ge.ONE_SECOND)),s):await await ne.createExpiringPromise(this.relayer.request(i).catch(o=>this.logger.warn(o)),this.subscribeTimeout)?s:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(jn.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ne.createExpiringPromise(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(jn.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ne.createExpiringPromise(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(jn.connection_stalled)}return i}rpcUnsubscribe(e,r,n){let i={method:ne.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,f4(cp({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,cp({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,cp({},r)),this.topicMap.set(r.topic,e),this.events.emit(hs.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(hs.deleted,f4(cp({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(hs.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ne.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>f4(cp({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(hs.created,async e=>{let r=hs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(hs.deleted,async e=>{let r=hs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},Nve=Object.defineProperty,wH=Object.getOwnPropertySymbols,Ove=Object.prototype.hasOwnProperty,Pve=Object.prototype.propertyIsEnumerable,AH=(t,e,r)=>e in t?Nve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rve=(t,e)=>{for(var r in e||(e={}))Ove.call(e,r)&&AH(t,r,e[r]);if(wH)for(var r of wH(e))Pve.call(e,r)&&AH(t,r,e[r]);return t},Yb=class extends gs.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Eu.EventEmitter,this.name=HH,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Ge.toMiliseconds(Ge.THIRTY_SECONDS+Ge.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");let s=r.id||zn.getBigIntRpcId().toString();await this.toEstablishConnection();try{let o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");let c=await new Promise(async(a,u)=>{let f=()=>{u(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(ri.disconnect,f);let p=await o;this.provider.off(ri.disconnect,f),a(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(ne.isNode())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(jn.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(jn.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(ri.payload,this.onPayloadHandler),this.provider.on(ri.connect,this.onConnectHandler),this.provider.on(ri.disconnect,this.onDisconnectHandler),this.provider.on(ri.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Vt.generateChildLogger(e.logger,this.name):Vt.pino(Vt.getDefaultLoggerOptions({level:e.logger||VH})),this.messages=new Wb(this.logger,e.core),this.subscriber=new $b(this,this.logger),this.publisher=new S4(this,this.logger),this.relayUrl=e?.relayUrl||C4,this.projectId=e.projectId,this.bundleId=ne.getBundleId(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Vt.getLoggerContext(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:tc.relay})}async subscribe(e,r){var n;this.isInitialized(),r?.transportType==="relay"&&await this.toEstablishConnection();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",s,o=c=>{c.topic===e&&(this.subscriber.off(hs.created,o),s())};return await Promise.all([new Promise(c=>{s=c,this.subscriber.on(hs.created,o)}),new Promise(async c=>{i=await this.subscriber.subscribe(e,r)||i,c()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await ne.createExpiringPromise(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{let i=()=>{this.provider.off(ri.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(ri.disconnect,i),await ne.createExpiringPromise(this.provider.connect(),Ge.toMiliseconds(Ge.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);let n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ne.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}let r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(let n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){let{topic:n}=e;if(!r.sessionExists){let i=ne.calcExpiry(Ge.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(jn.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(ne.isNode())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new V1e.JsonRpcProvider(new K1e.default(ne.formatRelayRpcUrl({sdkVersion:jb,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),zn.isJsonRpcRequest(e)){if(!e.method.endsWith(GH))return;let r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,c={topic:n,message:i,publishedAt:s,transportType:tc.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Rve({type:"event",event:r.id},c)),this.events.emit(r.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else zn.isJsonRpcResponse(e)&&this.events.emit(jn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(jn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=zn.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(ri.payload,this.onPayloadHandler),this.provider.off(ri.connect,this.onConnectHandler),this.provider.off(ri.disconnect,this.onDisconnectHandler),this.provider.off(ri.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await ne.isOnline();ne.subscribeToNetworkChange(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(jn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Ge.toMiliseconds(zH))))}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}},Mve=Object.defineProperty,EH=Object.getOwnPropertySymbols,Dve=Object.prototype.hasOwnProperty,Bve=Object.prototype.propertyIsEnumerable,SH=(t,e,r)=>e in t?Mve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_H=(t,e)=>{for(var r in e||(e={}))Dve.call(e,r)&&SH(t,r,e[r]);if(EH)for(var r of EH(e))Bve.call(e,r)&&SH(t,r,e[r]);return t},Jb=class extends gs.IStore{constructor(e,r,n,i=ps,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=jH,this.cached=[],this.initialized=!1,this.storagePrefix=ps,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ne.isUndefined(o)?this.map.set(this.getKey(o),o):ne.isProposalStruct(o)?this.map.set(o.id,o):ne.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),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(c=>Object.keys(o).every(a=>W1e.default(c[a],o[a]))):this.values),this.update=async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});let a=_H(_H({},this.getData(o)),c);this.map.set(o,a),await this.persist()},this.delete=async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=Vt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Xb=class{constructor(e,r){this.core=e,this.logger=r,this.name=YH,this.version=JH,this.events=new j1e.default,this.initialized=!1,this.storagePrefix=ps,this.ignoredPayloadTypes=[ne.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();let i=ne.generateRandomBytes32(),s=await this.core.crypto.setSymKey(i),o=ne.calcExpiry(Ge.FIVE_MINUTES),c={protocol:kH},a={topic:s,expiry:o,relay:c,active:!1,methods:n?.methods},u=ne.formatUri({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:c,expiryTimestamp:o,methods:n?.methods});return this.events.emit(hd.create,a),this.core.expirer.set(s,o),await this.pairings.set(s,a),await this.core.relayer.subscribe(s,{transportType:n?.transportType}),{topic:s,uri:u}},this.pair=async n=>{this.isInitialized();let i=this.core.eventClient.createEvent({properties:{topic:n?.uri,trace:[ho.pairing_started]}});this.isValidPair(n,i);let{topic:s,symKey:o,relay:c,expiryTimestamp:a,methods:u}=ne.parseUri(n.uri);i.props.properties.topic=s,i.addTrace(ho.pairing_uri_validation_success),i.addTrace(ho.pairing_uri_not_expired);let f;if(this.pairings.keys.includes(s)){if(f=this.pairings.get(s),i.addTrace(ho.existing_pairing),f.active)throw i.setError(Xo.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(ho.pairing_not_expired)}let p=a||ne.calcExpiry(Ge.FIVE_MINUTES),S={topic:s,relay:c,expiry:p,active:!1,methods:u};this.core.expirer.set(s,p),await this.pairings.set(s,S),i.addTrace(ho.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(hd.create,S),i.addTrace(ho.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(ho.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Xo.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(I){throw i.setError(Xo.subscribe_pairing_topic_failure),I}return i.addTrace(ho.subscribe_pairing_topic_success),S},this.activate=async({topic:n})=>{this.isInitialized();let i=ne.calcExpiry(Ge.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:c,reject:a}=ne.createDelayedPromise();this.events.once(ne.engineEvent("pairing_ping",s),({error:u})=>{u?a(u):c()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ne.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();let{topic:i,relay:s,expiry:o,methods:c}=n,a=this.core.crypto.keychain.get(i);return ne.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:a,relay:s,expiryTimestamp:o,methods:c})},this.sendRequest=async(n,i,s)=>{let o=zn.formatJsonRpcRequest(i,s),c=await this.core.crypto.encode(n,o),a=dd[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,a),o.id},this.sendResult=async(n,i,s)=>{let o=zn.formatJsonRpcResult(n,s),c=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),u=dd[a.request.method].res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=zn.formatJsonRpcError(n,s),c=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),u=dd[a.request.method]?dd[a.request.method].res:dd.unregistered_method.res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ne.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ne.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(hd.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{zn.isJsonRpcResult(i)?this.events.emit(ne.engineEvent("pairing_ping",s),{}):zn.isJsonRpcError(i)&&this.events.emit(ne.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(hd.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let c=ne.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ne.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!ne.isValidParams(n)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Xo.malformed_pairing_uri),new Error(c)}if(!ne.isValidUrl(n.uri)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Xo.malformed_pairing_uri),new Error(c)}let o=ne.parseUri(n?.uri);if(!((s=o?.relay)!=null&&s.protocol)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Xo.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Xo.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&Ge.toMiliseconds(o?.expiryTimestamp){if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ne.isValidString(n,!1)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ne.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ne.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ne.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Vt.generateChildLogger(r,this.name),this.pairings=new Jb(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Vt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(jn.message,async e=>{let{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===tc.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let s=await this.core.crypto.decode(r,n);try{zn.isJsonRpcRequest(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):zn.isJsonRpcResponse(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Li.expired,async e=>{let{topic:r}=ne.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(hd.expire,{topic:r}))})}},Zb=class extends gs.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Eu.EventEmitter,this.name=XH,this.version=ZH,this.cached=[],this.initialized=!1,this.storagePrefix=ps,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ne.calcExpiry(Ge.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Bi.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=zn.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Bi.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Bi.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Vt.generateChildLogger(r,this.name)}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:zn.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Bi.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Bi.created,e=>{let r=Bi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Bi.updated,e=>{let r=Bi.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Bi.deleted,e=>{let r=Bi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{Ge.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Bi.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ew=class extends gs.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Eu.EventEmitter,this.name=eG,this.version=tG,this.cached=[],this.initialized=!1,this.storagePrefix=ps,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Li.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Li.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Vt.generateChildLogger(r,this.name)}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ne.formatTopicTarget(e);if(typeof e=="number")return ne.formatIdTarget(e);let{message:r}=ne.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Li.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Ge.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Li.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Li.created,e=>{let r=Li.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Li.expired,e=>{let r=Li.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Li.deleted,e=>{let r=Li.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},or={};Object.defineProperty(or,"__esModule",{value:!0}),or.getLocalStorage=or.getLocalStorageOrThrow=or.getCrypto=or.getCryptoOrThrow=or.getLocation=or.getLocationOrThrow=or.getNavigator=or.getNavigatorOrThrow=EG=or.getDocument=or.getDocumentOrThrow=or.getFromWindowOrThrow=or.getFromWindow=void 0;function Su(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}or.getFromWindow=Su;function gd(t){let e=Su(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}or.getFromWindowOrThrow=gd;function Lve(){return gd("document")}or.getDocumentOrThrow=Lve;function Fve(){return Su("document")}var EG=or.getDocument=Fve;function qve(){return gd("navigator")}or.getNavigatorOrThrow=qve;function Uve(){return Su("navigator")}or.getNavigator=Uve;function kve(){return gd("location")}or.getLocationOrThrow=kve;function Vve(){return Su("location")}or.getLocation=Vve;function Hve(){return gd("crypto")}or.getCryptoOrThrow=Hve;function Gve(){return Su("crypto")}or.getCrypto=Gve;function zve(){return gd("localStorage")}or.getLocalStorageOrThrow=zve;function jve(){return Su("localStorage")}or.getLocalStorage=jve;var tw=class extends gs.IVerify{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=rG,this.verifyUrlV3=iG,this.storagePrefix=ps,this.version=I4,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Ge.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!ne.isBrowser()||this.isDevEnv)return;let s=window.location.origin,{id:o,decryptedId:c}=i,a=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{let u=EG(),f=this.startAbortTimer(Ge.ONE_SECOND*5),p=await new Promise((S,I)=>{let N=()=>{window.removeEventListener("message",D),u.body.removeChild(R),I("attestation aborted")};this.abortController.signal.addEventListener("abort",N);let R=u.createElement("iframe");R.src=a,R.style.display="none",R.addEventListener("error",N,{signal:this.abortController.signal});let D=U=>{if(U.data&&typeof U.data=="string")try{let k=JSON.parse(U.data);if(k.type==="verify_attestation"){if(d4.decodeJWT(k.attestation).payload.id!==o)return;clearInterval(f),u.body.removeChild(R),this.abortController.signal.removeEventListener("abort",N),window.removeEventListener("message",D),S(k.attestation===null?"":k.attestation)}}catch(k){this.logger.warn(k)}};u.body.appendChild(R),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(u){this.logger.warn(u)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";let{attestationId:s,hash:o,encryptedId:c}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(d4.decodeJWT(s).payload.id!==c)return;let u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;let a=this.getVerifyUrl(i?.verifyUrl);return this.fetchAttestation(o,a)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);let o=this.startAbortTimer(Ge.ONE_SECOND*5),c=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0},this.getVerifyUrl=i=>{let s=i||lp;return sG.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${lp}`),s=lp),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let i=this.startAbortTimer(Ge.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{let s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}let o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{let o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});let i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{let o=ne.verifyP256Jwt(i,s.publicKey),c={hasExpired:Ge.toMiliseconds(o.exp)this.abortController.abort(),Ge.toMiliseconds(e))}},rw=class extends gs.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=oG,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:c=!1}=n,a=`${aG}/${this.projectId}/clients`;await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:c})})},this.logger=Vt.generateChildLogger(r,this.context)}},Qve=Object.defineProperty,TH=Object.getOwnPropertySymbols,Kve=Object.prototype.hasOwnProperty,Wve=Object.prototype.propertyIsEnumerable,IH=(t,e,r)=>e in t?Qve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,up=(t,e)=>{for(var r in e||(e={}))Kve.call(e,r)&&IH(t,r,e[r]);if(TH)for(var r of TH(e))Wve.call(e,r)&&IH(t,r,e[r]);return t},nw=class extends gs.IEventClient{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=uG,this.storagePrefix=ps,this.storageVersion=cG,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!ne.isTestRun())try{let i={eventId:ne.uuidv4(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:ne.formatUA(this.core.relayer.protocol,this.core.relayer.version,jb)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{let{event:s="ERROR",type:o="",properties:{topic:c,trace:a}}=i,u=ne.uuidv4(),f=this.core.projectId||"",p=Date.now(),S=up({eventId:u,timestamp:p,props:{event:s,type:o,properties:{topic:c,trace:a}},bundleId:f,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,S),this.shouldPersist=!0),S},this.getEvent=i=>{let{eventId:s,topic:o}=i;if(s)return this.events.get(s);let c=Array.from(this.events.values()).find(a=>a.props.properties.topic===o);if(c)return up(up({},c),this.setMethods(c.eventId))},this.deleteEvent=i=>{let{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{Ge.fromMiliseconds(Date.now())-Ge.fromMiliseconds(i.timestamp)>lG&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{let o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{let o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{let i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,up(up({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;let i=[];for(let[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(let s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{let s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${fG}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${jb}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>ne.getAppMetadata().url,this.logger=Vt.generateChildLogger(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}},$ve=Object.defineProperty,CH=Object.getOwnPropertySymbols,Yve=Object.prototype.hasOwnProperty,Jve=Object.prototype.propertyIsEnumerable,xH=(t,e,r)=>e in t?$ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,NH=(t,e)=>{for(var r in e||(e={}))Yve.call(e,r)&&xH(t,r,e[r]);if(CH)for(var r of CH(e))Jve.call(e,r)&&xH(t,r,e[r]);return t},iw=class t extends gs.ICore{constructor(e){var r;super(e),this.protocol=T4,this.version=I4,this.name=ow,this.events=new Eu.EventEmitter,this.initialized=!1,this.on=(o,c)=>this.events.on(o,c),this.once=(o,c)=>this.events.once(o,c),this.off=(o,c)=>this.events.off(o,c),this.removeListener=(o,c)=>this.events.removeListener(o,c),this.dispatchEnvelope=({topic:o,message:c,sessionExists:a})=>{if(!o||!c)return;let u={topic:o,message:c,publishedAt:Date.now(),transportType:tc.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:a})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||C4,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let n=Vt.getDefaultLoggerOptions({level:typeof e?.logger=="string"&&e.logger?e.logger:OH.logger}),{logger:i,chunkLoggerController:s}=Vt.generatePlatformLogger({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,c;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Vt.generateChildLogger(i,this.name),this.heartbeat=new pd.HeartBeat,this.crypto=new Kb(this,this.logger,e?.keychain),this.history=new Zb(this,this.logger),this.expirer=new ew(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Q1e.default(NH(NH({},PH),e?.storageOptions)),this.relayer=new Yb({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Xb(this,this.logger),this.verify=new tw(this,this.logger,this.storage),this.echoClient=new rw(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new nw(this,this.logger,e?.telemetryEnabled)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(QH,n),r}get context(){return Vt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(p4,this.linkModeSupportedApps))}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.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(p4)||[],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}}},Xve=iw;le.CORE_CONTEXT=ow,le.CORE_DEFAULT=OH,le.CORE_PROTOCOL=T4,le.CORE_STORAGE_OPTIONS=PH,le.CORE_STORAGE_PREFIX=ps,le.CORE_VERSION=I4,le.CRYPTO_CLIENT_SEED=h4,le.CRYPTO_CONTEXT=RH,le.CRYPTO_JWT_TTL=MH,le.Core=Xve,le.Crypto=Kb,le.ECHO_CONTEXT=oG,le.ECHO_URL=aG,le.EVENTS_CLIENT_API_URL=fG,le.EVENTS_STORAGE_CLEANUP_INTERVAL=lG,le.EVENTS_STORAGE_CONTEXT=uG,le.EVENTS_STORAGE_VERSION=cG,le.EVENT_CLIENT_AUTHENTICATE_ERRORS=sye,le.EVENT_CLIENT_AUTHENTICATE_TRACES=iye,le.EVENT_CLIENT_CONTEXT=tye,le.EVENT_CLIENT_PAIRING_ERRORS=Xo,le.EVENT_CLIENT_PAIRING_TRACES=ho,le.EVENT_CLIENT_SESSION_ERRORS=nye,le.EVENT_CLIENT_SESSION_TRACES=rye,le.EXPIRER_CONTEXT=eG,le.EXPIRER_DEFAULT_TTL=Z1e,le.EXPIRER_EVENTS=Li,le.EXPIRER_STORAGE_VERSION=tG,le.EchoClient=rw,le.EventClient=nw,le.Expirer=ew,le.HISTORY_CONTEXT=XH,le.HISTORY_EVENTS=Bi,le.HISTORY_STORAGE_VERSION=ZH,le.JsonRpcHistory=Zb,le.KEYCHAIN_CONTEXT=DH,le.KEYCHAIN_STORAGE_VERSION=BH,le.KeyChain=Qb,le.MESSAGES_CONTEXT=LH,le.MESSAGES_STORAGE_VERSION=FH,le.MessageTracker=Wb,le.PAIRING_CONTEXT=YH,le.PAIRING_DEFAULT_TTL=X1e,le.PAIRING_EVENTS=hd,le.PAIRING_RPC_OPTS=dd,le.PAIRING_STORAGE_VERSION=JH,le.PENDING_SUB_RESOLUTION_TIMEOUT=$H,le.PUBLISHER_CONTEXT=UH,le.PUBLISHER_DEFAULT_TTL=qH,le.Pairing=Xb,le.RELAYER_CONTEXT=HH,le.RELAYER_DEFAULT_LOGGER=VH,le.RELAYER_DEFAULT_PROTOCOL=kH,le.RELAYER_DEFAULT_RELAY_URL=C4,le.RELAYER_EVENTS=jn,le.RELAYER_PROVIDER_EVENTS=ri,le.RELAYER_RECONNECT_TIMEOUT=zH,le.RELAYER_SDK_VERSION=jb,le.RELAYER_STORAGE_OPTIONS=$1e,le.RELAYER_SUBSCRIBER_SUFFIX=GH,le.RELAYER_TRANSPORT_CUTOFF=Y1e,le.Relayer=Yb,le.STORE_STORAGE_VERSION=jH,le.SUBSCRIBER_CONTEXT=KH,le.SUBSCRIBER_DEFAULT_TTL=J1e,le.SUBSCRIBER_EVENTS=hs,le.SUBSCRIBER_STORAGE_VERSION=WH,le.Store=Jb,le.Subscriber=$b,le.TRANSPORT_TYPES=tc,le.TRUSTED_VERIFY_URLS=sG,le.VERIFY_CONTEXT=rG,le.VERIFY_SERVER=lp,le.VERIFY_SERVER_V3=iG,le.Verify=tw,le.WALLETCONNECT_CLIENT_ID=QH,le.WALLETCONNECT_LINK_MODE_APPS=p4,le.default=iw});var UG=L(Xe=>{"use strict";h();Object.defineProperty(Xe,"__esModule",{value:!0});var he=SG(),cw=(N6(),qe(x6)),IG=$6(),j=J0(),CG=_o(),Ht=yf(),tt=(rp(),qe(yn));function Zve(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ebe=Zve(CG),L4="wc",F4=2,q4="client",hw=`${L4}@${F4}:${q4}:`,uw={name:q4,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},tbe={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",session_authenticate:"session_authenticate",session_request_expire:"session_request_expire"},rbe={database:":memory:"},x4="WALLETCONNECT_DEEPLINK_CHOICE",nbe={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},ibe="history",sbe="0.3",xG="proposal",obe=Ht.THIRTY_DAYS,NG="Proposal expired",OG="session",_u=Ht.SEVEN_DAYS,PG="engine",Br={wc_sessionPropose:{req:{ttl:Ht.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Ht.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Ht.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Ht.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Ht.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1119}}},lw={min:Ht.FIVE_MINUTES,max:Ht.SEVEN_DAYS},ys={idle:"IDLE",active:"ACTIVE"},RG="request",MG=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],DG="wc",abe=1.5,BG="auth",LG="authKeys",FG="pairingTopics",qG="requests",hp=`${DG}@${1.5}:${BG}:`,dp=`${hp}:PUB_KEY`,cbe=Object.defineProperty,ube=Object.defineProperties,lbe=Object.getOwnPropertyDescriptors,_G=Object.getOwnPropertySymbols,fbe=Object.prototype.hasOwnProperty,dbe=Object.prototype.propertyIsEnumerable,TG=(t,e,r)=>e in t?cbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,br=(t,e)=>{for(var r in e||(e={}))fbe.call(e,r)&&TG(t,r,e[r]);if(_G)for(var r of _G(e))dbe.call(e,r)&&TG(t,r,e[r]);return t},ms=(t,e)=>ube(t,lbe(e)),N4=class extends IG.IEngine{constructor(e){super(e),this.name=PG,this.events=new ebe.default,this.initialized=!1,this.requestQueue={state:ys.idle,queue:[]},this.sessionRequestQueue={state:ys.idle,queue:[]},this.requestQueueDelay=Ht.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Br)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Ht.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let n=ms(br({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,relays:a}=n,u=i,f,p=!1;try{u&&(p=this.client.core.pairing.pairings.get(u).active)}catch(H){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),H}if(!u||!p){let{topic:H,uri:F}=await this.client.core.pairing.create();u=H,f=F}if(!u){let{message:H}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(H)}let S=await this.client.core.crypto.generateKeyPair(),I=Br.wc_sessionPropose.req.ttl||Ht.FIVE_MINUTES,N=j.calcExpiry(I),R=br({requiredNamespaces:s,optionalNamespaces:o,relays:a??[{protocol:he.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:S,metadata:this.client.metadata},expiryTimestamp:N,pairingTopic:u},c&&{sessionProperties:c}),{reject:D,resolve:U,done:k}=j.createDelayedPromise(I,NG);this.events.once(j.engineEvent("session_connect"),async({error:H,session:F})=>{if(H)D(H);else if(F){F.self.publicKey=S;let V=ms(br({},F),{pairingTopic:R.pairingTopic,requiredNamespaces:R.requiredNamespaces,optionalNamespaces:R.optionalNamespaces,transportType:he.TRANSPORT_TYPES.relay});await this.client.session.set(F.topic,V),await this.setExpiry(F.topic,F.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:F.peer.metadata}),this.cleanupDuplicatePairings(V),U(V)}});let z=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:R,throwOnFailedPublish:!0});return await this.setProposal(z,br({id:z},R)),{uri:f,approval:k}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;let o=this.client.core.eventClient.createEvent({properties:{topic:(n=r?.id)==null?void 0:n.toString(),trace:[he.EVENT_CLIENT_SESSION_TRACES.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(C){throw o.setError(he.EVENT_CLIENT_SESSION_ERRORS.no_internet_connection),C}try{await this.isValidProposalId(r?.id)}catch(C){throw this.client.logger.error(`approve() -> proposal.get(${r?.id}) failed`),o.setError(he.EVENT_CLIENT_SESSION_ERRORS.proposal_not_found),C}try{await this.isValidApprove(r)}catch(C){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(he.EVENT_CLIENT_SESSION_ERRORS.session_approve_namespace_validation_failure),C}let{id:c,relayProtocol:a,namespaces:u,sessionProperties:f,sessionConfig:p}=r,S=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});let{pairingTopic:I,proposer:N,requiredNamespaces:R,optionalNamespaces:D}=S,U=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:I});U||(U=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:he.EVENT_CLIENT_SESSION_TRACES.session_approve_started,properties:{topic:I,trace:[he.EVENT_CLIENT_SESSION_TRACES.session_approve_started,he.EVENT_CLIENT_SESSION_TRACES.session_namespaces_validation_success]}}));let k=await this.client.core.crypto.generateKeyPair(),z=N.publicKey,H=await this.client.core.crypto.generateSharedKey(k,z),F=br(br({relay:{protocol:a??"irn"},namespaces:u,controller:{publicKey:k,metadata:this.client.metadata},expiry:j.calcExpiry(_u)},f&&{sessionProperties:f}),p&&{sessionConfig:p}),V=he.TRANSPORT_TYPES.relay;U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.subscribing_session_topic);try{await this.client.core.relayer.subscribe(H,{transportType:V})}catch(C){throw U.setError(he.EVENT_CLIENT_SESSION_ERRORS.subscribe_session_topic_failure),C}U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.subscribe_session_topic_success);let q=ms(br({},F),{topic:H,requiredNamespaces:R,optionalNamespaces:D,pairingTopic:I,acknowledged:!1,self:F.controller,peer:{publicKey:N.publicKey,metadata:N.metadata},controller:k,transportType:he.TRANSPORT_TYPES.relay});await this.client.session.set(H,q),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.store_session);try{U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.publishing_session_settle),await this.sendRequest({topic:H,method:"wc_sessionSettle",params:F,throwOnFailedPublish:!0}).catch(C=>{throw U?.setError(he.EVENT_CLIENT_SESSION_ERRORS.session_settle_publish_failure),C}),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.session_settle_publish_success),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.publishing_session_approve),await this.sendResult({id:c,topic:I,result:{relay:{protocol:a??"irn"},responderPublicKey:k},throwOnFailedPublish:!0}).catch(C=>{throw U?.setError(he.EVENT_CLIENT_SESSION_ERRORS.session_approve_publish_failure),C}),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.session_approve_publish_success)}catch(C){throw this.client.logger.error(C),this.client.session.delete(H,j.getSdkError("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(H),C}return this.client.core.eventClient.deleteEvent({eventId:U.eventId}),await this.client.core.pairing.updateMetadata({topic:I,metadata:N.metadata}),await this.client.proposal.delete(c,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:I}),await this.setExpiry(H,j.calcExpiry(_u)),{topic:H,acknowledged:()=>Promise.resolve(this.client.session.get(H))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}let{id:n,reason:i}=r,s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Br.wc_sessionPropose.reject}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}let{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:c}=j.createDelayedPromise(),a=tt.payloadId(),u=tt.getBigIntRpcId().toString(),f=this.client.session.get(n).namespaces;return this.events.once(j.engineEvent("session_update",a),({error:p})=>{p?c(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:u}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:f}),c(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(a){throw this.client.logger.error("extend() -> isValidExtend() failed"),a}let{topic:n}=r,i=tt.payloadId(),{done:s,resolve:o,reject:c}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:a})=>{a?c(a):o()}),await this.setExpiry(n,j.calcExpiry(_u)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(a=>{c(a)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(N){throw this.client.logger.error("request() -> isValidRequest() failed"),N}let{chainId:n,request:i,topic:s,expiry:o=Br.wc_sessionRequest.req.ttl}=r,c=this.client.session.get(s);c?.transportType===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let a=tt.payloadId(),u=tt.getBigIntRpcId().toString(),{done:f,resolve:p,reject:S}=j.createDelayedPromise(o,"Request expired. Please try again.");this.events.once(j.engineEvent("session_request",a),({error:N,result:R})=>{N?S(N):p(R)});let I=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);return I?(await this.sendRequest({clientRpcId:a,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:ms(br({},i),{expiryTimestamp:j.calcExpiry(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:I}).catch(N=>S(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await f()):await Promise.all([new Promise(async N=>{await this.sendRequest({clientRpcId:a,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:ms(br({},i),{expiryTimestamp:j.calcExpiry(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(R=>S(R)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),N()}),new Promise(async N=>{var R;if(!((R=c.sessionConfig)!=null&&R.disableDeepLink)){let D=await j.getDeepLink(this.client.core.storage,x4);await j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:D})}N()}),f()]).then(N=>N[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);tt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:c}):tt.isJsonRpcError(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:c}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=tt.payloadId(),s=tt.getBigIntRpcId().toString(),{done:o,resolve:c,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r,o=tt.getBigIntRpcId().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);let{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{let{message:i}=j.getInternalError("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);let s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?he.TRANSPORT_TYPES.link_mode:he.TRANSPORT_TYPES.relay;o===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let{chains:c,statement:a="",uri:u,domain:f,nonce:p,type:S,exp:I,nbf:N,methods:R=[],expiry:D}=r,U=[...r.resources||[]],{topic:k,uri:z}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:k,uri:z}});let H=await this.client.core.crypto.generateKeyPair(),F=j.hashKey(H);if(await Promise.all([this.client.auth.authKeys.set(dp,{responseTopic:F,publicKey:H}),this.client.auth.pairingTopics.set(F,{topic:F,pairingTopic:k})]),await this.client.core.relayer.subscribe(F,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${k}`),R.length>0){let{namespace:A}=j.parseChainId(c[0]),y=j.createEncodedRecap(A,"request",R);j.getRecapFromResources(U)&&(y=j.mergeEncodedRecaps(y,U.pop())),U.push(y)}let V=D&&D>Br.wc_sessionAuthenticate.req.ttl?D:Br.wc_sessionAuthenticate.req.ttl,q={authPayload:{type:S??"caip122",chains:c,statement:a,aud:u,domain:f,version:"1",nonce:p,iat:new Date().toISOString(),exp:I,nbf:N,resources:U},requester:{publicKey:H,metadata:this.client.metadata},expiryTimestamp:j.calcExpiry(V)},C={eip155:{chains:c,methods:[...new Set(["personal_sign",...R])],events:["chainChanged","accountsChanged"]}},B={requiredNamespaces:{},optionalNamespaces:C,relays:[{protocol:"irn"}],pairingTopic:k,proposer:{publicKey:H,metadata:this.client.metadata},expiryTimestamp:j.calcExpiry(Br.wc_sessionPropose.req.ttl)},{done:x,resolve:g,reject:v}=j.createDelayedPromise(V,"Request expired"),l=async({error:A,session:y})=>{if(this.events.off(j.engineEvent("session_request",m),d),A)v(A);else if(y){y.self.publicKey=H,await this.client.session.set(y.topic,y),await this.setExpiry(y.topic,y.expiry),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:y.peer.metadata});let T=this.client.session.get(y.topic);await this.deleteProposal(w),g({session:T})}},d=async A=>{var y,T,E;if(await this.deletePendingAuthRequest(m,{message:"fulfilled",code:0}),A.error){let $=j.getSdkError("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return A.error.code===$.code?void 0:(this.events.off(j.engineEvent("session_connect"),l),v(A.error.message))}await this.deleteProposal(w),this.events.off(j.engineEvent("session_connect"),l);let{cacaos:M,responder:W}=A.result,Y=[],P=[];for(let $ of M){await j.validateSignedCacao({cacao:$,projectId:this.client.core.projectId})||(this.client.logger.error($,"Signature verification failed"),v(j.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:ee}=$,ie=j.getRecapFromResources(ee.resources),X=[j.getNamespacedDidChainId(ee.iss)],re=j.getDidAddress(ee.iss);if(ie){let ae=j.getMethodsFromRecap(ie),Z=j.getChainsFromRecap(ie);Y.push(...ae),X.push(...Z)}for(let ae of X)P.push(`${ae}:${re}`)}let G=await this.client.core.crypto.generateSharedKey(H,W.publicKey),Q;Y.length>0&&(Q={topic:G,acknowledged:!0,self:{publicKey:H,metadata:this.client.metadata},peer:W,controller:W.publicKey,expiry:j.calcExpiry(_u),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:k,namespaces:j.buildNamespacesFromAuth([...new Set(Y)],[...new Set(P)]),transportType:o},await this.client.core.relayer.subscribe(G,{transportType:o}),await this.client.session.set(G,Q),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:W.metadata}),Q=this.client.session.get(G)),(y=this.client.metadata.redirect)!=null&&y.linkMode&&(T=W.metadata.redirect)!=null&&T.linkMode&&(E=W.metadata.redirect)!=null&&E.universal&&n&&(this.client.core.addLinkModeSupportedApp(W.metadata.redirect.universal),this.client.session.update(G,{transportType:he.TRANSPORT_TYPES.link_mode})),g({auths:M,session:Q})},m=tt.payloadId(),w=tt.payloadId();this.events.once(j.engineEvent("session_connect"),l),this.events.once(j.engineEvent("session_request",m),d);let _;try{if(s){let A=tt.formatJsonRpcRequest("wc_sessionAuthenticate",q,m);this.client.core.history.set(k,A);let y=await this.client.core.crypto.encode("",A,{type:j.TYPE_2,encoding:j.BASE64URL});_=j.getLinkModeURL(n,k,y)}else await Promise.all([this.sendRequest({topic:k,method:"wc_sessionAuthenticate",params:q,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:m}),this.sendRequest({topic:k,method:"wc_sessionPropose",params:B,expiry:Br.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w})])}catch(A){throw this.events.off(j.engineEvent("session_connect"),l),this.events.off(j.engineEvent("session_request",m),d),A}return await this.setProposal(w,br({id:w},B)),await this.setAuthRequest(m,{request:ms(br({},q),{verifyContext:{}}),pairingTopic:k,transportType:o}),{uri:_??z,response:x}},this.approveSessionAuthenticate=async r=>{let{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[he.EVENT_CLIENT_AUTHENTICATE_TRACES.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.no_internet_connection),D}let o=this.getPendingAuthRequest(n);if(!o)throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);let c=o.transportType||he.TRANSPORT_TYPES.relay;c===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let a=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),f=j.hashKey(a),p={type:j.TYPE_1,receiverPublicKey:a,senderPublicKey:u},S=[],I=[];for(let D of i){if(!await j.validateSignedCacao({cacao:D,projectId:this.client.core.projectId})){s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.invalid_cacao);let F=j.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:F,encodeOpts:p}),new Error(F.message)}s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.cacaos_verified);let{p:U}=D,k=j.getRecapFromResources(U.resources),z=[j.getNamespacedDidChainId(U.iss)],H=j.getDidAddress(U.iss);if(k){let F=j.getMethodsFromRecap(k),V=j.getChainsFromRecap(k);S.push(...F),z.push(...V)}for(let F of z)I.push(`${F}:${H}`)}let N=await this.client.core.crypto.generateSharedKey(u,a);s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.create_authenticated_session_topic);let R;if(S?.length>0){R={topic:N,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:a,metadata:o.requester.metadata},controller:a,expiry:j.calcExpiry(_u),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:j.buildNamespacesFromAuth([...new Set(S)],[...new Set(I)]),transportType:c},s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(N,{transportType:c})}catch(D){throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.subscribe_authenticated_session_topic_failure),D}s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.subscribe_authenticated_session_topic_success),await this.client.session.set(N,R),s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.publishing_authenticated_session_approve);try{await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(D){throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:R}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();let{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),a=j.hashKey(o),u={type:j.TYPE_1,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:a,error:i,encodeOpts:u,rpcOpts:Br.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();let{request:n,iss:i}=r;return j.formatMessage(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{let r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;let{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=r,{self:a}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,j.getSdkError("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(x4).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,j.getSdkError("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=ys.idle),o&&this.client.events.emit("session_delete",{id:c,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{let i=this.client.proposal.get(r);this.client.core.eventClient.getEvent({topic:i.pairingTopic})?.setError(he.EVENT_CLIENT_SESSION_ERRORS.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=ys.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,j.calcExpiry(Br.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{let{request:i,pairingTopic:s,transportType:o=he.TRANSPORT_TYPES.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{let{id:n,topic:i,params:s,verifyContext:o}=r,c=s.request.expiryTimestamp||j.calcExpiry(Br.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:c,clientRpcId:a,throwOnFailedPublish:u,appLink:f}=r,p=tt.formatJsonRpcRequest(i,s,a),S,I=!!f;try{let D=I?j.BASE64URL:j.BASE64;S=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let N;if(MG.includes(i)){let D=j.hashMessage(JSON.stringify(p)),U=j.hashMessage(S);N=await this.client.core.verify.register({id:U,decryptedId:D})}let R=Br[i].req;if(R.attestation=N,o&&(R.ttl=o),c&&(R.id=c),this.client.core.history.set(n,p),I){let D=j.getLinkModeURL(f,n,S);await global.Linking.openURL(D,this.client.name)}else{let D=Br[i].req;o&&(D.ttl=o),c&&(D.id=c),u?(D.internal=ms(br({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,S,D)):this.client.core.relayer.publish(n,S,D).catch(U=>this.client.logger.error(U))}return p.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:a}=r,u=tt.formatJsonRpcResult(n,s),f,p=a&&typeof(global==null?void 0:global.Linking)<"u";try{let I=p?j.BASE64URL:j.BASE64;f=await this.client.core.crypto.encode(i,u,ms(br({},c||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),I}let S;try{S=await this.client.core.history.get(i,n)}catch(I){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),I}if(p){let I=j.getLinkModeURL(a,i,f);await global.Linking.openURL(I,this.client.name)}else{let I=Br[S.request.method].res;o?(I.internal=ms(br({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,I)):this.client.core.relayer.publish(i,f,I).catch(N=>this.client.logger.error(N))}await this.client.core.history.resolve(u)},this.sendError=async r=>{let{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:c,appLink:a}=r,u=tt.formatJsonRpcError(n,s),f,p=a&&typeof(global==null?void 0:global.Linking)<"u";try{let I=p?j.BASE64URL:j.BASE64;f=await this.client.core.crypto.encode(i,u,ms(br({},o||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),I}let S;try{S=await this.client.core.history.get(i,n)}catch(I){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),I}if(p){let I=j.getLinkModeURL(a,i,f);await global.Linking.openURL(I,this.client.name)}else{let I=c||Br[S.request.method].res;this.client.core.relayer.publish(i,f,I)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;j.isExpired(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ys.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ys.active;let r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ys.idle},this.processRequest=async r=>{let{topic:n,payload:i,attestation:s,transportType:o,encryptedId:c}=r,a=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:a}))switch(a){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{let{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{let{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:c,id:a}=i;try{let u=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(br({},i.params));let f=c.expiryTimestamp||j.calcExpiry(Br.wc_sessionPropose.req.ttl),p=br({id:a,pairingTopic:n,expiryTimestamp:f},c);await this.setProposal(a,p);let S=await this.getVerifyContext({attestationId:s,hash:j.hashMessage(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(he.EVENT_CLIENT_PAIRING_ERRORS.proposal_listener_not_found)),u?.addTrace(he.EVENT_CLIENT_PAIRING_TRACES.emit_session_proposal),this.client.events.emit("session_proposal",{id:a,params:p,verifyContext:S})}catch(u){await this.sendError({id:a,topic:n,error:u,rpcOpts:Br.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(r,n,i)=>{let{id:s}=n;if(tt.isJsonRpcResult(n)){let{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});let c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});let a=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let f=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});let p=await this.client.core.relayer.subscribe(f,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(tt.isJsonRpcError(n)){await this.client.proposal.delete(s,j.getSdkError("USER_DISCONNECTED"));let o=j.engineEvent("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(j.engineEvent("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:c,expiry:a,namespaces:u,sessionProperties:f,sessionConfig:p}=n.params,S=ms(br(br({topic:r,relay:o,expiry:a,namespaces:u,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:c.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},f&&{sessionProperties:f}),p&&{sessionConfig:p}),{transportType:he.TRANSPORT_TYPES.relay}),I=j.engineEvent("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(j.engineEvent("session_connect"),{session:S}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;tt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):tt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,c=j.MemoryStore.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:j.getSdkError("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(br({topic:r},i));try{j.MemoryStore.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(a){throw j.MemoryStore.delete(o),a}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,j.calcExpiry(_u)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(he.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:j.getSdkError("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;let{topic:o,payload:c,attestation:a,encryptedId:u,transportType:f}=r,{id:p,params:S}=c;try{await this.isValidRequest(br({topic:o},S));let I=this.client.session.get(o),N=await this.getVerifyContext({attestationId:a,hash:j.hashMessage(JSON.stringify(tt.formatJsonRpcRequest("wc_sessionRequest",S,p))),encryptedId:u,metadata:I.peer.metadata,transportType:f}),R={id:p,topic:o,params:S,verifyContext:N};await this.setPendingSessionRequest(R),f===he.TRANSPORT_TYPES.link_mode&&(n=I.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=I.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(R):(this.addSessionRequestToSessionRequestQueue(R),this.processSessionRequestQueue())}catch(I){await this.sendError({id:p,topic:o,error:I}),this.client.logger.error(I)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,c=j.MemoryStore.get(o);if(c&&this.isRequestOutOfSync(c,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(br({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{let{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;let{topic:i,payload:s,attestation:o,encryptedId:c,transportType:a}=r;try{let{requester:u,authPayload:f,expiryTimestamp:p}=s.params,S=await this.getVerifyContext({attestationId:o,hash:j.hashMessage(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:a}),I={requester:u,pairingTopic:i,id:s.id,authPayload:f,verifyContext:S,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:I,pairingTopic:i,transportType:a}),a===he.TRANSPORT_TYPES.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:S})}catch(u){this.client.logger.error(u);let f=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),S=this.getAppLinkIfEnabled(s.params.requester.metadata,a),I={type:j.TYPE_1,receiverPublicKey:f,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:I,rpcOpts:Br.wc_sessionAuthenticate.autoReject,appLink:S})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ys.idle,this.processSessionRequestQueue()},Ht.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{let i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{let o=s.request.id,c=j.engineEvent("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(j.engineEvent("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ys.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ys.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:tt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:c}=r;if(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(c,!0)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(a)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);let c=this.client.proposal.get(n),a=j.isValidNamespaces(i,"approve()");if(a)throw new Error(a.message);let u=j.isConformingNamespaces(c.requiredNamespaces,i,"approve()");if(u)throw new Error(u.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(u)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:u}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}let c=j.isValidController(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);let a=j.isValidNamespaces(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);if(j.isExpired(o)){let{message:u}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(u)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(a)}let{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let c=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(c)throw new Error(c.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(a)}let{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let{namespaces:c}=this.client.session.get(n);if(!j.isValidNamespacesChainId(c,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!j.isValidRequest(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesRequest(c,s,i.method)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(a)}if(o&&!j.isValidRequestExpiry(o,lw)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${lw.min} and ${lw.max}`);throw new Error(a)}},this.isValidRespond=async r=>{var n;if(!j.isValidParams(r)){let{message:o}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!j.isValidResponse(s)){let{message:o}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(c)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!j.isValidNamespacesChainId(o,s)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!j.isValidEvent(i)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{let{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!j.isValidString(i,!1))throw new Error("uri is required parameter");if(!j.isValidString(s,!1))throw new Error("domain is required parameter");if(!j.isValidString(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(a=>j.parseChainId(a).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:c}=j.parseChainId(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{let{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:c}=r,a={verified:{verifyUrl:o.verifyUrl||he.VERIFY_SERVER,validation:"UNKNOWN",origin:o.url||""}};try{if(c===he.TRANSPORT_TYPES.link_mode){let f=this.getAppLinkIfEnabled(o,c);return a.verified.validation=f&&new URL(f).origin===new URL(o.url).origin?"VALID":"INVALID",a}let u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(a.verified.origin=u.origin,a.verified.isScam=u.isScam,a.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{let n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0,s=this.recentlyDeletedLimit/2;for(let o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{let n=this.recentlyDeletedMap.get(r);if(n){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,c,a,u,f,p,S;return!r||n!==he.TRANSPORT_TYPES.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:u.universal)!==""&&((f=r?.redirect)==null?void 0:f.universal)!==void 0&&((p=r?.redirect)==null?void 0:p.universal)!==""&&((S=r?.redirect)==null?void 0:S.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r?.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;let n=j.getSearchParamFromURL(r,"topic")||"",i=decodeURIComponent(j.getSearchParamFromURL(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:he.TRANSPORT_TYPES.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(j.isTestRun()||j.isReactNative()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){let n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);let i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(he.RELAYER_EVENTS.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){let{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(dp)?this.client.auth.authKeys.get(dp):{responseTopic:void 0,publicKey:void 0},c=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===he.TRANSPORT_TYPES.link_mode?j.BASE64URL:j.BASE64});try{tt.isJsonRpcRequest(c)?(this.client.core.history.set(r,c),this.onRelayEventRequest({topic:r,payload:c,attestation:i,transportType:s,encryptedId:j.hashMessage(n)})):tt.isJsonRpcResponse(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:r,payload:c,transportType:s}),this.client.core.history.delete(r,c.id)):this.onRelayEventUnknownPayload({topic:r,payload:c,transportType:s})}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(he.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(he.PAIRING_EVENTS.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(he.PAIRING_EVENTS.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:r}=j.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},O4=class extends he.Store{constructor(e,r){super(e,r,xG,hw),this.core=e,this.logger=r}},fw=class extends he.Store{constructor(e,r){super(e,r,OG,hw),this.core=e,this.logger=r}},P4=class extends he.Store{constructor(e,r){super(e,r,RG,hw,n=>n.id),this.core=e,this.logger=r}},R4=class extends he.Store{constructor(e,r){super(e,r,LG,hp,()=>dp),this.core=e,this.logger=r}},M4=class extends he.Store{constructor(e,r){super(e,r,FG,hp),this.core=e,this.logger=r}},D4=class extends he.Store{constructor(e,r){super(e,r,qG,hp,n=>n.id),this.core=e,this.logger=r}},B4=class{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new R4(this.core,this.logger),this.pairingTopics=new M4(this.core,this.logger),this.requests=new D4(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}},dw=class t extends IG.ISignClient{constructor(e){super(e),this.protocol=L4,this.version=F4,this.name=uw.name,this.events=new CG.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||uw.name,this.metadata=e?.metadata||j.getAppMetadata(),this.signConfig=e?.signConfig;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:cw.pino(cw.getDefaultLoggerOptions({level:e?.logger||uw.logger}));this.core=e?.core||new he.Core(e),this.logger=cw.generateChildLogger(r,this.name),this.session=new fw(this.core,this.logger),this.proposal=new O4(this.core,this.logger),this.pendingRequest=new P4(this.core,this.logger),this.engine=new N4(this),this.auth=new B4(this.core,this.logger)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return cw.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.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},hbe=fw,pbe=dw;Xe.AUTH_CONTEXT=BG,Xe.AUTH_KEYS_CONTEXT=LG,Xe.AUTH_PAIRING_TOPIC_CONTEXT=FG,Xe.AUTH_PROTOCOL=DG,Xe.AUTH_PUBLIC_KEY_NAME=dp,Xe.AUTH_REQUEST_CONTEXT=qG,Xe.AUTH_STORAGE_PREFIX=hp,Xe.AUTH_VERSION=abe,Xe.ENGINE_CONTEXT=PG,Xe.ENGINE_QUEUE_STATES=ys,Xe.ENGINE_RPC_OPTS=Br,Xe.HISTORY_CONTEXT=ibe,Xe.HISTORY_EVENTS=nbe,Xe.HISTORY_STORAGE_VERSION=sbe,Xe.METHODS_TO_VERIFY=MG,Xe.PROPOSAL_CONTEXT=xG,Xe.PROPOSAL_EXPIRY=obe,Xe.PROPOSAL_EXPIRY_MESSAGE=NG,Xe.REQUEST_CONTEXT=RG,Xe.SESSION_CONTEXT=OG,Xe.SESSION_EXPIRY=_u,Xe.SESSION_REQUEST_EXPIRY_BOUNDARIES=lw,Xe.SIGN_CLIENT_CONTEXT=q4,Xe.SIGN_CLIENT_DEFAULT=uw,Xe.SIGN_CLIENT_EVENTS=tbe,Xe.SIGN_CLIENT_PROTOCOL=L4,Xe.SIGN_CLIENT_STORAGE_OPTIONS=rbe,Xe.SIGN_CLIENT_STORAGE_PREFIX=hw,Xe.SIGN_CLIENT_VERSION=F4,Xe.SessionStore=hbe,Xe.SignClient=pbe,Xe.WALLETCONNECT_DEEPLINK_CHOICE=x4,Xe.default=dw});var pw=L(md=>{"use strict";h();Object.defineProperty(md,"__esModule",{value:!0});md.OptionalOperation=md.Operation=void 0;var kG;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(kG||(md.Operation=kG={}));var VG;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(VG||(md.OptionalOperation=VG={}))});var U4=L(po=>{"use strict";h();Object.defineProperty(po,"__esModule",{value:!0});po.WALLETCONNECT_SIGN_LOGIN_DELAY=po.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=po.WALLETCONNECT_MULTIVERSX_METHODS=po.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var HG=pw();po.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";po.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(HG.Operation);po.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(HG.OptionalOperation);po.WALLETCONNECT_SIGN_LOGIN_DELAY=500});var H4=L(go=>{"use strict";h();Object.defineProperty(go,"__esModule",{value:!0});go.WalletConnectV2ProviderErrorMessagesEnum=go.ErrBadAddress=go.ErrNotImplemented=go.Err=void 0;var pp=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};go.Err=pp;var k4=class extends pp{constructor(){super("Method not yet implemented")}};go.ErrNotImplemented=k4;var V4=class extends pp{constructor(e,r){super(`Bad address: ${e}`,r)}};go.ErrBadAddress=V4;var GG;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(GG||(go.WalletConnectV2ProviderErrorMessagesEnum=GG={}))});var z4=L(gw=>{"use strict";h();Object.defineProperty(gw,"__esModule",{value:!0});gw.Logger=void 0;var G4=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};gw.Logger=G4});var $G=L(Fi=>{"use strict";h();var gbe=Fi&&Fi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.getCurrentSession=KG;Fi.getCurrentTopic=ybe;Fi.getConnectionParams=WG;Fi.addressIsValid=vbe;Fi.getAddressFromSession=bbe;Fi.applyTransactionSignature=wbe;Fi.getMetadata=Abe;Fi.sleep=Ebe;var QG=$c(),zG=N1(),mbe=J0(),mw=U4(),Zo=H4(),j4=z4(),jG=pw();function KG(t,e){if(!e)throw new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(WG(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw j4.Logger.error(Zo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}function ybe(t,e){if(!e)throw new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=KG(t,e);if(!r?.topic)throw new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}function WG(t,e){var r,n,i;let s=[...mw.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(jG.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(jG.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${mw.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],c=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[mw.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:c}}}}function vbe(t){try{return!QG.Address.fromBech32(t).isEmpty()}catch{return!1}}function bbe(t){let e=t.namespaces[mw.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}function wbe({transaction:t,response:e}){if(!e)throw j4.Logger.error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,c=t.getGuardian().bech32();if(c&&c!==o)throw j4.Logger.error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(QG.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new zG.Signature(r)),n&&t.applyGuardianSignature(new zG.Signature(n)),t}function Abe(t){if(t)return Object.assign(Object.assign({},t),{url:(0,mbe.getAppMetadata)().url})}function Ebe(t){return gbe(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}});var gp=L(Qn=>{"use strict";h();var Lr=Qn&&Qn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})},Sbe=Qn&&Qn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.WalletConnectV2Provider=Qn.OptionalOperation=Qn.Operation=Qn.WalletConnectV2ProviderErrorMessagesEnum=void 0;var YG=$c(),_be=Sbe(UG()),Q4=J0(),Tu=U4(),de=H4();Object.defineProperty(Qn,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return de.WalletConnectV2ProviderErrorMessagesEnum}});var Ze=z4(),rc=pw();Object.defineProperty(Qn,"Operation",{enumerable:!0,get:function(){return rc.Operation}});Object.defineProperty(Qn,"OptionalOperation",{enumerable:!0,get:function(){return rc.OptionalOperation}});var tn=$G(),K4=class{constructor(e,r,n,i,s){this.chainId="",this.isInitializing=!1,this.processingTopic="",this.options={},this.account={address:""},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}disconnect(){this.account={address:"",signature:""},this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){return Lr(this,void 0,void 0,function*(){var e,r;if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.disconnect();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:(0,tn.getMetadata)((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield _be.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return!!(this.isInitialized()&&typeof this.session<"u")}getAccount(){return this.account}setAccount(e){this.account=e}connect(e){return Lr(this,void 0,void 0,function*(){var r,n;if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=(0,tn.getConnectionParams)(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},i))}catch{if(e?.topic)try{(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.expirer)===null||n===void 0||n.set(e.topic,0)}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}throw this.disconnect(),Ze.Logger.error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){return Lr(this,void 0,void 0,function*(){var r;if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield(0,tn.sleep)(Tu.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=(0,tn.getAddressFromSession)(n),o=n.namespaces[Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(rc.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?rc.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:rc.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:c}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!c)throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:c})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.disconnect(),Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return null})}logout(e){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||(0,tn.getCurrentTopic)(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:(0,Q4.getSdkError)("USER_DISCONNECTED")});else{let r=(0,tn.getCurrentTopic)(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:(0,Q4.getSdkError)("USER_DISCONNECTED")}),this.disconnect(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.account.address}getSignature(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.account.signature}getPairings(){return Lr(this,void 0,void 0,function*(){var e,r,n,i,s;if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return Lr(this,void 0,void 0,function*(){var r;let n=new YG.Message({data:b.Buffer.from(e.data),address:(r=e.address)!==null&&r!==void 0?r:YG.Address.fromBech32(this.account.address),signer:"wallet-connect-v2",version:e.version});if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let i=this.getAddress(),{signature:s}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:{method:rc.Operation.SIGN_MESSAGE,params:{address:i,message:n.data.toString()}}});if(!s)throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{n.signature=b.Buffer.from(s,"hex")}catch{throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return n})}signTransaction(e){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:{method:rc.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return(0,tn.applyTransactionSignature)({transaction:e,response:n})}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:{method:rc.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];(0,tn.applyTransactionSignature)({transaction:s,response:o})}return e}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){return Lr(this,void 0,void 0,function*(){var r;if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=(0,tn.getCurrentTopic)(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return Lr(this,void 0,void 0,function*(){return e?(0,tn.addressIsValid)(e.address)?(this.account.address=e.address,e.signature&&(this.account.signature=e.signature),this.onClientConnect.onClientLogin(),this.account.address):(Ze.Logger.error(`${de.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return Lr(this,void 0,void 0,function*(){if(!e)return null;this.session=e.session,this.account.signature=e.signature||"";let r=(0,tn.getAddressFromSession)(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),this.account.address=r,this.account):null})}handleTopicUpdateEvent(e){return Lr(this,arguments,void 0,function*({topic:r}){if(typeof this.walletConnector>"u"){Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let n=yield this.getPairings();if(this.account.address&&!this.isInitializing&&n)if(n?.length===0)this.onClientConnect.onClientLogout();else{let i=n[n.length-1];i?.topic===r&&this.onClientConnect.onClientLogout()}}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents(e){return Lr(this,arguments,void 0,function*({topic:r,params:n}){var i;if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((i=this.session)===null||i===void 0?void 0:i.topic)!==r)return;let{event:s}=n;if(s?.name&&(0,tn.getCurrentTopic)(this.chainId,this.walletConnector)===r){let o=s.data;this.onClientConnect.onClientEvent(o)}})}subscribeToEvents(e){return Lr(this,void 0,void 0,function*(){var r,n,i,s;if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:c})=>{var a;if(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)return;let{namespaces:u}=c,f=e.session.get(o),p=Object.assign(Object.assign({},f),{namespaces:u});this.onSessionConnected({session:p})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",o=>Lr(this,[o],void 0,function*({topic:c}){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.disconnect()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==c)&&(Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.disconnect(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",o=>Lr(this,[o],void 0,function*({topic:c}){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==c||(Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.disconnect(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return Lr(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.account.address&&!this.isInitializing){let r=(0,tn.getCurrentSession)(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(){return Lr(this,arguments,void 0,function*(e={}){var r,n,i,s,o,c,a,u;if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!(0,Q4.isValidArray)(f))return;for(let p of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(p.topic,0);else try{yield(u=(a=(c=this.walletConnector.core)===null||c===void 0?void 0:c.relayer)===null||a===void 0?void 0:a.subscriber)===null||u===void 0?void 0:u.unsubscribe(p.topic)}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};Qn.WalletConnectV2Provider=K4});var XG=L((zPe,JG)=>{"use strict";h();JG.exports=Error});var ez=L((QPe,ZG)=>{"use strict";h();ZG.exports=EvalError});var rz=L((WPe,tz)=>{"use strict";h();tz.exports=RangeError});var iz=L((YPe,nz)=>{"use strict";h();nz.exports=ReferenceError});var W4=L((XPe,sz)=>{"use strict";h();sz.exports=SyntaxError});var yd=L((eRe,oz)=>{"use strict";h();oz.exports=TypeError});var cz=L((rRe,az)=>{"use strict";h();az.exports=URIError});var lz=L((iRe,uz)=>{"use strict";h();uz.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var hz=L((oRe,dz)=>{"use strict";h();var fz=typeof Symbol<"u"&&Symbol,Tbe=lz();dz.exports=function(){return typeof fz!="function"||typeof Symbol!="function"||typeof fz("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Tbe()}});var gz=L((cRe,pz)=>{"use strict";h();var $4={__proto__:null,foo:{}},Ibe=Object;pz.exports=function(){return{__proto__:$4}.foo===$4.foo&&!($4 instanceof Ibe)}});var vz=L((lRe,yz)=>{"use strict";h();var Cbe="Function.prototype.bind called on incompatible ",xbe=Object.prototype.toString,Nbe=Math.max,Obe="[object Function]",mz=function(e,r){for(var n=[],i=0;i{"use strict";h();var Mbe=vz();bz.exports=Function.prototype.bind||Mbe});var Az=L((pRe,wz)=>{"use strict";h();var Dbe=Function.prototype.call,Bbe=Object.prototype.hasOwnProperty,Lbe=yw();wz.exports=Lbe.call(Dbe,Bbe)});var xu=L((mRe,Iz)=>{"use strict";h();var Je,Fbe=XG(),qbe=ez(),Ube=rz(),kbe=iz(),Ad=W4(),wd=yd(),Vbe=cz(),Tz=Function,Y4=function(t){try{return Tz('"use strict"; return ('+t+").constructor;")()}catch{}},Iu=Object.getOwnPropertyDescriptor;if(Iu)try{Iu({},"")}catch{Iu=null}var J4=function(){throw new wd},Hbe=Iu?function(){try{return arguments.callee,J4}catch{try{return Iu(arguments,"callee").get}catch{return J4}}}():J4,vd=hz()(),Gbe=gz()(),Kr=Object.getPrototypeOf||(Gbe?function(t){return t.__proto__}:null),bd={},zbe=typeof Uint8Array>"u"||!Kr?Je:Kr(Uint8Array),Cu={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Je:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Je:ArrayBuffer,"%ArrayIteratorPrototype%":vd&&Kr?Kr([][Symbol.iterator]()):Je,"%AsyncFromSyncIteratorPrototype%":Je,"%AsyncFunction%":bd,"%AsyncGenerator%":bd,"%AsyncGeneratorFunction%":bd,"%AsyncIteratorPrototype%":bd,"%Atomics%":typeof Atomics>"u"?Je:Atomics,"%BigInt%":typeof BigInt>"u"?Je:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Je:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Je:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Je:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Fbe,"%eval%":eval,"%EvalError%":qbe,"%Float32Array%":typeof Float32Array>"u"?Je:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Je:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Je:FinalizationRegistry,"%Function%":Tz,"%GeneratorFunction%":bd,"%Int8Array%":typeof Int8Array>"u"?Je:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Je:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Je:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vd&&Kr?Kr(Kr([][Symbol.iterator]())):Je,"%JSON%":typeof JSON=="object"?JSON:Je,"%Map%":typeof Map>"u"?Je:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vd||!Kr?Je:Kr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Je:Promise,"%Proxy%":typeof Proxy>"u"?Je:Proxy,"%RangeError%":Ube,"%ReferenceError%":kbe,"%Reflect%":typeof Reflect>"u"?Je:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Je:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vd||!Kr?Je:Kr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Je:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vd&&Kr?Kr(""[Symbol.iterator]()):Je,"%Symbol%":vd?Symbol:Je,"%SyntaxError%":Ad,"%ThrowTypeError%":Hbe,"%TypedArray%":zbe,"%TypeError%":wd,"%Uint8Array%":typeof Uint8Array>"u"?Je:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Je:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Je:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Je:Uint32Array,"%URIError%":Vbe,"%WeakMap%":typeof WeakMap>"u"?Je:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Je:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Je:WeakSet};if(Kr)try{null.error}catch(t){Ez=Kr(Kr(t)),Cu["%Error.prototype%"]=Ez}var Ez,jbe=function t(e){var r;if(e==="%AsyncFunction%")r=Y4("async function () {}");else if(e==="%GeneratorFunction%")r=Y4("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Y4("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Kr&&(r=Kr(i.prototype))}return Cu[e]=r,r},Sz={__proto__:null,"%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"]},mp=yw(),vw=Az(),Qbe=mp.call(Function.call,Array.prototype.concat),Kbe=mp.call(Function.apply,Array.prototype.splice),_z=mp.call(Function.call,String.prototype.replace),bw=mp.call(Function.call,String.prototype.slice),Wbe=mp.call(Function.call,RegExp.prototype.exec),$be=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ybe=/\\(\\)?/g,Jbe=function(e){var r=bw(e,0,1),n=bw(e,-1);if(r==="%"&&n!=="%")throw new Ad("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ad("invalid intrinsic syntax, expected opening `%`");var i=[];return _z(e,$be,function(s,o,c,a){i[i.length]=c?_z(a,Ybe,"$1"):o||s}),i},Xbe=function(e,r){var n=e,i;if(vw(Sz,n)&&(i=Sz[n],n="%"+i[0]+"%"),vw(Cu,n)){var s=Cu[n];if(s===bd&&(s=jbe(n)),typeof s>"u"&&!r)throw new wd("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Ad("intrinsic "+e+" does not exist!")};Iz.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new wd("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new wd('"allowMissing" argument must be a boolean');if(Wbe(/^%?[^%]*%?$/,e)===null)throw new Ad("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Jbe(e),i=n.length>0?n[0]:"",s=Xbe("%"+i+"%",r),o=s.name,c=s.value,a=!1,u=s.alias;u&&(i=u[0],Kbe(n,Qbe([0,1],u)));for(var f=1,p=!0;f=n.length){var R=Iu(c,S);p=!!R,p&&"get"in R&&!("originalValue"in R.get)?c=R.get:c=c[S]}else p=vw(c,S),c=c[S];p&&!a&&(Cu[o]=c)}}return c}});var Aw=L((vRe,Cz)=>{"use strict";h();var Zbe=xu(),ww=Zbe("%Object.defineProperty%",!0)||!1;if(ww)try{ww({},"a",{value:1})}catch{ww=!1}Cz.exports=ww});var X4=L((wRe,xz)=>{"use strict";h();var ewe=xu(),Ew=ewe("%Object.getOwnPropertyDescriptor%",!0);if(Ew)try{Ew([],"length")}catch{Ew=null}xz.exports=Ew});var Rz=L((ERe,Pz)=>{"use strict";h();var Nz=Aw(),twe=W4(),Ed=yd(),Oz=X4();Pz.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Ed("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ed("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ed("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ed("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ed("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ed("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,a=!!Oz&&Oz(e,r);if(Nz)Nz(e,r,{configurable:o===null&&a?a.configurable:!o,enumerable:i===null&&a?a.enumerable:!i,value:n,writable:s===null&&a?a.writable:!s});else if(c||!i&&!s&&!o)e[r]=n;else throw new twe("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Bz=L((_Re,Dz)=>{"use strict";h();var Z4=Aw(),Mz=function(){return!!Z4};Mz.hasArrayLengthDefineBug=function(){if(!Z4)return null;try{return Z4([],"length",{value:1}).length!==1}catch{return!0}};Dz.exports=Mz});var kz=L((IRe,Uz)=>{"use strict";h();var rwe=xu(),Lz=Rz(),nwe=Bz()(),Fz=X4(),qz=yd(),iwe=rwe("%Math.floor%");Uz.exports=function(e,r){if(typeof e!="function")throw new qz("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||iwe(r)!==r)throw new qz("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Fz){var o=Fz(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(nwe?Lz(e,"length",r,!0,!0):Lz(e,"length",r)),e}});var Qz=L((xRe,Sw)=>{"use strict";h();var e5=yw(),_w=xu(),swe=kz(),owe=yd(),Gz=_w("%Function.prototype.apply%"),zz=_w("%Function.prototype.call%"),jz=_w("%Reflect.apply%",!0)||e5.call(zz,Gz),Vz=Aw(),awe=_w("%Math.max%");Sw.exports=function(e){if(typeof e!="function")throw new owe("a function is required");var r=jz(e5,zz,arguments);return swe(r,1+awe(0,e.length-(arguments.length-1)),!0)};var Hz=function(){return jz(e5,Gz,arguments)};Vz?Vz(Sw.exports,"apply",{value:Hz}):Sw.exports.apply=Hz});var Yz=L((ORe,$z)=>{"use strict";h();var Kz=xu(),Wz=Qz(),cwe=Wz(Kz("String.prototype.indexOf"));$z.exports=function(e,r){var n=Kz(e,!!r);return typeof n=="function"&&cwe(e,".prototype.")>-1?Wz(n):n}});var Jz=L(()=>{h()});var yj=L((BRe,mj)=>{h();var l5=typeof Map=="function"&&Map.prototype,t5=Object.getOwnPropertyDescriptor&&l5?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Iw=l5&&t5&&typeof t5.get=="function"?t5.get:null,Xz=l5&&Map.prototype.forEach,f5=typeof Set=="function"&&Set.prototype,r5=Object.getOwnPropertyDescriptor&&f5?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Cw=f5&&r5&&typeof r5.get=="function"?r5.get:null,Zz=f5&&Set.prototype.forEach,uwe=typeof WeakMap=="function"&&WeakMap.prototype,vp=uwe?WeakMap.prototype.has:null,lwe=typeof WeakSet=="function"&&WeakSet.prototype,bp=lwe?WeakSet.prototype.has:null,fwe=typeof WeakRef=="function"&&WeakRef.prototype,ej=fwe?WeakRef.prototype.deref:null,dwe=Boolean.prototype.valueOf,hwe=Object.prototype.toString,pwe=Function.prototype.toString,gwe=String.prototype.match,d5=String.prototype.slice,ic=String.prototype.replace,mwe=String.prototype.toUpperCase,tj=String.prototype.toLowerCase,lj=RegExp.prototype.test,rj=Array.prototype.concat,mo=Array.prototype.join,ywe=Array.prototype.slice,nj=Math.floor,s5=typeof BigInt=="function"?BigInt.prototype.valueOf:null,n5=Object.getOwnPropertySymbols,o5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Sd=typeof Symbol=="function"&&typeof Symbol.iterator=="object",vn=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Sd||!0)?Symbol.toStringTag:null,fj=Object.prototype.propertyIsEnumerable,ij=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function sj(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||lj.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-nj(-t):nj(t);if(n!==t){var i=String(n),s=d5.call(e,i.length+1);return ic.call(i,r,"$&_")+"."+ic.call(ic.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ic.call(e,r,"$&_")}var a5=Jz(),oj=a5.custom,aj=hj(oj)?oj:null;mj.exports=function t(e,r,n,i){var s=r||{};if(nc(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(nc(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=nc(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(nc(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(nc(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=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 gj(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return c?sj(e,a):a}if(typeof e=="bigint"){var u=String(e)+"n";return c?sj(e,u):u}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return c5(e)?"[Array]":"[Object]";var p=Bwe(s,n);if(typeof i>"u")i=[];else if(pj(i,e)>=0)return"[Circular]";function S(l,d,m){if(d&&(i=ywe.call(i),i.push(d)),m){var w={depth:s.depth};return nc(s,"quoteStyle")&&(w.quoteStyle=s.quoteStyle),t(l,w,n+1,i)}return t(l,s,n+1,i)}if(typeof e=="function"&&!cj(e)){var I=Iwe(e),N=Tw(e,S);return"[Function"+(I?": "+I:" (anonymous)")+"]"+(N.length>0?" { "+mo.call(N,", ")+" }":"")}if(hj(e)){var R=Sd?ic.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):o5.call(e);return typeof e=="object"&&!Sd?yp(R):R}if(Rwe(e)){for(var D="<"+tj.call(String(e.nodeName)),U=e.attributes||[],k=0;k",D}if(c5(e)){if(e.length===0)return"[]";var z=Tw(e,S);return p&&!Dwe(z)?"["+u5(z,p)+"]":"[ "+mo.call(z,", ")+" ]"}if(wwe(e)){var H=Tw(e,S);return!("cause"in Error.prototype)&&"cause"in e&&!fj.call(e,"cause")?"{ ["+String(e)+"] "+mo.call(rj.call("[cause]: "+S(e.cause),H),", ")+" }":H.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+mo.call(H,", ")+" }"}if(typeof e=="object"&&o){if(aj&&typeof e[aj]=="function"&&a5)return a5(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Cwe(e)){var F=[];return Xz&&Xz.call(e,function(l,d){F.push(S(d,e,!0)+" => "+S(l,e))}),uj("Map",Iw.call(e),F,p)}if(Owe(e)){var V=[];return Zz&&Zz.call(e,function(l){V.push(S(l,e))}),uj("Set",Cw.call(e),V,p)}if(xwe(e))return i5("WeakMap");if(Pwe(e))return i5("WeakSet");if(Nwe(e))return i5("WeakRef");if(Ewe(e))return yp(S(Number(e)));if(_we(e))return yp(S(s5.call(e)));if(Swe(e))return yp(dwe.call(e));if(Awe(e))return yp(S(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!bwe(e)&&!cj(e)){var q=Tw(e,S),C=ij?ij(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",x=!C&&vn&&Object(e)===e&&vn in e?d5.call(sc(e),8,-1):B?"Object":"",g=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",v=g+(x||B?"["+mo.call(rj.call([],x||[],B||[]),": ")+"] ":"");return q.length===0?v+"{}":p?v+"{"+u5(q,p)+"}":v+"{ "+mo.call(q,", ")+" }"}return String(e)};function dj(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function vwe(t){return ic.call(String(t),/"/g,""")}function c5(t){return sc(t)==="[object Array]"&&(!vn||!(typeof t=="object"&&vn in t))}function bwe(t){return sc(t)==="[object Date]"&&(!vn||!(typeof t=="object"&&vn in t))}function cj(t){return sc(t)==="[object RegExp]"&&(!vn||!(typeof t=="object"&&vn in t))}function wwe(t){return sc(t)==="[object Error]"&&(!vn||!(typeof t=="object"&&vn in t))}function Awe(t){return sc(t)==="[object String]"&&(!vn||!(typeof t=="object"&&vn in t))}function Ewe(t){return sc(t)==="[object Number]"&&(!vn||!(typeof t=="object"&&vn in t))}function Swe(t){return sc(t)==="[object Boolean]"&&(!vn||!(typeof t=="object"&&vn in t))}function hj(t){if(Sd)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!o5)return!1;try{return o5.call(t),!0}catch{}return!1}function _we(t){if(!t||typeof t!="object"||!s5)return!1;try{return s5.call(t),!0}catch{}return!1}var Twe=Object.prototype.hasOwnProperty||function(t){return t in this};function nc(t,e){return Twe.call(t,e)}function sc(t){return hwe.call(t)}function Iwe(t){if(t.name)return t.name;var e=gwe.call(pwe.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function pj(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return gj(d5.call(t,0,e.maxStringLength),e)+n}var i=ic.call(ic.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Mwe);return dj(i,"single",e)}function Mwe(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+mwe.call(e.toString(16))}function yp(t){return"Object("+t+")"}function i5(t){return t+" { ? }"}function uj(t,e,r,n){var i=n?u5(r,n):mo.call(r,", ");return t+" ("+e+") {"+i+"}"}function Dwe(t){for(var e=0;e=0)return!1;return!0}function Bwe(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=mo.call(Array(t.indent+1)," ");else return null;return{base:r,prev:mo.call(Array(e+1),r)}}function u5(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+mo.call(t,","+r)+` +`+e.prev}function Tw(t,e){var r=c5(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";h();var vj=xu(),_d=Yz(),Lwe=yj(),Fwe=yd(),xw=vj("%WeakMap%",!0),Nw=vj("%Map%",!0),qwe=_d("WeakMap.prototype.get",!0),Uwe=_d("WeakMap.prototype.set",!0),kwe=_d("WeakMap.prototype.has",!0),Vwe=_d("Map.prototype.get",!0),Hwe=_d("Map.prototype.set",!0),Gwe=_d("Map.prototype.has",!0),h5=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},zwe=function(t,e){var r=h5(t,e);return r&&r.value},jwe=function(t,e,r){var n=h5(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Qwe=function(t,e){return!!h5(t,e)};bj.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Fwe("Side channel does not contain "+Lwe(s))},get:function(s){if(xw&&s&&(typeof s=="object"||typeof s=="function")){if(e)return qwe(e,s)}else if(Nw){if(r)return Vwe(r,s)}else if(n)return zwe(n,s)},has:function(s){if(xw&&s&&(typeof s=="object"||typeof s=="function")){if(e)return kwe(e,s)}else if(Nw){if(r)return Gwe(r,s)}else if(n)return Qwe(n,s);return!1},set:function(s,o){xw&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new xw),Uwe(e,s,o)):Nw?(r||(r=new Nw),Hwe(r,s,o)):(n||(n={key:{},next:null}),jwe(n,s,o))}};return i}});var Ow=L((URe,Aj)=>{"use strict";h();var Kwe=String.prototype.replace,Wwe=/%20/g,p5={RFC1738:"RFC1738",RFC3986:"RFC3986"};Aj.exports={default:p5.RFC3986,formatters:{RFC1738:function(t){return Kwe.call(t,Wwe,"+")},RFC3986:function(t){return String(t)}},RFC1738:p5.RFC1738,RFC3986:p5.RFC3986}});var m5=L((VRe,Sj)=>{"use strict";h();var $we=Ow(),g5=Object.prototype.hasOwnProperty,Nu=Array.isArray,yo=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Ywe=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Nu(n)){for(var i=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||s===$we.RFC1738&&(u===40||u===41)){c+=o.charAt(a);continue}if(u<128){c=c+yo[u];continue}if(u<2048){c=c+(yo[192|u>>6]+yo[128|u&63]);continue}if(u<55296||u>=57344){c=c+(yo[224|u>>12]+yo[128|u>>6&63]+yo[128|u&63]);continue}a+=1,u=65536+((u&1023)<<10|o.charCodeAt(a)&1023),c+=yo[240|u>>18]+yo[128|u>>12&63]+yo[128|u>>6&63]+yo[128|u&63]}return c},tAe=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";h();var Ij=wj(),v5=m5(),wp=Ow(),oAe=Object.prototype.hasOwnProperty,_j={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ou=Array.isArray,aAe=String.prototype.split,cAe=Array.prototype.push,Cj=function(t,e){cAe.apply(t,Ou(e)?e:[e])},uAe=Date.prototype.toISOString,Tj=wp.default,rn={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:v5.encode,encodeValuesOnly:!1,format:Tj,formatter:wp.formatters[Tj],indices:!1,serializeDate:function(e){return uAe.call(e)},skipNulls:!1,strictNullHandling:!1},lAe=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},y5={},fAe=function t(e,r,n,i,s,o,c,a,u,f,p,S,I,N,R){for(var D=e,U=R,k=0,z=!1;(U=U.get(y5))!==void 0&&!z;){var H=U.get(e);if(k+=1,typeof H<"u"){if(H===k)throw new RangeError("Cyclic object value");z=!0}typeof U.get(y5)>"u"&&(k=0)}if(typeof c=="function"?D=c(r,D):D instanceof Date?D=f(D):n==="comma"&&Ou(D)&&(D=v5.maybeMap(D,function(_){return _ instanceof Date?f(_):_})),D===null){if(i)return o&&!I?o(r,rn.encoder,N,"key",p):r;D=""}if(lAe(D)||v5.isBuffer(D)){if(o){var F=I?r:o(r,rn.encoder,N,"key",p);if(n==="comma"&&I){for(var V=aAe.call(String(D),","),q="",C=0;C"u")return B;var x;if(n==="comma"&&Ou(D))x=[{value:D.length>0?D.join(",")||null:void 0}];else if(Ou(c))x=c;else{var g=Object.keys(D);x=a?g.sort(a):g}for(var v=0;v"u"?rn.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:rn.charsetSentinel,delimiter:typeof e.delimiter>"u"?rn.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:rn.encode,encoder:typeof e.encoder=="function"?e.encoder:rn.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:rn.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:rn.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:rn.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:rn.strictNullHandling}};xj.exports=function(t,e){var r=t,n=dAe(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Ou(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var c;e&&e.arrayFormat in _j?c=e.arrayFormat:e&&"indices"in e?c=e.indices?"indices":"repeat":c="indices";var a=_j[c];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var u=Ij(),f=0;f0?I+S:""}});var Rj=L((jRe,Pj)=>{"use strict";h();var Td=m5(),b5=Object.prototype.hasOwnProperty,hAe=Array.isArray,Wr={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Td.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},pAe=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Oj=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},gAe="utf8=%26%2310003%3B",mAe="utf8=%E2%9C%93",yAe=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),c=-1,a,u=r.charset;if(r.charsetSentinel)for(a=0;a-1&&(N=hAe(N)?[N]:N),b5.call(n,I)?n[I]=Td.combine(n[I],N):n[I]=N}return n},vAe=function(t,e,r,n){for(var i=n?e:Oj(e,r),s=t.length-1;s>=0;--s){var o,c=t[s];if(c==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var a=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=parseInt(a,10);!r.parseArrays&&a===""?o={0:i}:!isNaN(u)&&c!==a&&String(u)===a&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(o=[],o[u]=i):a!=="__proto__"&&(o[a]=i)}i=o}return i},bAe=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,c=/(\[[^[\]]*])/g,a=n.depth>0&&o.exec(s),u=a?s.slice(0,a.index):s,f=[];if(u){if(!n.plainObjects&&b5.call(Object.prototype,u)&&!n.allowPrototypes)return;f.push(u)}for(var p=0;n.depth>0&&(a=c.exec(s))!==null&&p"u"?Wr.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Wr.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Wr.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Wr.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Wr.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Wr.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Wr.comma,decoder:typeof e.decoder=="function"?e.decoder:Wr.decoder,delimiter:typeof e.delimiter=="string"||Td.isRegExp(e.delimiter)?e.delimiter:Wr.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Wr.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Wr.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Wr.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Wr.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Wr.strictNullHandling}};Pj.exports=function(t,e){var r=wAe(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?yAe(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";h();var AAe=Nj(),EAe=Rj(),SAe=Ow();Mj.exports={formats:SAe,parse:EAe,stringify:AAe}});var w5=L(Gt=>{"use strict";h();Object.defineProperty(Gt,"__esModule",{value:!0});Gt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Gt.WALLET_PROVIDER_CALLBACK_PARAM=Gt.WALLET_PROVIDER_SIGN_MESSAGE_URL=Gt.WALLET_PROVIDER_GUARD_TRANSACTION_URL=Gt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Gt.WALLET_PROVIDER_SEND_TRANSACTION_URL=Gt.WALLET_PROVIDER_DISCONNECT_URL=Gt.WALLET_PROVIDER_CONNECT_URL=Gt.XALIAS_PROVIDER_TESTNET=Gt.XALIAS_PROVIDER_DEVNET=Gt.XALIAS_PROVIDER_MAINNET=Gt.WALLET_PROVIDER_TESTNET=Gt.WALLET_PROVIDER_DEVNET=Gt.WALLET_PROVIDER_MAINNET=void 0;Gt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";Gt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";Gt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";Gt.XALIAS_PROVIDER_MAINNET="https://xalias.com";Gt.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";Gt.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";Gt.WALLET_PROVIDER_CONNECT_URL="hook/login";Gt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Gt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Gt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Gt.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";Gt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";Gt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Gt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var Bj=L(Id=>{"use strict";h();Object.defineProperty(Id,"__esModule",{value:!0});Id.ErrCannotSignedMessage=Id.ErrCannotGetSignedTransactions=void 0;var A5=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};Id.ErrCannotGetSignedTransactions=A5;var E5=class extends Error{constructor(){super("Cannot get signed message")}};Id.ErrCannotSignedMessage=E5});var Lj=L(Pw=>{"use strict";h();Object.defineProperty(Pw,"__esModule",{value:!0});Pw.PlainSignedTransaction=void 0;var S5=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};Pw.PlainSignedTransaction=S5});var Cd=L(cc=>{"use strict";h();var oc=cc&&cc.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})},_Ae=cc&&cc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cc,"__esModule",{value:!0});cc.WalletProvider=void 0;var TAe=$c(),_5=_Ae(Dj()),ac=w5(),T5=Bj(),IAe=Lj(),I5=class t{constructor(e){this.walletUrl=e}login(e){return oc(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ac.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return oc(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return oc(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return oc(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ac.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return oc(this,void 0,void 0,function*(){let n=new TAe.Message({data:b.Buffer.from(e.data),address:e.address,signer:"web-wallet",version:e.version}),i=this.buildWalletUrl({endpoint:ac.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:n.data.toString()}});return yield this.redirect(i),i})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=_5.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new T5.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return oc(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ac.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return oc(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ac.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return oc(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(e=window.location.search){let r=_5.default.parse(e.slice(1));return t.isTxSignReturnSuccess(r)?this.getTxSignReturnValue(r):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ac.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ac.WALLET_PROVIDER_CALLBACK_PARAM]===ac.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new T5.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new T5.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let c=t.prepareWalletTransaction(o);for(let a in c)c.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(c[a])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};cc.WalletProvider=I5});var Fj=L(Rw=>{"use strict";h();Object.defineProperty(Rw,"__esModule",{value:!0});Rw.NativeAuthClientConfig=void 0;var C5=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Rw.NativeAuthClientConfig=C5});var N5=L(xd=>{"use strict";h();var Pu=xd&&xd.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(xd,"__esModule",{value:!0});xd.NativeAuthClient=void 0;var CAe=e0(),xAe=Fj(),x5=class{constructor(e){this.config=Object.assign(new xAe.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Pu(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return Pu(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Pu(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return Pu(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return Pu(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return Pu(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(b.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return Pu(this,void 0,void 0,function*(){return yield CAe.default.get(e,{headers:this.config.extraRequestHeaders})})}};xd.NativeAuthClient=x5});var Xj=L((zMe,Jj)=>{h();Jj.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var uc=L(Mu=>{h();var P5,PAe=[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];Mu.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};Mu.getSymbolTotalCodewords=function(e){return PAe[e]};Mu.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Mu.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');P5=e};Mu.isKanjiModeEnabled=function(){return typeof P5<"u"};Mu.toSJIS=function(e){return P5(e)}});var Fw=L(qi=>{h();qi.L={bit:1};qi.M={bit:0};qi.Q={bit:3};qi.H={bit:2};function RAe(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return qi.L;case"m":case"medium":return qi.M;case"q":case"quartile":return qi.Q;case"h":case"high":return qi.H;default:throw new Error("Unknown EC Level: "+t)}}qi.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};qi.from=function(e,r){if(qi.isValid(e))return e;try{return RAe(e)}catch{return r}}});var tQ=L((YMe,eQ)=>{h();function Zj(){this.buffer=[],this.length=0}Zj.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};eQ.exports=Zj});var nQ=L((XMe,rQ)=>{h();function Ap(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Ap.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Ap.prototype.get=function(t,e){return this.data[t*this.size+e]};Ap.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Ap.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};rQ.exports=Ap});var iQ=L(qw=>{h();var MAe=uc().getSymbolSize;qw.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=MAe(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{h();var DAe=uc().getSymbolSize,sQ=7;oQ.getPositions=function(e){let r=DAe(e);return[[0,0],[r-sQ,0],[0,r-sQ]]}});var cQ=L(ir=>{h();ir.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Du={N1:3,N2:3,N3:40,N4:10};ir.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};ir.from=function(e){return ir.isValid(e)?parseInt(e,10):void 0};ir.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,c=null;for(let a=0;a=5&&(n+=Du.N1+(i-5)),o=f,i=1),f=e.get(u,a),f===c?s++:(s>=5&&(n+=Du.N1+(s-5)),c=f,s=1)}i>=5&&(n+=Du.N1+(i-5)),s>=5&&(n+=Du.N1+(s-5))}return n};ir.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(c,o),c>=10&&(s===1488||s===93)&&n++}return n*Du.N3};ir.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{h();var lc=Fw(),Uw=[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],kw=[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];R5.getBlocksCount=function(e,r){switch(r){case lc.L:return Uw[(e-1)*4+0];case lc.M:return Uw[(e-1)*4+1];case lc.Q:return Uw[(e-1)*4+2];case lc.H:return Uw[(e-1)*4+3];default:return}};R5.getTotalCodewordsCount=function(e,r){switch(r){case lc.L:return kw[(e-1)*4+0];case lc.M:return kw[(e-1)*4+1];case lc.Q:return kw[(e-1)*4+2];case lc.H:return kw[(e-1)*4+3];default:return}}});var uQ=L(Hw=>{h();var Ep=new Uint8Array(512),Vw=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Ep[r]=e,Vw[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Ep[r]=Ep[r-255]})();Hw.log=function(e){if(e<1)throw new Error("log("+e+")");return Vw[e]};Hw.exp=function(e){return Ep[e]};Hw.mul=function(e,r){return e===0||r===0?0:Ep[Vw[e]+Vw[r]]}});var lQ=L(Sp=>{h();var D5=uQ();Sp.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{h();var fQ=lQ();function B5(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}B5.prototype.initialize=function(e){this.degree=e,this.genPoly=fQ.generateECPolynomial(this.degree)};B5.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=fQ.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};dQ.exports=B5});var L5=L(pQ=>{h();pQ.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var F5=L(ea=>{h();var gQ="[0-9]+",LAe="[A-Z $%*+\\-./:]+",_p="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";_p=_p.replace(/u/g,"\\u");var FAe="(?:(?![A-Z0-9 $%*+\\-./:]|"+_p+`)(?:.|[\r +]))+`;ea.KANJI=new RegExp(_p,"g");ea.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ea.BYTE=new RegExp(FAe,"g");ea.NUMERIC=new RegExp(gQ,"g");ea.ALPHANUMERIC=new RegExp(LAe,"g");var qAe=new RegExp("^"+_p+"$"),UAe=new RegExp("^"+gQ+"$"),kAe=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ea.testKanji=function(e){return qAe.test(e)};ea.testNumeric=function(e){return UAe.test(e)};ea.testAlphanumeric=function(e){return kAe.test(e)}});var fc=L(Mr=>{h();var VAe=L5(),q5=F5();Mr.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Mr.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Mr.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Mr.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Mr.MIXED={bit:-1};Mr.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!VAe.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Mr.getBestModeForData=function(e){return q5.testNumeric(e)?Mr.NUMERIC:q5.testAlphanumeric(e)?Mr.ALPHANUMERIC:q5.testKanji(e)?Mr.KANJI:Mr.BYTE};Mr.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Mr.isValid=function(e){return e&&e.bit&&e.ccBits};function HAe(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Mr.NUMERIC;case"alphanumeric":return Mr.ALPHANUMERIC;case"kanji":return Mr.KANJI;case"byte":return Mr.BYTE;default:throw new Error("Unknown mode: "+t)}}Mr.from=function(e,r){if(Mr.isValid(e))return e;try{return HAe(e)}catch{return r}}});var wQ=L(Bu=>{h();var Gw=uc(),GAe=M5(),mQ=Fw(),dc=fc(),U5=L5(),vQ=7973,yQ=Gw.getBCHDigit(vQ);function zAe(t,e,r){for(let n=1;n<=40;n++)if(e<=Bu.getCapacity(n,r,t))return n}function bQ(t,e){return dc.getCharCountIndicator(t,e)+4}function jAe(t,e){let r=0;return t.forEach(function(n){let i=bQ(n.mode,e);r+=i+n.getBitsLength()}),r}function QAe(t,e){for(let r=1;r<=40;r++)if(jAe(t,r)<=Bu.getCapacity(r,e,dc.MIXED))return r}Bu.from=function(e,r){return U5.isValid(e)?parseInt(e,10):r};Bu.getCapacity=function(e,r,n){if(!U5.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=dc.BYTE);let i=Gw.getSymbolTotalCodewords(e),s=GAe.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===dc.MIXED)return o;let c=o-bQ(n,e);switch(n){case dc.NUMERIC:return Math.floor(c/10*3);case dc.ALPHANUMERIC:return Math.floor(c/11*2);case dc.KANJI:return Math.floor(c/13);case dc.BYTE:default:return Math.floor(c/8)}};Bu.getBestVersionForData=function(e,r){let n,i=mQ.from(r,mQ.M);if(Array.isArray(e)){if(e.length>1)return QAe(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return zAe(n.mode,n.getLength(),i)};Bu.getEncodedBits=function(e){if(!U5.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Gw.getBCHDigit(r)-yQ>=0;)r^=vQ<{h();var k5=uc(),EQ=1335,KAe=21522,AQ=k5.getBCHDigit(EQ);SQ.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;k5.getBCHDigit(i)-AQ>=0;)i^=EQ<{h();var WAe=fc();function Pd(t){this.mode=WAe.NUMERIC,this.data=t.toString()}Pd.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Pd.prototype.getLength=function(){return this.data.length};Pd.prototype.getBitsLength=function(){return Pd.getBitsLength(this.data.length)};Pd.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};TQ.exports=Pd});var xQ=L((I7e,CQ)=>{h();var $Ae=fc(),V5=["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 Rd(t){this.mode=$Ae.ALPHANUMERIC,this.data=t}Rd.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Rd.prototype.getLength=function(){return this.data.length};Rd.prototype.getBitsLength=function(){return Rd.getBitsLength(this.data.length)};Rd.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=V5.indexOf(this.data[r])*45;n+=V5.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(V5.indexOf(this.data[r]),6)};CQ.exports=Rd});var OQ=L((x7e,NQ)=>{h();var YAe=fc();function Md(t){this.mode=YAe.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}Md.getBitsLength=function(e){return e*8};Md.prototype.getLength=function(){return this.data.length};Md.prototype.getBitsLength=function(){return Md.getBitsLength(this.data.length)};Md.prototype.write=function(t){for(let e=0,r=this.data.length;e{h();var JAe=fc(),XAe=uc();function Dd(t){this.mode=JAe.KANJI,this.data=t}Dd.getBitsLength=function(e){return e*13};Dd.prototype.getLength=function(){return this.data.length};Dd.prototype.getBitsLength=function(){return Dd.getBitsLength(this.data.length)};Dd.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};PQ.exports=Dd});var MQ=L((R7e,H5)=>{"use strict";h();var Tp={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Tp.PriorityQueue.make();s.push(e,0);for(var o,c,a,u,f,p,S,I,N;!s.empty();){o=s.pop(),c=o.value,u=o.cost,f=t[c]||{};for(a in f)f.hasOwnProperty(a)&&(p=f[a],S=u+p,I=i[a],N=typeof i[a]>"u",(N||I>S)&&(i[a]=S,s.push(a,S),n[a]=c))}if(typeof r<"u"&&typeof i[r]>"u"){var R=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(R)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Tp.single_source_shortest_paths(t,e,r);return Tp.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Tp.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof H5<"u"&&(H5.exports=Tp)});var VQ=L(Bd=>{h();var zt=fc(),LQ=IQ(),FQ=xQ(),qQ=OQ(),UQ=RQ(),Ip=F5(),zw=uc(),ZAe=MQ();function DQ(t){return unescape(encodeURIComponent(t)).length}function Cp(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function kQ(t){let e=Cp(Ip.NUMERIC,zt.NUMERIC,t),r=Cp(Ip.ALPHANUMERIC,zt.ALPHANUMERIC,t),n,i;return zw.isKanjiModeEnabled()?(n=Cp(Ip.BYTE,zt.BYTE,t),i=Cp(Ip.KANJI,zt.KANJI,t)):(n=Cp(Ip.BYTE_KANJI,zt.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,c){return o.index-c.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function G5(t,e){switch(e){case zt.NUMERIC:return LQ.getBitsLength(t);case zt.ALPHANUMERIC:return FQ.getBitsLength(t);case zt.KANJI:return UQ.getBitsLength(t);case zt.BYTE:return qQ.getBitsLength(t)}}function e2e(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function t2e(t){let e=[];for(let r=0;r{h();var Qw=uc(),z5=Fw(),n2e=tQ(),i2e=nQ(),s2e=iQ(),o2e=aQ(),K5=cQ(),W5=M5(),a2e=hQ(),jw=wQ(),c2e=_Q(),u2e=fc(),j5=VQ();function l2e(t,e){let r=t.size,n=o2e.getPositions(e);for(let i=0;i=0&&c<=6&&(a===0||a===6)||a>=0&&a<=6&&(c===0||c===6)||c>=2&&c<=4&&a>=2&&a<=4?t.set(s+c,o+a,!0,!0):t.set(s+c,o+a,!1,!0))}}function f2e(t){let e=t.size;for(let r=8;r>c&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function Q5(t,e,r){let n=t.size,i=c2e.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function p2e(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let c=r-1;c>0;c-=2)for(c===6&&c--;;){for(let a=0;a<2;a++)if(!t.isReserved(i,c-a)){let u=!1;o>>s&1)===1),t.set(i,c-a,u),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function g2e(t,e,r){let n=new n2e;r.forEach(function(a){n.put(a.mode.bit,4),n.put(a.getLength(),u2e.getCharCountIndicator(a.mode,t)),a.write(n)});let i=Qw.getSymbolTotalCodewords(t),s=W5.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let c=(o-n.getLengthInBits())/8;for(let a=0;a=7&&vge(a,e),Age(a,o),isNaN(n)&&(n=YC.getBestMask(a,$C.bind(null,a,r))),YC.applyMask(n,a),$C(a,r,n),{modules:a,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}RV.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=KC.M,i,s;return typeof r<"u"&&(n=KC.from(r.errorCorrectionLevel,KC.M),i=Z1.from(r.version),s=YC.from(r.maskPattern),r.toSJISFunc&&ew.setToSJISFunction(r.toSJISFunc)),Sge(e,i,n,s)}});var XC=D(Su=>{h();function MV(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}Su.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:MV(e.color.dark||"#000000ff"),light:MV(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Su.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Su.getImageWidth=function(e,r){let n=Su.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Su.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Su.getScale(i,n),u=Math.floor((i+n.margin*2)*o),a=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=a&&d>=a&&f{h();var ZC=XC();function Ige(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function _ge(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}tw.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=_ge()),i=ZC.getOptions(i);let o=ZC.getImageWidth(e.modules.size,i),u=s.getContext("2d"),a=u.createImageData(o,o);return ZC.qrToImageData(a.data,e,i),Ige(u,s,o),u.putImageData(a,0,0),s};tw.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=tw.render(e,r,i),o=i.type||"image/png",u=i.rendererOpts||{};return s.toDataURL(o,u.quality)}});var qV=D(UV=>{h();var Tge=XC();function FV(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function e3(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Cge(t,e,r){let n="",i=0,s=!1,o=0;for(let u=0;u0&&a>0&&t[u-1]||(n+=s?e3("M",a+r,.5+c+r):e3("m",i,0),i=0,s=!1),a+1':"",c="',f='viewBox="0 0 '+u+" "+u+'"',w=''+a+c+` -`;return typeof n=="function"&&n(null,w),w}});var kV=D(Nd=>{h();var Nge=k9(),t3=BV(),VV=LV(),xge=qV();function r3(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,u=typeof s[o-1]=="function";if(!u&&!Nge())throw new Error("Callback required as last argument");if(u){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(a,c){try{let f=t3.create(r,n);a(t(f,e,n))}catch(f){c(f)}})}try{let a=t3.create(r,n);i(null,t(a,e,n))}catch(a){i(a)}}Nd.create=t3.create;Nd.toCanvas=r3.bind(null,VV.render);Nd.toDataURL=r3.bind(null,VV.renderToDataURL);Nd.toString=r3.bind(null,function(t,e,r){return xge.render(t,r)})});var XV=D(ua=>{"use strict";h();var Vge=ua&&ua.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JV=ua&&ua.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vge(e,t,r)};Object.defineProperty(ua,"__esModule",{value:!0});JV(Ol(),ua);JV(J2(),ua)});var uk=D(aw=>{"use strict";h();Object.defineProperty(aw,"__esModule",{value:!0});aw.isWindowAvailable=void 0;var kge=()=>typeof window<"u"&&typeof window?.location<"u";aw.isWindowAvailable=kge});var o3=D(uw=>{"use strict";h();Object.defineProperty(uw,"__esModule",{value:!0});uw.getTargetOrigin=void 0;var Hge=uk(),Gge=()=>{var t;if((0,Hge.isWindowAvailable)()){let e=window.location.ancestorOrigins;return(t=e?.[e.length-1])!==null&&t!==void 0?t:"*"}return"*"};uw.getTargetOrigin=Gge});var cw=D(ca=>{"use strict";h();Object.defineProperty(ca,"__esModule",{value:!0});ca.SignMessageStatusEnum=ca.CrossWindowProviderResponseEnums=ca.CrossWindowProviderRequestEnums=void 0;var ck;(function(t){t.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",t.guardTransactionsRequest="GUARD_TRANSACTIONS_REQUEST",t.signMessageRequest="SIGN_MESSAGE_REQUEST",t.loginRequest="LOGIN_REQUEST",t.logoutRequest="LOGOUT_REQUEST",t.cancelAction="CANCEL_ACTION_REQUEST",t.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",t.finalizeResetStateRequest="FINALIZE_RESET_STATE_REQUEST"})(ck||(ca.CrossWindowProviderRequestEnums=ck={}));var lk;(function(t){t.handshakeResponse="HANDSHAKE_RESPONSE",t.guardTransactionsResponse="GUARD_TRANSACTIONS_RESPONSE",t.loginResponse="LOGIN_RESPONSE",t.disconnectResponse="DISCONNECT_RESPONSE",t.cancelResponse="CANCEL_RESPONSE",t.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",t.signMessageResponse="SIGN_MESSAGE_RESPONSE",t.noneResponse="NONE_RESPONSE",t.resetStateResponse="RESET_STATE_RESPONSE"})(lk||(ca.CrossWindowProviderResponseEnums=lk={}));var fk;(function(t){t.pending="pending",t.failed="failed",t.signed="signed",t.cancelled="cancelled"})(fk||(ca.SignMessageStatusEnum=fk={}))});var fw=D(lw=>{"use strict";h();Object.defineProperty(lw,"__esModule",{value:!0});lw.getSafeWindow=void 0;var jge=()=>typeof window<"u"?window:{};lw.getSafeWindow=jge});var hk=D(hw=>{"use strict";h();Object.defineProperty(hw,"__esModule",{value:!0});hw.isMobileWebview=void 0;var zge=fw(),Qge=()=>{let t=(0,zge.getSafeWindow)();return t.ReactNativeWebView||t.webkit};hw.isMobileWebview=Qge});var a3=D(dw=>{"use strict";h();Object.defineProperty(dw,"__esModule",{value:!0});dw.getSafeDocument=void 0;var Kge=()=>typeof document<"u"?document:{};dw.getSafeDocument=Kge});var gk=D(Kl=>{"use strict";h();Object.defineProperty(Kl,"__esModule",{value:!0});Kl.webviewProviderEventHandler=void 0;var Wge=o3(),$ge=cw(),dk=hk(),Yge=fw(),Jge=a3(),Xge=(t,e)=>r=>{var n,i,s,o;let u=r.data;try{u=(0,dk.isMobileWebview)()&&typeof u=="string"?JSON.parse(u):u}catch{console.error("error parsing eventData",u)}let{type:a,payload:c}=u;!(0,dk.isMobileWebview)()&&r.origin!=(0,Wge.getTargetOrigin)()||!(t===a||a===$ge.CrossWindowProviderResponseEnums.cancelResponse)||((i=(n=(0,Yge.getSafeWindow)()).removeEventListener)===null||i===void 0||i.call(n,"message",(0,Kl.webviewProviderEventHandler)(t,e)),(o=(s=(0,Jge.getSafeDocument)()).removeEventListener)===null||o===void 0||o.call(s,"message",(0,Kl.webviewProviderEventHandler)(t,e)),e({type:a,payload:c}))};Kl.webviewProviderEventHandler=Xge});var pk=D(Wl=>{"use strict";h();Object.defineProperty(Wl,"__esModule",{value:!0});Wl.safeWindow=Wl.responseTypeMap=void 0;var Vr=cw();Wl.responseTypeMap={[Vr.CrossWindowProviderRequestEnums.signTransactionsRequest]:Vr.CrossWindowProviderResponseEnums.signTransactionsResponse,[Vr.CrossWindowProviderRequestEnums.guardTransactionsRequest]:Vr.CrossWindowProviderResponseEnums.guardTransactionsResponse,[Vr.CrossWindowProviderRequestEnums.signMessageRequest]:Vr.CrossWindowProviderResponseEnums.signMessageResponse,[Vr.CrossWindowProviderRequestEnums.loginRequest]:Vr.CrossWindowProviderResponseEnums.loginResponse,[Vr.CrossWindowProviderRequestEnums.logoutRequest]:Vr.CrossWindowProviderResponseEnums.disconnectResponse,[Vr.CrossWindowProviderRequestEnums.cancelAction]:Vr.CrossWindowProviderResponseEnums.cancelResponse,[Vr.CrossWindowProviderRequestEnums.finalizeHandshakeRequest]:Vr.CrossWindowProviderResponseEnums.noneResponse,[Vr.CrossWindowProviderRequestEnums.finalizeResetStateRequest]:Vr.CrossWindowProviderResponseEnums.resetStateResponse};Wl.safeWindow=typeof window<"u"?window:{}});var yk=D($l=>{"use strict";h();var ni=$l&&$l.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty($l,"__esModule",{value:!0});$l.WebviewProvider=void 0;var Zge=en(),u3=gk(),ii=cw(),epe=pk(),mk=o3(),c3=fw(),tpe=a3(),l3=class t{static getInstance(e){return t._instance||(t._instance=new t(e)),t._instance}constructor(e){this.resetState=r=>{var n,i;(i=(n=(0,c3.getSafeWindow)()).addEventListener)===null||i===void 0||i.call(n,"message",(0,u3.webviewProviderEventHandler)(ii.CrossWindowProviderResponseEnums.resetStateResponse,s=>{s.type===ii.CrossWindowProviderResponseEnums.resetStateResponse&&(r?.(),setTimeout(()=>{this.finalizeResetState()},500))}))},this.init=()=>ni(this,void 0,void 0,function*(){return this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.finalizeHandshakeRequest,payload:void 0}),!0}),this.login=()=>ni(this,void 0,void 0,function*(){return!0}),this.logout=()=>ni(this,void 0,void 0,function*(){return!!(yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.logoutRequest,payload:void 0})).payload.data}),this.relogin=()=>ni(this,void 0,void 0,function*(){let r=yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.loginRequest,payload:void 0}),{data:n,error:i}=r.payload;if(i||!n)throw new Error("Unable to re-login");let{accessToken:s}=n;return s||(console.error("Unable to re-login. Missing accessToken."),null)}),this.signTransactions=r=>ni(this,void 0,void 0,function*(){let n=yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.signTransactionsRequest,payload:r.map(o=>o.toPlainObject())}),{data:i,error:s}=n.payload;return s||!i?(console.error("Unable to sign transactions"),null):n.type==ii.CrossWindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the transactions signing action"),this.cancelAction(),null):i.map(o=>Zge.Transaction.fromPlainObject(o))}),this.signTransaction=r=>ni(this,void 0,void 0,function*(){let n=yield this.signTransactions([r]);return n?.[0]}),this.signMessage=r=>ni(this,void 0,void 0,function*(){let n=yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.signMessageRequest,payload:{message:r.message.toString()}}),{data:i,error:s}=n.payload;return s||!i?(console.error("Unable to sign message"),null):n.type==ii.CrossWindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the message signing action"),this.cancelAction(),null):i.status!==ii.SignMessageStatusEnum.signed?(console.error("Could not sign message"),null):(r.applySignature(p.Buffer.from(String(i.signature),"hex")),r)}),this.cancelAction=()=>ni(this,void 0,void 0,function*(){return this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.cancelAction,payload:void 0})}),this.finalizeResetState=()=>ni(this,void 0,void 0,function*(){return this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.finalizeResetStateRequest,payload:void 0})}),this.isInitialized=()=>!0,this.isConnected=()=>ni(this,void 0,void 0,function*(){return Promise.resolve(!0)}),this.sendPostMessage=r=>ni(this,void 0,void 0,function*(){var n,i;let s=(0,c3.getSafeWindow)();return s.ReactNativeWebView?s.ReactNativeWebView.postMessage(JSON.stringify(r)):s.webkit?(i=(n=s.webkit.messageHandlers)===null||n===void 0?void 0:n.jsHandler)===null||i===void 0||i.postMessage(JSON.stringify(r),(0,mk.getTargetOrigin)()):s.parent&&s.parent.postMessage(r,(0,mk.getTargetOrigin)()),yield this.waitingForResponse(epe.responseTypeMap[r.type])}),this.waitingForResponse=r=>ni(this,void 0,void 0,function*(){return yield new Promise(n=>{var i,s,o,u;(s=(i=(0,c3.getSafeWindow)()).addEventListener)===null||s===void 0||s.call(i,"message",(0,u3.webviewProviderEventHandler)(r,n)),(u=(o=(0,tpe.getSafeDocument)()).addEventListener)===null||u===void 0||u.call(o,"message",(0,u3.webviewProviderEventHandler)(r,n))})}),e?.resetStateCallback&&this.resetState(e.resetStateCallback)}};$l.WebviewProvider=l3});var f3=D(Iu=>{"use strict";h();var rpe=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),npe=Iu&&Iu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rpe(e,t,r)};Object.defineProperty(Iu,"__esModule",{value:!0});npe(yk(),Iu)});h();var m3=ge(Ia(),1),y3=ge(Fb(),1),yw=ge(d0(),1),w3=ge(Hb(),1),ape=ge(ke(),1),upe=ge(Sc(),1),cpe=ge(en(),1),lpe=ge(N0(),1),Ik=ge(zb(),1),fpe=ge(V0(),1),hpe=ge(H0(),1),_k=ge(go(),1),_s=ge(Lf(),1),Tk=ge(wf(),1),Ck=ge(Wu(),1),dpe=ge(FE(),1),gpe=ge(tS(),1);h();h();var VP=ge(iS(),1);h();h();var G0="elvenjs_state",FP="https://devnet-api.multiversx.com";var Do="/dapp/init",j0="devnet",UP="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",qP=["wss://relay.walletconnect.com"],Br={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var ye={get(t){let e=localStorage.getItem(G0);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(G0,JSON.stringify(r))},clear(){localStorage.removeItem(G0)}};var z0=async()=>{let t=VP.ExtensionProvider.getInstance();try{let e=await t.init(),r=ye.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var h3=ge(iS(),1),d3=ge(ld(),1),g3=ge(Ol(),1),Sk=ge(bC(),1),xd=ge(H0(),1);h();var w9=ge(ld(),1);h();h();var pe=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};h();var y9=(U=>(U.onLoginStart="onLoginStart",U.onLoginSuccess="onLoginSuccess",U.onLoginFailure="onLoginFailure",U.onLogoutStart="onLogoutStart",U.onLogoutSuccess="onLogoutSuccess",U.onLogoutFailure="onLogoutFailure",U.onQrPending="onQrPending",U.onQrLoaded="onQrLoaded",U.onTxStart="onTxStart",U.onTxSent="onTxSent",U.onTxFinalized="onTxFinalized",U.onTxFailure="onTxFailure",U.onSignMsgStart="onSignMsgStart",U.onSignMsgFinalized="onSignMsgFinalized",U.onSignMsgFailure="onSignMsgFailure",U.onQueryStart="onQueryStart",U.onQueryFinalized="onQueryFinalized",U.onQueryFailure="onQueryFailure",U))(y9||{}),SC=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(SC||{}),Pde=(r=>(r.mvx_cancelAction="mvx_cancelAction",r.mvx_signNativeAuthToken="mvx_signNativeAuthToken",r))(Pde||{}),Rde=(e=>(e.hasWebWalletGuardianSign="hasWebWalletGuardianSign",e))(Rde||{});h();var Kt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Ll=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");pe.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(ye.clear(),pe.run("onLogoutSuccess")),e}catch(e){let r=Kt(e);console.warn(`Something went wrong trying to logout the user: ${r}`),pe.run("onLogoutFailure",r)}};h();function M1(t){return t[Math.floor(Math.random()*t.length)]}var v9=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{},onClientLogout:()=>Ll(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=M1(t.initOptions.walletConnectV2RelayAddresses),n=new w9.WalletConnectV2Provider(e,Br[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};h();var H1=ge(ke(),1),O9=ge(A9(),1),D9=ge(b9(),1),P9=ge(DC(),1),R9=ge(N9(),1),B9=ge(tS(),1),M9=ge(x9(),1),L9=ge(Wf(),1);var G1=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||j0,this.apiUrl=e||Br[this.chainType]?.apiAddress,this.apiTimeout=n||Br[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),u=await o.json();if(!o.ok){let a=u?.error||o.status;return clearTimeout(i),Promise.reject(a)}return clearTimeout(i),u}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let u=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),a=await u.json();if(!u.ok){let c=a?.error||u.status;return clearTimeout(s),Promise.reject(c)}return clearTimeout(s),a}catch(u){this.handleApiError(u,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new H1.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new O9.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new H1.Address(r.sender),receiver:new H1.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:p.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:D9.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:P9.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:R9.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new L9.Query({address:e,func:r,args:n,value:i,caller:s}),u=new M9.ContractQueryRequest(o).toHttpRequest(),a=await this.apiPost("query",u);return B9.ContractQueryResponse.fromHttpResponse(a)}catch(o){this.handleApiError(o,"query")}}};h();h();var Vl=()=>new Date().setHours(new Date().getHours()+24),j1=t=>Date.now()>t;h();var F9=ge(ke(),1),U9=ge(Sc(),1);var vu=async t=>{let e=ye.get("address"),r=ye.get("expires");if(!(r&&j1(r))&&e&&t.networkProvider){let i=new F9.Address(e),s=new U9.Account(i);try{let o=await t.networkProvider.getAccount(i),u=await t.networkProvider.getGuardianData(i);ye.set("address",e),ye.set("activeGuardian",u.guarded&&u.activeGuardian?.address?u.activeGuardian.address:""),ye.set("nonce",o.nonce.valueOf()),ye.set("balance",o.balance.toString()),s.update(o)}catch(o){let u=Kt(o);console.warn(`Something went wrong trying to synchronize the user account: ${u}`)}}};var q9=async(t,e,r,n="/")=>{let i=await z0(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i&&!await i.login(o))throw new Error("There were problems while logging in!")}catch(a){let c=Kt(a);throw new Error(c)}if(!i)throw new Error("There were problems with auth provider initialization!");let{signature:u}=i.account;if(ye.set("loginToken",e),u&&ye.set("signature",u),t.networkProvider&&u)try{let a=await i.getAddress();if(!a)throw new Error("Canceled!");ye.set("address",a),ye.set("loginMethod","browser-extension"),ye.set("expires",Vl()),await vu(t);let c=r.getToken(a,e,u);return ye.set("accessToken",c),pe.run("onLoginSuccess"),i}catch(a){throw new Error(`Something went wrong trying to synchronize the user account: ${a?.message}`)}};h();h();var HV=ge(kV(),1),GV=ge(ld(),1);var Oge=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Dge=t=>{let e=`${UP}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},Pge=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Rge=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},n3={},Bge=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",n3[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:n3[t.topic].signal}),r},rw={},Mge=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=Bge(t,e);return n.appendChild(s),rw[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:rw[t.topic].signal}),n},Lge=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},Fge=t=>{if(!t)return;document.getElementById(t)?.remove()},Uge=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),qge=async t=>t?await HV.default.toString(t,{type:"svg"}):void 0,jV=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await qge(e),o;if(s&&(o=Oge(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),Uge()&&i.appendChild(Dge(e))),i&&r instanceof GV.WalletConnectV2Provider){let u=r.pairings,a=async f=>{try{f&&(await r.logout({topic:f}),Fge(f))}catch(d){let w=Kt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${w}`)}finally{rw[f].abort()}},c=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(Lge()),await r.login({approval:d,token:n})}catch(d){let w=Kt(d);console.warn(`Something went wrong trying to login the user: ${w}`)}finally{for(let d of Object.values(rw))d?.abort();for(let d of Object.values(n3))d?.abort()}};if(u&&u.length>0){let f=Pge();i.appendChild(f);let d=Rge();f.appendChild(d);for(let w of u){let A=Mge(w,a,c);f.appendChild(A)}}}return i};var nw=ge(ld(),1);var zV=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=M1(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof nw.WalletConnectV2Provider){let a=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();ye.set("address",a),ye.set("loginMethod","mobile"),ye.set("expires",Vl()),await vu(t),c&&ye.set("signature",c),ye.set("loginToken",e);let f=r.getToken(a,e,c);ye.set("accessToken",f),pe.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof nw.WalletConnectV2Provider&&await Ll(t)},onClientEvent:a=>{console.log("wc2 session event: ",a)}},u=new nw.WalletConnectV2Provider(o,Br[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(u){t.dappProvider=u,pe.run("onQrPending"),await u.init();let{uri:a,approval:c}=await u.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${a}&token=${e}`:a;return n&&f&&(s=await jV(n,f,u,e),pe.run("onQrLoaded")),await u.login({approval:c,token:e}),u}}catch(a){let c=Kt(a);console.warn(`Something went wrong trying to login the user: ${c}`),pe.run("onLoginFailure",c)}};h();var QV=ge(Ol(),1);var i3=async(t,e,r,n)=>{let i=new QV.WalletProvider(`${t}${Do}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return ye.set("loginMethod",Br[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),ye.set("expires",Vl()),ye.set("loginToken",e),i}catch(u){let a=Kt(u);console.warn(`Something went wrong trying to login the user: ${a}`),ye.set("loginMethod",""),pe.run("onLoginFailure",a)}};h();var fn=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};h();var KV=ge(Ol(),1);var WV=ge(bC(),1),s3=async(t,e)=>{let r=fn("signature"),n=fn("address"),i=ye.get("address"),s=ye.get("loginToken");if(r&&ye.set("signature",r),n||i){n&&(ye.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new KV.WalletProvider(`${t}${Do}`);if(r&&e&&n){let a=new WV.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);ye.set("accessToken",a)}return o}};h();var $V=ge(Sc(),1),YV=ge(V0(),1);var iw=async(t,e)=>{pe.run("onTxSent",t);let n=await new YV.TransactionWatcher(e).awaitCompleted(t),i=n.sender,s=new $V.Account(i),o=await e.getAccount(i);s.update(o),ye.set("address",s.address.bech32()),ye.set("balance",s.balance.toString()),pe.run("onTxFinalized",n)};h();var Ql=ge(XV(),1),ek=ge(en(),1);h();var ZV=ge(Sc(),1);var sw=t=>{let e=t.getSender(),r=new ZV.Account(e),n=t.nonce.valueOf();r.incrementNonce(),ye.set("nonce",(n+1n).toString())};var tk=async(t,e,r,n)=>{if(fn(Ql.WALLET_PROVIDER_CALLBACK_PARAM)===Ql.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=ye.get("activeGuardian"),o=ye.get("loginMethod"),u=fn("hasWebWalletGuardianSign"),a;if("getTransactionsFromWalletUrl"in t){if(a=t.getTransactionsFromWalletUrl()?.[0],!a)return;o==="web-wallet"&&(a.data=p.Buffer.from(a.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&u&&(a=new Ql.WalletProvider(`${r}${Do}`).getTransactionsFromWalletUrl()?.[0]);if(a){let c=ek.Transaction.fromPlainObject(a);c.nonce=BigInt(n),sw(c);try{pe.run("onTxStart",c),await e.sendTransaction(c),await iw(c,e)}catch(f){let w=`Getting transaction information failed! ${Kt(f)}`;throw pe.run("onTxFailure",c,w),new Error(w)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};h();var ow=ge(Jl(),1),rk=ge(ke(),1),nk=ge(Ol(),1);var ik=t=>{let e=ye.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(ow.TransactionVersion.withTxOptions()),t.setOptions(ow.TransactionOptions.withOptions(r)),t.setGuardian(rk.Address.fromBech32(e))}return t},sk=async(t,e)=>{let r=new nk.WalletProvider(`${e}${Do}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},ok=t=>{let e=ye.get("activeGuardian");return!(!ye.get("address")||!e||t.isGuardedTransaction())};h();var ak=()=>{let t=!fn("walletProviderStatus"),e=fn("status")==="signed",r=fn("message"),n=fn("signature");t&&e&&r&&n&&(pe.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};var mw=ge(f3(),1);h();h();h();function ipe(t){try{let e=atob(t),r=btoa(e),n=p.Buffer.from(t,"base64").toString(),i=p.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Yl(t){return ipe(t)?atob(t):t}h();var gw=t=>Object.prototype.toString.call(t)==="[object String]";h();var wk=t=>{if(!t||!gw(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Yl(s)),u=Yl(r);return{ttl:Number(i),extraInfo:o,origin:u,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var vk=t=>{if(!t||!gw(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Yl(r),o=Yl(n),u=wk(o);if(!u)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let a={...u,address:s,body:o,signature:i};return u.extraInfo?.timestamp||delete a.extraInfo,a}catch{return null}};var Ak=ge(f3(),1);function Ek(t,e){let r=vk(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(ye.set("loginToken",s),ye.set("accessToken",t),ye.set("signature",n),ye.set("address",i),ye.set("loginMethod","x-portal-hub"),e.dappProvider=new Ak.WebviewProvider)}h();var bk=t=>{t.onLoginStart&&pe.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&pe.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&pe.set("onLoginFailure",t.onLoginFailure),t.onLogoutStart&&pe.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&pe.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&pe.set("onLogoutFailure",t.onLogoutFailure),t.onQrPending&&pe.set("onQrPending",t.onQrPending),t.onQrLoaded&&pe.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&pe.set("onTxStart",t.onTxStart),t.onTxSent&&pe.set("onTxSent",t.onTxSent),t.onTxFinalized&&pe.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&pe.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&pe.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&pe.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&pe.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&pe.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&pe.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&pe.set("onQueryFailure",t.onQueryFailure)};h();var pw=async t=>{pe.run("onLoginStart");try{await t(()=>{pe.run("onLoginSuccess")})}catch(e){let r=Kt(e);console.warn(`Something went wrong trying to login the user: ${r}`),pe.run("onLoginFailure",r)}};var p3=class{static async init(e){let r=ye.get();if(r.expires&&j1(r.expires)){ye.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:j0,apiUrl:FP,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:qP,...e},this.networkProvider=new G1(this.initOptions),bk(this.initOptions);let n=fn("accessToken");n&&await pw(async s=>{Ek(n,this),await vu(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&fn("address"))&&r?.loginMethod&&(await pw(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await z0()),r.loginMethod==="mobile"&&(this.dappProvider=await v9(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new mw.WebviewProvider),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await s3(Br[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await s3(Br[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await vu(this),s()}),this.initOptions?.chainType&&(await tk(this.dappProvider,this.networkProvider,Br[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),ak()))}static async login(e,r){if(!Object.values(SC).includes(e)){let i="Wrong login method!";throw pe.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw pe.run("onLoginFailure",i),new Error(i)}await pw(async()=>{let i=new Sk.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await q9(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await zV(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await i3(Br[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await i3(Br[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}})}static async logout(){try{let e=await Ll(this);return this.dappProvider=void 0,e}catch(e){let r=Kt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw pe.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw pe.run("onTxFailure",e,n),new Error(n)}let r=ik(e);try{pe.run("onTxStart",e);let n=ye.get();if(e.nonce=n.nonce,this.dappProvider instanceof h3.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof d3.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof mw.WebviewProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof g3.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=ok(r);if(i||sw(r),i&&this.initOptions?.chainType){await sk(r,Br[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await iw(r,this.networkProvider)}}catch(n){let i=Kt(n);throw pe.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw pe.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw pe.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(pe.run("onSignMsgStart",e),this.dappProvider instanceof h3.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof d3.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof mw.WebviewProvider&&(n=(await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)})))?.getSignature().toString("hex")||""),this.dappProvider instanceof g3.WalletProvider){let s=u=>encodeURIComponent(u).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),o=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${o}${o.includes("?")?"&":"?"}message=${s(e)}`)})}let i=ye.get();return i.loginMethod!=="web-wallet"&&i.loginMethod!=="x-alias"&&pe.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Kt(i);throw pe.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{pe.run("onQueryStart",o);let u=await this.networkProvider.queryContract(o);return pe.run("onQueryFinalized",u),u}catch(u){let a=Kt(u);throw pe.run("onQueryFinalized",o,a),new Error(`Smart contract query failed! ${a}`)}}static{this.storage=ye}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,pe.clear()}}};h();nr();Nu.config({ROUNDING_MODE:Nu.ROUND_FLOOR});var spe=({amount:t,decimals:e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return BigInt(new Nu(t).shiftedBy(e).toFixed())},ope=({amount:t,decimals:e,rounding:r=e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return new Nu(t).shiftedBy(-e).decimalPlaces(r).toFixed()};var export_Account=upe.Account;var export_Address=ape.Address;var export_AddressType=Ck.AddressType;var export_AddressValue=Ck.AddressValue;var export_BigUIntType=_s.BigUIntType;var export_BigUIntValue=_s.BigUIntValue;var export_BooleanType=Tk.BooleanType;var export_BooleanValue=Tk.BooleanValue;var export_BytesType=_k.BytesType;var export_BytesValue=_k.BytesValue;var export_ContractQueryResponse=gpe.ContractQueryResponse;var export_Message=Ik.Message;var export_MessageComputer=Ik.MessageComputer;var export_QueryArguments=dpe.QueryArguments;var export_SignableMessage=hpe.SignableMessage;var export_SmartContractTransactionsFactory=yw.SmartContractTransactionsFactory;var export_SmartContractTransactionsOutcomeParser=w3.SmartContractTransactionsOutcomeParser;var export_Token=m3.Token;var export_TokenComputer=m3.TokenComputer;var export_TokenManagementTransactionsFactory=yw.TokenManagementTransactionsFactory;var export_TokenManagementTransactionsOutcomeParser=w3.TokenManagementTransactionsOutcomeParser;var export_TokenOperationsFactory=y3.TokenOperationsFactory;var export_TokenOperationsFactoryConfig=y3.TokenOperationsFactoryConfig;var export_TokenOperationsOutcomeParser=y3.TokenOperationsOutcomeParser;var export_TokenTransfer=m3.TokenTransfer;var export_Transaction=cpe.Transaction;var export_TransactionComputer=lpe.TransactionComputer;var export_TransactionEventsParser=w3.TransactionEventsParser;var export_TransactionWatcher=fpe.TransactionWatcher;var export_TransactionsFactoryConfig=yw.TransactionsFactoryConfig;var export_TransferTransactionsFactory=yw.TransferTransactionsFactory;var export_U16Type=_s.U16Type;var export_U16Value=_s.U16Value;var export_U32Type=_s.U32Type;var export_U32Value=_s.U32Value;var export_U64Type=_s.U64Type;var export_U64Value=_s.U64Value;var export_U8Type=_s.U8Type;var export_U8Value=_s.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractQueryResponse as ContractQueryResponse,Pde as DappCoreWCV2CustomMethodsEnum,p3 as ElvenJS,y9 as EventStoreEvents,SC as LoginMethodsEnum,export_Message as Message,export_MessageComputer as MessageComputer,export_QueryArguments as QueryArguments,export_SignableMessage as SignableMessage,export_SmartContractTransactionsFactory as SmartContractTransactionsFactory,export_SmartContractTransactionsOutcomeParser as SmartContractTransactionsOutcomeParser,export_Token as Token,export_TokenComputer as TokenComputer,export_TokenManagementTransactionsFactory as TokenManagementTransactionsFactory,export_TokenManagementTransactionsOutcomeParser as TokenManagementTransactionsOutcomeParser,export_TokenOperationsFactory as TokenOperationsFactory,export_TokenOperationsFactoryConfig as TokenOperationsFactoryConfig,export_TokenOperationsOutcomeParser as TokenOperationsOutcomeParser,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionComputer as TransactionComputer,export_TransactionEventsParser as TransactionEventsParser,export_TransactionWatcher as TransactionWatcher,export_TransactionsFactoryConfig as TransactionsFactoryConfig,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value,Rde as WebWalletUrlParamsEnum,ope as formatAmount,spe as parseAmount}; +`);let o=g2e(e,r,i),c=Qw.getSymbolSize(e),a=new i2e(c);return l2e(a,e),f2e(a),d2e(a,e),Q5(a,r,0),e>=7&&h2e(a,e),p2e(a,o),isNaN(n)&&(n=K5.getBestMask(a,Q5.bind(null,a,r))),K5.applyMask(n,a),Q5(a,r,n),{modules:a,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}HQ.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=z5.M,i,s;return typeof r<"u"&&(n=z5.from(r.errorCorrectionLevel,z5.M),i=jw.from(r.version),s=K5.from(r.maskPattern),r.toSJISFunc&&Qw.setToSJISFunction(r.toSJISFunc)),y2e(e,i,n,s)}});var $5=L(Lu=>{h();function zQ(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}Lu.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:zQ(e.color.dark||"#000000ff"),light:zQ(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Lu.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Lu.getImageWidth=function(e,r){let n=Lu.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Lu.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Lu.getScale(i,n),c=Math.floor((i+n.margin*2)*o),a=n.margin*o,u=[n.color.light,n.color.dark];for(let f=0;f=a&&p>=a&&f{h();var Y5=$5();function v2e(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function b2e(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Kw.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=b2e()),i=Y5.getOptions(i);let o=Y5.getImageWidth(e.modules.size,i),c=s.getContext("2d"),a=c.createImageData(o,o);return Y5.qrToImageData(a.data,e,i),v2e(c,s,o),c.putImageData(a,0,0),s};Kw.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Kw.render(e,r,i),o=i.type||"image/png",c=i.rendererOpts||{};return s.toDataURL(o,c.quality)}});var WQ=L(KQ=>{h();var w2e=$5();function QQ(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function J5(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function A2e(t,e,r){let n="",i=0,s=!1,o=0;for(let c=0;c0&&a>0&&t[c-1]||(n+=s?J5("M",a+r,.5+u+r):J5("m",i,0),i=0,s=!1),a+1':"",u="',f='viewBox="0 0 '+c+" "+c+'"',S=''+a+u+` +`;return typeof n=="function"&&n(null,S),S}});var YQ=L(xp=>{h();var E2e=Xj(),X5=GQ(),$Q=jQ(),S2e=WQ();function Z5(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,c=typeof s[o-1]=="function";if(!c&&!E2e())throw new Error("Callback required as last argument");if(c){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(a,u){try{let f=X5.create(r,n);a(t(f,e,n))}catch(f){u(f)}})}try{let a=X5.create(r,n);i(null,t(a,e,n))}catch(a){i(a)}}xp.create=X5.create;xp.toCanvas=Z5.bind(null,$Q.render);xp.toDataURL=Z5.bind(null,$Q.renderToDataURL);xp.toString=Z5.bind(null,function(t,e,r){return S2e.render(t,r)})});var aK=L(hc=>{"use strict";h();var D2e=hc&&hc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oK=hc&&hc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&D2e(e,t,r)};Object.defineProperty(hc,"__esModule",{value:!0});oK(Cd(),hc);oK(w5(),hc)});var yK=L(Zw=>{"use strict";h();Object.defineProperty(Zw,"__esModule",{value:!0});Zw.isWindowAvailable=void 0;var B2e=()=>typeof window<"u"&&typeof window?.location<"u";Zw.isWindowAvailable=B2e});var nC=L(eA=>{"use strict";h();Object.defineProperty(eA,"__esModule",{value:!0});eA.getTargetOrigin=void 0;var L2e=yK(),F2e=()=>{var t;if((0,L2e.isWindowAvailable)()){let e=window.location.ancestorOrigins;return(t=e?.[e.length-1])!==null&&t!==void 0?t:"*"}return"*"};eA.getTargetOrigin=F2e});var rA=L(tA=>{"use strict";h();Object.defineProperty(tA,"__esModule",{value:!0});tA.getSafeWindow=void 0;var q2e=()=>typeof window<"u"?window:{};tA.getSafeWindow=q2e});var vK=L(nA=>{"use strict";h();Object.defineProperty(nA,"__esModule",{value:!0});nA.isMobileWebview=void 0;var U2e=rA(),k2e=()=>{let t=(0,U2e.getSafeWindow)();return t.ReactNativeWebView||t.webkit};nA.isMobileWebview=k2e});var iC=L(iA=>{"use strict";h();Object.defineProperty(iA,"__esModule",{value:!0});iA.getSafeDocument=void 0;var V2e=()=>typeof document<"u"?document:{};iA.getSafeDocument=V2e});var sC=L(pc=>{"use strict";h();Object.defineProperty(pc,"__esModule",{value:!0});pc.WindowProviderResponseEnums=pc.WindowProviderRequestEnums=void 0;var H2e;(function(t){t.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",t.guardTransactionsRequest="GUARD_TRANSACTIONS_REQUEST",t.signMessageRequest="SIGN_MESSAGE_REQUEST",t.loginRequest="LOGIN_REQUEST",t.logoutRequest="LOGOUT_REQUEST",t.cancelAction="CANCEL_ACTION_REQUEST",t.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",t.finalizeResetStateRequest="FINALIZE_RESET_STATE_REQUEST"})(H2e=pc.WindowProviderRequestEnums||(pc.WindowProviderRequestEnums={}));var G2e;(function(t){t.handshakeResponse="HANDSHAKE_RESPONSE",t.guardTransactionsResponse="GUARD_TRANSACTIONS_RESPONSE",t.loginResponse="LOGIN_RESPONSE",t.disconnectResponse="DISCONNECT_RESPONSE",t.cancelResponse="CANCEL_RESPONSE",t.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",t.signMessageResponse="SIGN_MESSAGE_RESPONSE",t.noneResponse="NONE_RESPONSE",t.resetStateResponse="RESET_STATE_RESPONSE"})(G2e=pc.WindowProviderResponseEnums||(pc.WindowProviderResponseEnums={}))});var wK=L(Fd=>{"use strict";h();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.webviewProviderEventHandler=void 0;var z2e=nC(),bK=vK(),j2e=rA(),Q2e=iC(),K2e=sC(),W2e=(t,e)=>r=>{var n,i,s,o;let c=r.data;try{c=(0,bK.isMobileWebview)()&&typeof c=="string"?JSON.parse(c):c}catch{console.error("error parsing eventData",c)}let{type:a,payload:u}=c;!(0,bK.isMobileWebview)()&&r.origin!=(0,z2e.getTargetOrigin)()||!(t===a||a===K2e.WindowProviderResponseEnums.cancelResponse)||((i=(n=(0,j2e.getSafeWindow)()).removeEventListener)===null||i===void 0||i.call(n,"message",(0,Fd.webviewProviderEventHandler)(t,e)),(o=(s=(0,Q2e.getSafeDocument)()).removeEventListener)===null||o===void 0||o.call(s,"message",(0,Fd.webviewProviderEventHandler)(t,e)),e({type:a,payload:u}))};Fd.webviewProviderEventHandler=W2e});var AK=L(Np=>{"use strict";h();Object.defineProperty(Np,"__esModule",{value:!0});Np.SignMessageStatusEnum=void 0;var $2e;(function(t){t.pending="pending",t.failed="failed",t.signed="signed",t.cancelled="cancelled"})($2e=Np.SignMessageStatusEnum||(Np.SignMessageStatusEnum={}))});var oC=L(gc=>{"use strict";h();var Y2e=gc&&gc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EK=gc&&gc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Y2e(e,t,r)};Object.defineProperty(gc,"__esModule",{value:!0});EK(sC(),gc);EK(AK(),gc)});var SK=L(sA=>{"use strict";h();Object.defineProperty(sA,"__esModule",{value:!0});sA.responseTypeMap=void 0;var bn=oC();sA.responseTypeMap={[bn.WindowProviderRequestEnums.signTransactionsRequest]:bn.WindowProviderResponseEnums.signTransactionsResponse,[bn.WindowProviderRequestEnums.guardTransactionsRequest]:bn.WindowProviderResponseEnums.guardTransactionsResponse,[bn.WindowProviderRequestEnums.signMessageRequest]:bn.WindowProviderResponseEnums.signMessageResponse,[bn.WindowProviderRequestEnums.loginRequest]:bn.WindowProviderResponseEnums.loginResponse,[bn.WindowProviderRequestEnums.logoutRequest]:bn.WindowProviderResponseEnums.disconnectResponse,[bn.WindowProviderRequestEnums.cancelAction]:bn.WindowProviderResponseEnums.cancelResponse,[bn.WindowProviderRequestEnums.finalizeHandshakeRequest]:bn.WindowProviderResponseEnums.noneResponse,[bn.WindowProviderRequestEnums.finalizeResetStateRequest]:bn.WindowProviderResponseEnums.resetStateResponse}});var TK=L(qd=>{"use strict";h();var vs=qd&&qd.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(qd,"__esModule",{value:!0});qd.WebviewProvider=void 0;var J2e=Dn(),aC=wK(),In=oC(),X2e=SK(),_K=nC(),cC=rA(),Z2e=iC(),eEe=$c(),tEe=$c(),uC=class t{static getInstance(e){return t._instance||(t._instance=new t(e)),t._instance}constructor(e){this.initialized=!1,this.account={address:""},this.resetState=r=>{var n,i;(i=(n=(0,cC.getSafeWindow)()).addEventListener)===null||i===void 0||i.call(n,"message",(0,aC.webviewProviderEventHandler)(In.WindowProviderResponseEnums.resetStateResponse,s=>{s.type===In.WindowProviderResponseEnums.resetStateResponse&&(r?.(),setTimeout(()=>{this.finalizeResetState()},500))}))},this.init=()=>vs(this,void 0,void 0,function*(){return yield this.sendPostMessage({type:In.WindowProviderRequestEnums.finalizeHandshakeRequest,payload:void 0}),this.initialized=!0,this.initialized}),this.login=()=>vs(this,void 0,void 0,function*(){var r;if(!this.initialized)throw new Error("Provider not initialized");let n=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.loginRequest,payload:void 0});return n.type==In.WindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the login action"),yield this.cancelAction(),null):n.payload.data?(this.account=n.payload.data,this.account):(console.error("Error logging in",(r=n.payload.error)!==null&&r!==void 0?r:"No data received"),null)}),this.logout=()=>vs(this,void 0,void 0,function*(){let r=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.logoutRequest,payload:void 0});return this.initialized=!1,this.disconnect(),!!r.payload.data}),this.relogin=()=>vs(this,void 0,void 0,function*(){var r;let n=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.loginRequest,payload:void 0});if(n.type==In.WindowProviderResponseEnums.cancelResponse)return console.warn("Cancelled the re-login action"),yield this.cancelAction(),null;if(!n.payload.data)return console.error("Re-login Error",(r=n.payload.error)!==null&&r!==void 0?r:"No data received"),null;let{data:i,error:s}=n.payload;if(s||!i)throw new Error("Unable to re-login");let{accessToken:o}=i;return o?(this.account=i,o):(console.error("Unable to re-login. Missing accessToken."),null)}),this.signTransactions=r=>vs(this,void 0,void 0,function*(){let n=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.signTransactionsRequest,payload:r.map(o=>o.toPlainObject())}),{data:i,error:s}=n.payload;return s||!i?(console.error("Unable to sign transactions"),null):n.type==In.WindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the transactions signing action"),this.cancelAction(),null):i.map(o=>J2e.Transaction.fromPlainObject(o))}),this.signTransaction=r=>vs(this,void 0,void 0,function*(){let n=yield this.signTransactions([r]);return n?.[0]}),this.signMessage=r=>vs(this,void 0,void 0,function*(){var n;let i=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.signMessageRequest,payload:{message:b.Buffer.from(r.data).toString()}}),{data:s,error:o}=i.payload;return o||!s?(console.error("Unable to sign message"),null):i.type==In.WindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the message signing action"),this.cancelAction(),null):s.status!==In.SignMessageStatusEnum.signed?(console.error("Could not sign message"),null):new eEe.Message({data:b.Buffer.from(r.data),address:(n=r.address)!==null&&n!==void 0?n:tEe.Address.fromBech32(this.account.address),signer:"webview",version:r.version,signature:b.Buffer.from(String(s.signature),"hex")})}),this.cancelAction=()=>vs(this,void 0,void 0,function*(){return this.sendPostMessage({type:In.WindowProviderRequestEnums.cancelAction,payload:void 0})}),this.finalizeResetState=()=>vs(this,void 0,void 0,function*(){return this.sendPostMessage({type:In.WindowProviderRequestEnums.finalizeResetStateRequest,payload:void 0})}),this.sendPostMessage=r=>vs(this,void 0,void 0,function*(){var n,i;let s=(0,cC.getSafeWindow)();return s.ReactNativeWebView?s.ReactNativeWebView.postMessage(JSON.stringify(r)):s.webkit?(i=(n=s.webkit.messageHandlers)===null||n===void 0?void 0:n.jsHandler)===null||i===void 0||i.postMessage(JSON.stringify(r),(0,_K.getTargetOrigin)()):s.parent&&s.parent.postMessage(r,(0,_K.getTargetOrigin)()),yield this.waitingForResponse(X2e.responseTypeMap[r.type])}),this.waitingForResponse=r=>vs(this,void 0,void 0,function*(){return yield new Promise(n=>{var i,s,o,c;(s=(i=(0,cC.getSafeWindow)()).addEventListener)===null||s===void 0||s.call(i,"message",(0,aC.webviewProviderEventHandler)(r,n)),(c=(o=(0,Z2e.getSafeDocument)()).addEventListener)===null||c===void 0||c.call(o,"message",(0,aC.webviewProviderEventHandler)(r,n))})}),e?.resetStateCallback&&this.resetState(e.resetStateCallback)}disconnect(){this.account={address:""}}isInitialized(){return this.initialized}isConnected(){return!!this.account.address}getAccount(){return this.account}setAccount(e){this.account=e}};qd.WebviewProvider=uC});var lC=L(Fu=>{"use strict";h();var rEe=Fu&&Fu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nEe=Fu&&Fu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rEe(e,t,r)};Object.defineProperty(Fu,"__esModule",{value:!0});nEe(TK(),Fu)});h();var gC=ge(Sc(),1),mC=ge(N_(),1),uA=ge(v1(),1),yC=ge(D_(),1),aEe=ge(Nt(),1),cEe=ge(Hl(),1),uEe=ge(Dn(),1),lEe=ge(B1(),1),RK=ge(Q1(),1),fEe=ge(W1(),1),MK=ge(fa(),1),vo=ge(Ch(),1),DK=ge(oh(),1),BK=ge(al(),1),dEe=ge(NS(),1),hEe=ge(jl(),1);h();h();var TD=ge(i6(),1);h();h();var By="elvenjs_state",ED="https://devnet-api.multiversx.com";var Pa="/dapp/init",Ly="devnet",SD="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",_D=["wss://relay.walletconnect.com"],dn={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var be={get(t){let e=localStorage.getItem(By);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(By,JSON.stringify(r))},clear(){localStorage.removeItem(By)}};var Fy=async()=>{let t=TD.ExtensionProvider.getInstance();try{let e=await t.init(),r=be.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var fC=ge(i6(),1),dC=ge(gp(),1),hC=ge(Cd(),1),PK=ge(N5(),1),Op=ge(Q1(),1);h();var Uj=ge(gp(),1);h();h();var ye=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};h();var qj=(k=>(k.onLoginStart="onLoginStart",k.onLoginSuccess="onLoginSuccess",k.onLoginFailure="onLoginFailure",k.onLogoutStart="onLogoutStart",k.onLogoutSuccess="onLogoutSuccess",k.onLogoutFailure="onLogoutFailure",k.onQrPending="onQrPending",k.onQrLoaded="onQrLoaded",k.onTxStart="onTxStart",k.onTxSent="onTxSent",k.onTxFinalized="onTxFinalized",k.onTxFailure="onTxFailure",k.onSignMsgStart="onSignMsgStart",k.onSignMsgFinalized="onSignMsgFinalized",k.onSignMsgFailure="onSignMsgFailure",k.onQueryStart="onQueryStart",k.onQueryFinalized="onQueryFinalized",k.onQueryFailure="onQueryFailure",k))(qj||{}),O5=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(O5||{}),NAe=(r=>(r.mvx_cancelAction="mvx_cancelAction",r.mvx_signNativeAuthToken="mvx_signNativeAuthToken",r))(NAe||{}),OAe=(e=>(e.hasWebWalletGuardianSign="hasWebWalletGuardianSign",e))(OAe||{});h();var wr=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Nd=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");ye.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(be.clear(),ye.run("onLogoutSuccess")),e}catch(e){let r=wr(e);console.warn(`Something went wrong trying to logout the user: ${r}`),ye.run("onLogoutFailure",r)}};h();function Mw(t){return t[Math.floor(Math.random()*t.length)]}var kj=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{},onClientLogout:()=>Nd(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Mw(t.initOptions.walletConnectV2RelayAddresses),n=new Uj.WalletConnectV2Provider(e,dn[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};h();var Dw=ge(Nt(),1),Vj=ge(sf(),1),Hj=ge(xy(),1),Gj=ge(t0(),1),zj=ge(Iy(),1),jj=ge(jl(),1),Qj=ge(gy(),1),Kj=ge(Uh(),1);var Bw=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Ly,this.apiUrl=e||dn[this.chainType]?.apiAddress,this.apiTimeout=n||dn[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),c=await o.json();if(!o.ok){let a=c?.error||o.status;return clearTimeout(i),Promise.reject(a)}return clearTimeout(i),c}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let c=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),a=await c.json();if(!c.ok){let u=a?.error||c.status;return clearTimeout(s),Promise.reject(u)}return clearTimeout(s),a}catch(c){this.handleApiError(c,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new Dw.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new Vj.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new Dw.Address(r.sender),receiver:new Dw.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:b.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:Hj.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:Gj.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:zj.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new Kj.Query({address:e,func:r,args:n,value:i,caller:s}),c=new Qj.ContractQueryRequest(o).toHttpRequest(),a=await this.apiPost("query",c);return jj.ContractQueryResponse.fromHttpResponse(a)}catch(o){this.handleApiError(o,"query")}}};h();h();var Od=()=>new Date().setHours(new Date().getHours()+24),Lw=t=>Date.now()>t;h();var Wj=ge(Nt(),1),$j=ge(Hl(),1);var Ru=async t=>{let e=be.get("address"),r=be.get("expires");if(!(r&&Lw(r))&&e&&t.networkProvider){let i=new Wj.Address(e),s=new $j.Account(i);try{let o=await t.networkProvider.getAccount(i),c=await t.networkProvider.getGuardianData(i);be.set("address",e),be.set("activeGuardian",c.guarded&&c.activeGuardian?.address?c.activeGuardian.address:""),be.set("nonce",o.nonce.valueOf()),be.set("balance",o.balance.toString()),s.update(o)}catch(o){let c=wr(o);console.warn(`Something went wrong trying to synchronize the user account: ${c}`)}}};var Yj=async(t,e,r,n="/")=>{let i=await Fy(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i&&!await i.login(o))throw new Error("There were problems while logging in!")}catch(u){let f=wr(u);throw new Error(f)}if(!i)throw new Error("There were problems with auth provider initialization!");let c=i.getAccount();be.set("loginToken",e);let a=c?.signature;if(a&&be.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");be.set("address",u),be.set("loginMethod","browser-extension"),be.set("expires",Od()),await Ru(t);let f=r.getToken(u,e,a);return be.set("accessToken",f),ye.run("onLoginSuccess"),i}catch(u){throw new Error(`Something went wrong trying to synchronize the user account: ${u?.message}`)}};h();h();var JQ=ge(YQ(),1),XQ=ge(gp(),1);var _2e=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},T2e=t=>{let e=`${SD}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},I2e=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},C2e=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},eC={},x2e=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",eC[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:eC[t.topic].signal}),r},Ww={},N2e=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=x2e(t,e);return n.appendChild(s),Ww[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ww[t.topic].signal}),n},O2e=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},P2e=t=>{if(!t)return;document.getElementById(t)?.remove()},R2e=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),M2e=async t=>t?await JQ.default.toString(t,{type:"svg"}):void 0,ZQ=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await M2e(e),o;if(s&&(o=_2e(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),R2e()&&i.appendChild(T2e(e))),i&&r instanceof XQ.WalletConnectV2Provider){let c=r.pairings,a=async f=>{try{f&&(await r.logout({topic:f}),P2e(f))}catch(p){let S=wr(p);console.warn(`Something went wrong trying to remove the existing pairing: ${S}`)}finally{Ww[f].abort()}},u=async f=>{try{let{approval:p}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(O2e()),await r.login({approval:p,token:n})}catch(p){let S=wr(p);console.warn(`Something went wrong trying to login the user: ${S}`)}finally{for(let p of Object.values(Ww))p?.abort();for(let p of Object.values(eC))p?.abort()}};if(c&&c.length>0){let f=I2e();i.appendChild(f);let p=C2e();f.appendChild(p);for(let S of c){let I=N2e(S,a,u);f.appendChild(I)}}}return i};var $w=ge(gp(),1);var eK=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=Mw(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof $w.WalletConnectV2Provider){let a=await t.dappProvider.getAddress(),u=await t.dappProvider.getSignature();be.set("address",a),be.set("loginMethod","mobile"),be.set("expires",Od()),await Ru(t),u&&be.set("signature",u),be.set("loginToken",e);let f=r.getToken(a,e,u);be.set("accessToken",f),ye.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof $w.WalletConnectV2Provider&&await Nd(t)},onClientEvent:a=>{console.log("wc2 session event: ",a)}},c=new $w.WalletConnectV2Provider(o,dn[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(c){t.dappProvider=c,ye.run("onQrPending"),await c.init();let{uri:a,approval:u}=await c.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${a}&token=${e}`:a;return n&&f&&(s=await ZQ(n,f,c,e),ye.run("onQrLoaded")),await c.login({approval:u,token:e}),c}}catch(a){let u=wr(a);console.warn(`Something went wrong trying to login the user: ${u}`),ye.run("onLoginFailure",u)}};h();var tK=ge(Cd(),1);var tC=async(t,e,r,n)=>{let i=new tK.WalletProvider(`${t}${Pa}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return be.set("loginMethod",dn[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),be.set("expires",Od()),be.set("loginToken",e),i}catch(c){let a=wr(c);console.warn(`Something went wrong trying to login the user: ${a}`),be.set("loginMethod",""),ye.run("onLoginFailure",a)}};h();var Kn=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};h();var rK=ge(Cd(),1);var nK=ge(N5(),1),rC=async(t,e)=>{let r=Kn("signature"),n=Kn("address"),i=be.get("address"),s=be.get("loginToken");if(r&&be.set("signature",r),n||i){n&&(be.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new rK.WalletProvider(`${t}${Pa}`);if(r&&e&&n){let a=new nK.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);be.set("accessToken",a)}return o}};h();var iK=ge(Hl(),1),sK=ge(W1(),1);var Yw=async(t,e)=>{ye.run("onTxSent",t);let n=await new sK.TransactionWatcher(e).awaitCompleted(t),i=n.sender,s=new iK.Account(i),o=await e.getAccount(i);s.update(o),be.set("address",s.address.bech32()),be.set("balance",s.balance.toString()),ye.run("onTxFinalized",n)};h();var Ld=ge(aK(),1),uK=ge(Dn(),1);h();var cK=ge(Hl(),1);var Jw=t=>{let e=t.getSender(),r=new cK.Account(e),n=t.nonce.valueOf();r.incrementNonce(),be.set("nonce",(n+1n).toString())};var lK=async(t,e,r,n)=>{if(Kn(Ld.WALLET_PROVIDER_CALLBACK_PARAM)===Ld.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=be.get("activeGuardian"),o=be.get("loginMethod"),c=Kn("hasWebWalletGuardianSign"),a;if("getTransactionsFromWalletUrl"in t){if(a=t.getTransactionsFromWalletUrl()?.[0],!a)return;o==="web-wallet"&&(a.data=b.Buffer.from(a.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&c&&(a=new Ld.WalletProvider(`${r}${Pa}`).getTransactionsFromWalletUrl()?.[0]);if(a){let u=uK.Transaction.fromPlainObject(a);u.nonce=BigInt(n),Jw(u);try{ye.run("onTxStart",u),await e.sendTransaction(u),await Yw(u,e)}catch(f){let S=`Getting transaction information failed! ${wr(f)}`;throw ye.run("onTxFailure",u,S),new Error(S)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};h();var Xw=ge(Vd(),1),fK=ge(Nt(),1),dK=ge(Cd(),1);var hK=t=>{let e=be.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Xw.TransactionVersion.withTxOptions()),t.setOptions(Xw.TransactionOptions.withOptions(r)),t.setGuardian(fK.Address.fromBech32(e))}return t},pK=async(t,e)=>{let r=new dK.WalletProvider(`${e}${Pa}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},gK=t=>{let e=be.get("activeGuardian");return!(!be.get("address")||!e||t.isGuardedTransaction())};h();var mK=()=>{let t=!Kn("walletProviderStatus"),e=Kn("status")==="signed",r=Kn("message"),n=Kn("signature");t&&e&&r&&n&&(ye.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};var cA=ge(lC(),1);h();h();h();function iEe(t){try{let e=atob(t),r=btoa(e),n=b.Buffer.from(t,"base64").toString(),i=b.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Ud(t){return iEe(t)?atob(t):t}h();var oA=t=>Object.prototype.toString.call(t)==="[object String]";h();var IK=t=>{if(!t||!oA(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Ud(s)),c=Ud(r);return{ttl:Number(i),extraInfo:o,origin:c,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var CK=t=>{if(!t||!oA(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Ud(r),o=Ud(n),c=IK(o);if(!c)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let a={...c,address:s,body:o,signature:i};return c.extraInfo?.timestamp||delete a.extraInfo,a}catch{return null}};var xK=ge(lC(),1);function NK(t,e){let r=CK(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(be.set("loginToken",s),be.set("accessToken",t),be.set("signature",n),be.set("address",i),be.set("loginMethod","x-portal-hub"),e.dappProvider=new xK.WebviewProvider)}h();var OK=t=>{t.onLoginStart&&ye.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&ye.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&ye.set("onLoginFailure",t.onLoginFailure),t.onLogoutStart&&ye.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&ye.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&ye.set("onLogoutFailure",t.onLogoutFailure),t.onQrPending&&ye.set("onQrPending",t.onQrPending),t.onQrLoaded&&ye.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&ye.set("onTxStart",t.onTxStart),t.onTxSent&&ye.set("onTxSent",t.onTxSent),t.onTxFinalized&&ye.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&ye.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&ye.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&ye.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&ye.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&ye.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&ye.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&ye.set("onQueryFailure",t.onQueryFailure)};h();var aA=async t=>{ye.run("onLoginStart");try{await t(()=>{ye.run("onLoginSuccess")})}catch(e){let r=wr(e);console.warn(`Something went wrong trying to login the user: ${r}`),ye.run("onLoginFailure",r)}};var pC=class{static async init(e){let r=be.get();if(r.expires&&Lw(r.expires)){be.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Ly,apiUrl:ED,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:_D,...e},this.networkProvider=new Bw(this.initOptions),OK(this.initOptions);let n=Kn("accessToken");n&&await aA(async s=>{NK(n,this),await Ru(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Kn("address"))&&r?.loginMethod&&(await aA(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await Fy()),r.loginMethod==="mobile"&&(this.dappProvider=await kj(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new cA.WebviewProvider),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await rC(dn[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await rC(dn[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await Ru(this),s()}),this.initOptions?.chainType&&(await lK(this.dappProvider,this.networkProvider,dn[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),mK()))}static async login(e,r){if(!Object.values(O5).includes(e)){let i="Wrong login method!";throw ye.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw ye.run("onLoginFailure",i),new Error(i)}await aA(async()=>{let i=new PK.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await Yj(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await eK(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await tC(dn[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await tC(dn[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}})}static async logout(){try{let e=await Nd(this);return this.dappProvider=void 0,e}catch(e){let r=wr(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw ye.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw ye.run("onTxFailure",e,n),new Error(n)}let r=hK(e);try{ye.run("onTxStart",e);let n=be.get();if(e.nonce=n.nonce,this.dappProvider instanceof fC.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof dC.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof cA.WebviewProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof hC.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=gK(r);if(i||Jw(r),i&&this.initOptions?.chainType){await pK(r,dn[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Yw(r,this.networkProvider)}}catch(n){let i=wr(n);throw ye.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(ye.run("onSignMsgStart",e),this.dappProvider instanceof fC.ExtensionProvider){let s=await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}));n=b.Buffer.from(s?.signature||"").toString("hex")}if(this.dappProvider instanceof dC.WalletConnectV2Provider){let s=await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}));n=b.Buffer.from(s?.signature||"").toString("hex")}if(this.dappProvider instanceof cA.WebviewProvider){let s=await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}));n=b.Buffer.from(s?.signature||"").toString("hex")}if(this.dappProvider instanceof hC.WalletProvider){let s=c=>encodeURIComponent(c).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),o=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${o}${o.includes("?")?"&":"?"}message=${s(e)}`)})}let i=be.get();return i.loginMethod!=="web-wallet"&&i.loginMethod!=="x-alias"&&ye.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=wr(i);throw ye.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{ye.run("onQueryStart",o);let c=await this.networkProvider.queryContract(o);return ye.run("onQueryFinalized",c),c}catch(c){let a=wr(c);throw ye.run("onQueryFinalized",o,a),new Error(`Smart contract query failed! ${a}`)}}static{this.storage=be}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,ye.clear()}}};h();qt();Vu.config({ROUNDING_MODE:Vu.ROUND_FLOOR});var sEe=({amount:t,decimals:e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return BigInt(new Vu(t).shiftedBy(e).toFixed())},oEe=({amount:t,decimals:e,rounding:r=e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return new Vu(t).shiftedBy(-e).decimalPlaces(r).toFixed()};var export_Account=cEe.Account;var export_Address=aEe.Address;var export_AddressType=BK.AddressType;var export_AddressValue=BK.AddressValue;var export_BigUIntType=vo.BigUIntType;var export_BigUIntValue=vo.BigUIntValue;var export_BooleanType=DK.BooleanType;var export_BooleanValue=DK.BooleanValue;var export_BytesType=MK.BytesType;var export_BytesValue=MK.BytesValue;var export_ContractQueryResponse=hEe.ContractQueryResponse;var export_Message=RK.Message;var export_MessageComputer=RK.MessageComputer;var export_QueryArguments=dEe.QueryArguments;var export_SmartContractTransactionsFactory=uA.SmartContractTransactionsFactory;var export_SmartContractTransactionsOutcomeParser=yC.SmartContractTransactionsOutcomeParser;var export_Token=gC.Token;var export_TokenComputer=gC.TokenComputer;var export_TokenManagementTransactionsFactory=uA.TokenManagementTransactionsFactory;var export_TokenManagementTransactionsOutcomeParser=yC.TokenManagementTransactionsOutcomeParser;var export_TokenOperationsFactory=mC.TokenOperationsFactory;var export_TokenOperationsFactoryConfig=mC.TokenOperationsFactoryConfig;var export_TokenOperationsOutcomeParser=mC.TokenOperationsOutcomeParser;var export_TokenTransfer=gC.TokenTransfer;var export_Transaction=uEe.Transaction;var export_TransactionComputer=lEe.TransactionComputer;var export_TransactionEventsParser=yC.TransactionEventsParser;var export_TransactionWatcher=fEe.TransactionWatcher;var export_TransactionsFactoryConfig=uA.TransactionsFactoryConfig;var export_TransferTransactionsFactory=uA.TransferTransactionsFactory;var export_U16Type=vo.U16Type;var export_U16Value=vo.U16Value;var export_U32Type=vo.U32Type;var export_U32Value=vo.U32Value;var export_U64Type=vo.U64Type;var export_U64Value=vo.U64Value;var export_U8Type=vo.U8Type;var export_U8Value=vo.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractQueryResponse as ContractQueryResponse,NAe as DappCoreWCV2CustomMethodsEnum,pC as ElvenJS,qj as EventStoreEvents,O5 as LoginMethodsEnum,export_Message as Message,export_MessageComputer as MessageComputer,export_QueryArguments as QueryArguments,export_SmartContractTransactionsFactory as SmartContractTransactionsFactory,export_SmartContractTransactionsOutcomeParser as SmartContractTransactionsOutcomeParser,export_Token as Token,export_TokenComputer as TokenComputer,export_TokenManagementTransactionsFactory as TokenManagementTransactionsFactory,export_TokenManagementTransactionsOutcomeParser as TokenManagementTransactionsOutcomeParser,export_TokenOperationsFactory as TokenOperationsFactory,export_TokenOperationsFactoryConfig as TokenOperationsFactoryConfig,export_TokenOperationsOutcomeParser as TokenOperationsOutcomeParser,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionComputer as TransactionComputer,export_TransactionEventsParser as TransactionEventsParser,export_TransactionWatcher as TransactionWatcher,export_TransactionsFactoryConfig as TransactionsFactoryConfig,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value,OAe as WebWalletUrlParamsEnum,oEe as formatAmount,sEe as parseAmount}; /*! Bundled license information: ieee754/index.js: @@ -72,9 +72,6 @@ buffer/index.js: * @license MIT *) -safe-buffer/index.js: - (*! safe-buffer. MIT License. Feross Aboukhadijeh *) - tslib/tslib.es6.js: (*! ***************************************************************************** Copyright (c) Microsoft Corporation. diff --git a/build/types/elven.d.ts b/build/types/elven.d.ts index 0a357f0..f5f2e45 100644 --- a/build/types/elven.d.ts +++ b/build/types/elven.d.ts @@ -8,13 +8,12 @@ export { Transaction } from '@multiversx/sdk-core/out/transaction'; export { TransactionComputer } from '@multiversx/sdk-core/out/transactionComputer'; export { Message, MessageComputer } from '@multiversx/sdk-core/out/message'; export { TransactionWatcher } from '@multiversx/sdk-core/out/transactionWatcher'; -export { SignableMessage } from '@multiversx/sdk-core/out/signableMessage'; export { BytesType, BytesValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/bytes'; export { U16Type, U16Value, U32Type, U32Value, U64Type, U64Value, U8Type, U8Value, BigUIntType, BigUIntValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/numerical'; export { BooleanType, BooleanValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/boolean'; export { AddressType, AddressValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/address'; export { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts/interface'; -export { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; +export { ContractQueryResponse } from '@multiversx/sdk-core/out/networkProviders/contractQueryResponse'; export { ElvenJS } from './main'; export { parseAmount, formatAmount } from './utils/amount'; export * from './types'; diff --git a/build/types/main.d.ts b/build/types/main.d.ts index 36b1186..9be0a06 100644 --- a/build/types/main.d.ts +++ b/build/types/main.d.ts @@ -33,7 +33,7 @@ export declare class ElvenJS { /** * Query Smart Contracts */ - static queryContract({ address, func, args, value, caller, }: SmartContractQueryArgs): Promise; + static queryContract({ address, func, args, value, caller, }: SmartContractQueryArgs): Promise; /** * Main storage */ diff --git a/build/types/network-provider.d.ts b/build/types/network-provider.d.ts index 8882f2e..a35e899 100644 --- a/build/types/network-provider.d.ts +++ b/build/types/network-provider.d.ts @@ -1,9 +1,9 @@ import { Address } from '@multiversx/sdk-core/out/address'; -import { TransactionStatus } from '@multiversx/sdk-network-providers/out/transactionStatus'; -import { TransactionReceipt } from '@multiversx/sdk-network-providers/out/transactionReceipt'; -import { TransactionLogs } from '@multiversx/sdk-network-providers/out/transactionLogs'; -import { ContractResults } from '@multiversx/sdk-network-providers/out/contractResults'; -import { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; +import { TransactionStatus } from '@multiversx/sdk-core/out/networkProviders/transactionStatus'; +import { TransactionReceipt } from '@multiversx/sdk-core/out/networkProviders/transactionReceipt'; +import { TransactionLogs } from '@multiversx/sdk-core/out/networkProviders/transactionLogs'; +import { ContractResults } from '@multiversx/sdk-core/out/networkProviders/contractResults'; +import { ContractQueryResponse } from '@multiversx/sdk-core/out/networkProviders/contractQueryResponse'; import { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts/interface'; import { InitOptions } from './types'; export interface IAddress { diff --git a/build/types/types.d.ts b/build/types/types.d.ts index 6d47270..9668e1f 100644 --- a/build/types/types.d.ts +++ b/build/types/types.d.ts @@ -4,7 +4,7 @@ import { WalletConnectV2Provider } from '@multiversx/sdk-wallet-connect-provider import { WalletProvider } from '@multiversx/sdk-web-wallet-provider/out/walletProvider'; import { WebviewProvider } from '@multiversx/sdk-webview-provider'; import { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts'; -import { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; +import { ContractQueryResponse } from '@multiversx/sdk-core/out/networkProviders/contractQueryResponse'; export interface InitOptions { apiUrl?: string; chainType?: string; diff --git a/esbuild.config.cjs b/esbuild.config.cjs index eb8334e..7efe283 100644 --- a/esbuild.config.cjs +++ b/esbuild.config.cjs @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-require-imports */ const esbuild = require('esbuild'); const path = require('path'); diff --git a/example/elven.js b/example/elven.js index b053efc..86fe667 100644 --- a/example/elven.js +++ b/example/elven.js @@ -1,26 +1,31 @@ -var Nk=Object.create;var Dd=Object.defineProperty;var xk=Object.getOwnPropertyDescriptor;var Ok=Object.getOwnPropertyNames;var Dk=Object.getPrototypeOf,Pk=Object.prototype.hasOwnProperty;var Pd=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var de=(t,e)=>()=>(t&&(e=t(t=0)),e);var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ot=(t,e)=>{for(var r in e)Dd(t,r,{get:e[r],enumerable:!0})},Od=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ok(e))!Pk.call(t,i)&&i!==r&&Dd(t,i,{get:()=>e[i],enumerable:!(n=xk(e,i))||n.enumerable});return t},Tr=(t,e,r)=>(Od(t,e,"default"),r&&Od(r,e,"default")),ge=(t,e,r)=>(r=t!=null?Nk(Dk(t)):{},Od(e||!t||!t.__esModule?Dd(r,"default",{value:t,enumerable:!0}):r,t)),xe=t=>Od(Dd({},"__esModule",{value:!0}),t);var E3=D(Rd=>{"use strict";h();Rd.byteLength=Bk;Rd.toByteArray=Lk;Rd.fromByteArray=qk;var Li=[],Tn=[],Rk=typeof Uint8Array<"u"?Uint8Array:Array,bw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(va=0,v3=bw.length;va0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Bk(t){var e=A3(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Mk(t,e,r){return(e+r)*3/4-r}function Lk(t){var e,r=A3(t),n=r[0],i=r[1],s=new Rk(Mk(t,n,i)),o=0,u=i>0?n-4:n,a;for(a=0;a>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Tn[t.charCodeAt(a)]<<2|Tn[t.charCodeAt(a+1)]>>4,s[o++]=e&255),i===1&&(e=Tn[t.charCodeAt(a)]<<10|Tn[t.charCodeAt(a+1)]<<4|Tn[t.charCodeAt(a+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Fk(t){return Li[t>>18&63]+Li[t>>12&63]+Li[t>>6&63]+Li[t&63]}function Uk(t,e,r){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=t[r-1],i.push(Li[e>>2]+Li[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Li[e>>10]+Li[e>>4&63]+Li[e<<2&63]+"=")),i.join("")}});var b3=D(Sw=>{h();Sw.read=function(t,e,r,n,i){var s,o,u=i*8-n-1,a=(1<>1,f=-7,d=r?i-1:0,w=r?-1:1,A=t[e+d];for(d+=w,s=A&(1<<-f)-1,A>>=-f,f+=u;f>0;s=s*256+t[e+d],d+=w,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=w,f-=8);if(s===0)s=1-c;else{if(s===a)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(A?-1:1)*o*Math.pow(2,s-n)};Sw.write=function(t,e,r,n,i,s){var o,u,a,c=s*8-i-1,f=(1<>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,_=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+d>=1?e+=w/a:e+=w*Math.pow(2,1-d),e*a>=2&&(o++,a/=2),o+d>=f?(u=0,o=f):o+d>=1?(u=(e*a-1)*Math.pow(2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+A]=u&255,A+=_,u/=256,i-=8);for(o=o<0;t[r+A]=o&255,A+=_,o/=256,c-=8);t[r+A-_]|=N*128}});var no=D(Tu=>{"use strict";h();var Iw=E3(),_u=b3(),S3=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Tu.Buffer=X;Tu.SlowBuffer=zk;Tu.INSPECT_MAX_BYTES=50;var Bd=2147483647;Tu.kMaxLength=Bd;X.TYPED_ARRAY_SUPPORT=Vk();!X.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 Vk(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(X.prototype,"parent",{enumerable:!0,get:function(){if(X.isBuffer(this))return this.buffer}});Object.defineProperty(X.prototype,"offset",{enumerable:!0,get:function(){if(X.isBuffer(this))return this.byteOffset}});function Ts(t){if(t>Bd)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,X.prototype),e}function X(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Nw(t)}return T3(t,e,r)}X.poolSize=8192;function T3(t,e,r){if(typeof t=="string")return Hk(t,e);if(ArrayBuffer.isView(t))return Gk(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Fi(t,ArrayBuffer)||t&&Fi(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Fi(t,SharedArrayBuffer)||t&&Fi(t.buffer,SharedArrayBuffer)))return Tw(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return X.from(n,e,r);var i=jk(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return X.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}X.from=function(t,e,r){return T3(t,e,r)};Object.setPrototypeOf(X.prototype,Uint8Array.prototype);Object.setPrototypeOf(X,Uint8Array);function C3(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function kk(t,e,r){return C3(t),t<=0?Ts(t):e!==void 0?typeof r=="string"?Ts(t).fill(e,r):Ts(t).fill(e):Ts(t)}X.alloc=function(t,e,r){return kk(t,e,r)};function Nw(t){return C3(t),Ts(t<0?0:xw(t)|0)}X.allocUnsafe=function(t){return Nw(t)};X.allocUnsafeSlow=function(t){return Nw(t)};function Hk(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!X.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=N3(t,e)|0,n=Ts(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function _w(t){for(var e=t.length<0?0:xw(t.length)|0,r=Ts(e),n=0;n=Bd)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Bd.toString(16)+" bytes");return t|0}function zk(t){return+t!=t&&(t=0),X.alloc(+t)}X.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==X.prototype};X.compare=function(e,r){if(Fi(e,Uint8Array)&&(e=X.from(e,e.offset,e.byteLength)),Fi(r,Uint8Array)&&(r=X.from(r,r.offset,r.byteLength)),!X.isBuffer(e)||!X.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?X.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(X.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function N3(t,e){if(X.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Fi(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Cw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return B3(t).length;default:if(i)return n?-1:Cw(t).length;e=(""+e).toLowerCase(),i=!0}}X.byteLength=N3;function Qk(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return rH(this,e,r);case"utf8":case"utf-8":return O3(this,e,r);case"ascii":return eH(this,e,r);case"latin1":case"binary":return tH(this,e,r);case"base64":return Xk(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}X.prototype._isBuffer=!0;function Aa(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}X.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};S3&&(X.prototype[S3]=X.prototype.inspect);X.prototype.compare=function(e,r,n,i,s){if(Fi(e,Uint8Array)&&(e=X.from(e,e.offset,e.byteLength)),!X.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,u=n-r,a=Math.min(o,u),c=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ow(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=X.from(e,n)),X.isBuffer(e))return e.length===0?-1:I3(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):I3(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function I3(t,e,r,n,i){var s=1,o=t.length,u=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,u/=2,r/=2}function a(A,_){return s===1?A[_]:A.readUInt16BE(_*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-u),c=r;c>=0;c--){for(var d=!0,w=0;wi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Kk(this,e,r,n);case"utf8":case"utf-8":return Wk(this,e,r,n);case"ascii":case"latin1":case"binary":return $k(this,e,r,n);case"base64":return Yk(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jk(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};X.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Xk(t,e,r){return e===0&&r===t.length?Iw.fromByteArray(t):Iw.fromByteArray(t.slice(e,r))}function O3(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+u<=r){var a,c,f,d;switch(u){case 1:s<128&&(o=s);break;case 2:a=t[i+1],(a&192)===128&&(d=(s&31)<<6|a&63,d>127&&(o=d));break;case 3:a=t[i+1],c=t[i+2],(a&192)===128&&(c&192)===128&&(d=(s&15)<<12|(a&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:a=t[i+1],c=t[i+2],f=t[i+3],(a&192)===128&&(c&192)===128&&(f&192)===128&&(d=(s&15)<<18|(a&63)<<12|(c&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=u}return Zk(n)}var _3=4096;function Zk(t){var e=t.length;if(e<=_3)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}X.prototype.readUintLE=X.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};X.prototype.readUint8=X.prototype.readUInt8=function(e,r){return e=e>>>0,r||pr(e,1,this.length),this[e]};X.prototype.readUint16LE=X.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||pr(e,2,this.length),this[e]|this[e+1]<<8};X.prototype.readUint16BE=X.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||pr(e,2,this.length),this[e]<<8|this[e+1]};X.prototype.readUint32LE=X.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};X.prototype.readUint32BE=X.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};X.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};X.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||pr(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};X.prototype.readInt8=function(e,r){return e=e>>>0,r||pr(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};X.prototype.readInt16LE=function(e,r){e=e>>>0,r||pr(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};X.prototype.readInt16BE=function(e,r){e=e>>>0,r||pr(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};X.prototype.readInt32LE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};X.prototype.readInt32BE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};X.prototype.readFloatLE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),_u.read(this,e,!0,23,4)};X.prototype.readFloatBE=function(e,r){return e=e>>>0,r||pr(e,4,this.length),_u.read(this,e,!1,23,4)};X.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||pr(e,8,this.length),_u.read(this,e,!0,52,8)};X.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||pr(e,8,this.length),_u.read(this,e,!1,52,8)};function Kr(t,e,r,n,i,s){if(!X.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}X.prototype.writeUintLE=X.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Kr(this,e,r,n,s,0)}var o=1,u=0;for(this[r]=e&255;++u>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Kr(this,e,r,n,s,0)}var o=n-1,u=1;for(this[r+o]=e&255;--o>=0&&(u*=256);)this[r+o]=e/u&255;return r+n};X.prototype.writeUint8=X.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,1,255,0),this[r]=e&255,r+1};X.prototype.writeUint16LE=X.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};X.prototype.writeUint16BE=X.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};X.prototype.writeUint32LE=X.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};X.prototype.writeUint32BE=X.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};X.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Kr(this,e,r,n,s-1,-s)}var o=0,u=1,a=0;for(this[r]=e&255;++o>0)-a&255;return r+n};X.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Kr(this,e,r,n,s-1,-s)}var o=n-1,u=1,a=0;for(this[r+o]=e&255;--o>=0&&(u*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/u>>0)-a&255;return r+n};X.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};X.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};X.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};X.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};X.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Kr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function D3(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P3(t,e,r,n,i){return e=+e,r=r>>>0,i||D3(t,e,r,4,34028234663852886e22,-34028234663852886e22),_u.write(t,e,r,n,23,4),r+4}X.prototype.writeFloatLE=function(e,r,n){return P3(this,e,r,!0,n)};X.prototype.writeFloatBE=function(e,r,n){return P3(this,e,r,!1,n)};function R3(t,e,r,n,i){return e=+e,r=r>>>0,i||D3(t,e,r,8,17976931348623157e292,-17976931348623157e292),_u.write(t,e,r,n,52,8),r+8}X.prototype.writeDoubleLE=function(e,r,n){return R3(this,e,r,!0,n)};X.prototype.writeDoubleBE=function(e,r,n){return R3(this,e,r,!1,n)};X.prototype.copy=function(e,r,n,i){if(!X.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function oH(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function B3(t){return Iw.toByteArray(sH(t))}function Md(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Fi(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ow(t){return t!==t}var uH=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var q3=D((bpe,U3)=>{h();var Wt=U3.exports={},Ui,qi;function Dw(){throw new Error("setTimeout has not been defined")}function Pw(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Ui=setTimeout:Ui=Dw}catch{Ui=Dw}try{typeof clearTimeout=="function"?qi=clearTimeout:qi=Pw}catch{qi=Pw}})();function M3(t){if(Ui===setTimeout)return setTimeout(t,0);if((Ui===Dw||!Ui)&&setTimeout)return Ui=setTimeout,setTimeout(t,0);try{return Ui(t,0)}catch{try{return Ui.call(null,t,0)}catch{return Ui.call(this,t,0)}}}function cH(t){if(qi===clearTimeout)return clearTimeout(t);if((qi===Pw||!qi)&&clearTimeout)return qi=clearTimeout,clearTimeout(t);try{return qi(t)}catch{try{return qi.call(null,t)}catch{return qi.call(this,t)}}}var Cs=[],Cu=!1,Ea,Ld=-1;function lH(){!Cu||!Ea||(Cu=!1,Ea.length?Cs=Ea.concat(Cs):Ld=-1,Cs.length&&L3())}function L3(){if(!Cu){var t=M3(lH);Cu=!0;for(var e=Cs.length;e;){for(Ea=Cs,Cs=[];++Ld1)for(var r=1;r{p=ge(no()),S=ge(q3()),fH=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=fH});var hr={};Ot(hr,{BigNumber:()=>H3,default:()=>Nu});function k3(t){var e,r,n,i=U.prototype={constructor:U,toString:null,valueOf:null},s=new U(1),o=20,u=4,a=-7,c=21,f=-1e7,d=1e7,w=!1,A=1,_=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},P="0123456789abcdefghijklmnopqrstuvwxyz",V=!0;function U(v,C){var R,F,B,l,g,y,E,I,T=this;if(!(T instanceof U))return new U(v,C);if(C==null){if(v&&v._isBigNumber===!0){T.s=v.s,!v.c||v.e>d?T.c=T.e=null:v.e=10;g/=10,l++);l>d?T.c=T.e=null:(T.e=l,T.c=[v]);return}I=String(v)}else{if(!hH.test(I=String(v)))return n(T,I,y);T.s=I.charCodeAt(0)==45?(I=I.slice(1),-1):1}(l=I.indexOf("."))>-1&&(I=I.replace(".","")),(g=I.search(/e/i))>0?(l<0&&(l=g),l+=+I.slice(g+1),I=I.substring(0,g)):l<0&&(l=I.length)}else{if(Ht(C,2,P.length,"Base"),C==10&&V)return T=new U(v),H(T,o+T.e+1,u);if(I=String(v),y=typeof v=="number"){if(v*0!=0)return n(T,I,y,C);if(T.s=1/v<0?(I=I.slice(1),-1):1,U.DEBUG&&I.replace(/^0\.0*|\./,"").length>15)throw Error(V3+v)}else T.s=I.charCodeAt(0)===45?(I=I.slice(1),-1):1;for(R=P.slice(0,C),l=g=0,E=I.length;gl){l=E;continue}}else if(!B&&(I==I.toUpperCase()&&(I=I.toLowerCase())||I==I.toLowerCase()&&(I=I.toUpperCase()))){B=!0,g=-1,l=0;continue}return n(T,String(v),y,C)}y=!1,I=r(I,C,10,T.s),(l=I.indexOf("."))>-1?I=I.replace(".",""):l=I.length}for(g=0;I.charCodeAt(g)===48;g++);for(E=I.length;I.charCodeAt(--E)===48;);if(I=I.slice(g,++E)){if(E-=g,y&&U.DEBUG&&E>15&&(v>Bw||v!==Nn(v)))throw Error(V3+T.s*v);if((l=l-g-1)>d)T.c=T.e=null;else if(l=-mr&&B<=mr&&B===Nn(B)){if(F[0]===0){if(B===0&&F.length===1)return!0;break e}if(C=(B+1)%be,C<1&&(C+=be),String(F[0]).length==C){for(C=0;C=mi||R!==Nn(R))break e;if(R!==0)return!0}}}else if(F===null&&B===null&&(l===null||l===1||l===-1))return!0;throw Error(Wr+"Invalid BigNumber: "+v)},U.maximum=U.max=function(){return L(arguments,-1)},U.minimum=U.min=function(){return L(arguments,1)},U.random=function(){var v=9007199254740992,C=Math.random()*v&2097151?function(){return Nn(Math.random()*v)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(R){var F,B,l,g,y,E=0,I=[],T=new U(s);if(R==null?R=o:Ht(R,0,mr),g=Rw(R/be),w)if(crypto.getRandomValues){for(F=crypto.getRandomValues(new Uint32Array(g*=2));E>>11),y>=9e15?(B=crypto.getRandomValues(new Uint32Array(2)),F[E]=B[0],F[E+1]=B[1]):(I.push(y%1e14),E+=2);E=g/2}else if(crypto.randomBytes){for(F=crypto.randomBytes(g*=7);E=9e15?crypto.randomBytes(7).copy(F,E):(I.push(y%1e14),E+=7);E=g/7}else throw w=!1,Error(Wr+"crypto unavailable");if(!w)for(;E=10;y/=10,E++);EB-1&&(y[g+1]==null&&(y[g+1]=0),y[g+1]+=y[g]/B|0,y[g]%=B)}return y.reverse()}return function(R,F,B,l,g){var y,E,I,T,M,x,m,O,Y=R.indexOf("."),$=o,b=u;for(Y>=0&&(T=_,_=0,R=R.replace(".",""),O=new U(F),x=O.pow(R.length-Y),_=T,O.c=C(xs(Cn(x.c),x.e,"0"),10,B,v),O.e=O.c.length),m=C(R,F,B,g?(y=P,v):(y=v,P)),I=T=m.length;m[--T]==0;m.pop());if(!m[0])return y.charAt(0);if(Y<0?--I:(x.c=m,x.e=I,x.s=l,x=e(x,O,$,b,B),m=x.c,M=x.r,I=x.e),E=I+$+1,Y=m[E],T=B/2,M=M||E<0||m[E+1]!=null,M=b<4?(Y!=null||M)&&(b==0||b==(x.s<0?3:2)):Y>T||Y==T&&(b==4||M||b==6&&m[E-1]&1||b==(x.s<0?8:7)),E<1||!m[0])R=M?xs(y.charAt(1),-$,y.charAt(0)):y.charAt(0);else{if(m.length=E,M)for(--B;++m[--E]>B;)m[E]=0,E||(++I,m=[1].concat(m));for(T=m.length;!m[--T];);for(Y=0,R="";Y<=T;R+=y.charAt(m[Y++]));R=xs(R,I,y.charAt(0))}return R}}(),e=function(){function v(F,B,l){var g,y,E,I,T=0,M=F.length,x=B%io,m=B/io|0;for(F=F.slice();M--;)E=F[M]%io,I=F[M]/io|0,g=m*E+I*x,y=x*E+g%io*io+T,T=(y/l|0)+(g/io|0)+m*I,F[M]=y%l;return T&&(F=[T].concat(F)),F}function C(F,B,l,g){var y,E;if(l!=g)E=l>g?1:-1;else for(y=E=0;yB[y]?1:-1;break}return E}function R(F,B,l,g){for(var y=0;l--;)F[l]-=y,y=F[l]1;F.splice(0,1));}return function(F,B,l,g,y){var E,I,T,M,x,m,O,Y,$,b,j,z,W,ie,te,ee,se,oe=F.s==B.s?1:-1,J=F.c,ue=B.c;if(!J||!J[0]||!ue||!ue[0])return new U(!F.s||!B.s||(J?ue&&J[0]==ue[0]:!ue)?NaN:J&&J[0]==0||!ue?oe*0:oe/0);for(Y=new U(oe),$=Y.c=[],I=F.e-B.e,oe=l+I+1,y||(y=mi,I=xn(F.e/be)-xn(B.e/be),oe=oe/be|0),T=0;ue[T]==(J[T]||0);T++);if(ue[T]>(J[T]||0)&&I--,oe<0)$.push(1),M=!0;else{for(ie=J.length,ee=ue.length,T=0,oe+=2,x=Nn(y/(ue[0]+1)),x>1&&(ue=v(ue,x,y),J=v(J,x,y),ee=ue.length,ie=J.length),W=ee,b=J.slice(0,ee),j=b.length;j=y/2&&te++;do{if(x=0,E=C(ue,b,ee,j),E<0){if(z=b[0],ee!=j&&(z=z*y+(b[1]||0)),x=Nn(z/te),x>1)for(x>=y&&(x=y-1),m=v(ue,x,y),O=m.length,j=b.length;C(m,b,O,j)==1;)x--,R(m,ee=10;oe/=10,T++);H(Y,l+(Y.e=T+I*be-1)+1,g,M)}else Y.e=I,Y.r=+M;return Y}}();function Q(v,C,R,F){var B,l,g,y,E;if(R==null?R=u:Ht(R,0,8),!v.c)return v.toString();if(B=v.c[0],g=v.e,C==null)E=Cn(v.c),E=F==1||F==2&&(g<=a||g>=c)?Ud(E,g):xs(E,g,"0");else if(v=H(new U(v),C,R),l=v.e,E=Cn(v.c),y=E.length,F==1||F==2&&(C<=l||l<=a)){for(;yy){if(--C>0)for(E+=".";C--;E+="0");}else if(C+=l-y,C>0)for(l+1==y&&(E+=".");C--;E+="0");return v.s<0&&B?"-"+E:E}function L(v,C){for(var R,F,B=1,l=new U(v[0]);B=10;B/=10,F++);return(R=F+R*be-1)>d?v.c=v.e=null:R=10;y/=10,B++);if(l=C-B,l<0)l+=be,g=C,E=M[I=0],T=Nn(E/x[B-g-1]%10);else if(I=Rw((l+1)/be),I>=M.length)if(F){for(;M.length<=I;M.push(0));E=T=0,B=1,l%=be,g=l-be+1}else break e;else{for(E=y=M[I],B=1;y>=10;y/=10,B++);l%=be,g=l-be+B,T=g<0?0:Nn(E/x[B-g-1]%10)}if(F=F||C<0||M[I+1]!=null||(g<0?E:E%x[B-g-1]),F=R<4?(T||F)&&(R==0||R==(v.s<0?3:2)):T>5||T==5&&(R==4||F||R==6&&(l>0?g>0?E/x[B-g]:0:M[I-1])%10&1||R==(v.s<0?8:7)),C<1||!M[0])return M.length=0,F?(C-=v.e+1,M[0]=x[(be-C%be)%be],v.e=-C||0):M[0]=v.e=0,v;if(l==0?(M.length=I,y=1,I--):(M.length=I+1,y=x[be-l],M[I]=g>0?Nn(E/x[B-g]%x[g])*y:0),F)for(;;)if(I==0){for(l=1,g=M[0];g>=10;g/=10,l++);for(g=M[0]+=y,y=1;g>=10;g/=10,y++);l!=y&&(v.e++,M[0]==mi&&(M[0]=1));break}else{if(M[I]+=y,M[I]!=mi)break;M[I--]=0,y=1}for(l=M.length;M[--l]===0;M.pop());}v.e>d?v.c=v.e=null:v.e=c?Ud(C,R):xs(C,R,"0"),v.s<0?"-"+C:C)}return i.absoluteValue=i.abs=function(){var v=new U(this);return v.s<0&&(v.s=1),v},i.comparedTo=function(v,C){return ba(this,new U(v,C))},i.decimalPlaces=i.dp=function(v,C){var R,F,B,l=this;if(v!=null)return Ht(v,0,mr),C==null?C=u:Ht(C,0,8),H(new U(l),v+l.e+1,C);if(!(R=l.c))return null;if(F=((B=R.length-1)-xn(this.e/be))*be,B=R[B])for(;B%10==0;B/=10,F--);return F<0&&(F=0),F},i.dividedBy=i.div=function(v,C){return e(this,new U(v,C),o,u)},i.dividedToIntegerBy=i.idiv=function(v,C){return e(this,new U(v,C),0,1)},i.exponentiatedBy=i.pow=function(v,C){var R,F,B,l,g,y,E,I,T,M=this;if(v=new U(v),v.c&&!v.isInteger())throw Error(Wr+"Exponent not an integer: "+q(v));if(C!=null&&(C=new U(C)),y=v.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!v.c||!v.c[0])return T=new U(Math.pow(+q(M),y?v.s*(2-Fd(v)):+q(v))),C?T.mod(C):T;if(E=v.s<0,C){if(C.c?!C.c[0]:!C.s)return new U(NaN);F=!E&&M.isInteger()&&C.isInteger(),F&&(M=M.mod(C))}else{if(v.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||y&&M.c[1]>=24e7:M.c[0]<8e13||y&&M.c[0]<=9999975e7)))return l=M.s<0&&Fd(v)?-0:0,M.e>-1&&(l=1/l),new U(E?1/l:l);_&&(l=Rw(_/be+2))}for(y?(R=new U(.5),E&&(v.s=1),I=Fd(v)):(B=Math.abs(+q(v)),I=B%2),T=new U(s);;){if(I){if(T=T.times(M),!T.c)break;l?T.c.length>l&&(T.c.length=l):F&&(T=T.mod(C))}if(B){if(B=Nn(B/2),B===0)break;I=B%2}else if(v=v.times(R),H(v,v.e+1,1),v.e>14)I=Fd(v);else{if(B=+q(v),B===0)break;I=B%2}M=M.times(M),l?M.c&&M.c.length>l&&(M.c.length=l):F&&(M=M.mod(C))}return F?T:(E&&(T=s.div(T)),C?T.mod(C):l?H(T,_,u,g):T)},i.integerValue=function(v){var C=new U(this);return v==null?v=u:Ht(v,0,8),H(C,C.e+1,v)},i.isEqualTo=i.eq=function(v,C){return ba(this,new U(v,C))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(v,C){return ba(this,new U(v,C))>0},i.isGreaterThanOrEqualTo=i.gte=function(v,C){return(C=ba(this,new U(v,C)))===1||C===0},i.isInteger=function(){return!!this.c&&xn(this.e/be)>this.c.length-2},i.isLessThan=i.lt=function(v,C){return ba(this,new U(v,C))<0},i.isLessThanOrEqualTo=i.lte=function(v,C){return(C=ba(this,new U(v,C)))===-1||C===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(v,C){var R,F,B,l,g=this,y=g.s;if(v=new U(v,C),C=v.s,!y||!C)return new U(NaN);if(y!=C)return v.s=-C,g.plus(v);var E=g.e/be,I=v.e/be,T=g.c,M=v.c;if(!E||!I){if(!T||!M)return T?(v.s=-C,v):new U(M?g:NaN);if(!T[0]||!M[0])return M[0]?(v.s=-C,v):new U(T[0]?g:u==3?-0:0)}if(E=xn(E),I=xn(I),T=T.slice(),y=E-I){for((l=y<0)?(y=-y,B=T):(I=E,B=M),B.reverse(),C=y;C--;B.push(0));B.reverse()}else for(F=(l=(y=T.length)<(C=M.length))?y:C,y=C=0;C0)for(;C--;T[R++]=0);for(C=mi-1;F>y;){if(T[--F]=0;){for(R=0,x=z[B]%$,m=z[B]/$|0,g=E,l=B+g;l>B;)I=j[--g]%$,T=j[g]/$|0,y=m*I+T*x,I=x*I+y%$*$+O[l]+R,R=(I/Y|0)+(y/$|0)+m*T,O[l--]=I%Y;O[l]=R}return R?++F:O.splice(0,1),k(v,O,F)},i.negated=function(){var v=new U(this);return v.s=-v.s||null,v},i.plus=function(v,C){var R,F=this,B=F.s;if(v=new U(v,C),C=v.s,!B||!C)return new U(NaN);if(B!=C)return v.s=-C,F.minus(v);var l=F.e/be,g=v.e/be,y=F.c,E=v.c;if(!l||!g){if(!y||!E)return new U(B/0);if(!y[0]||!E[0])return E[0]?v:new U(y[0]?F:B*0)}if(l=xn(l),g=xn(g),y=y.slice(),B=l-g){for(B>0?(g=l,R=E):(B=-B,R=y),R.reverse();B--;R.push(0));R.reverse()}for(B=y.length,C=E.length,B-C<0&&(R=E,E=y,y=R,C=B),B=0;C;)B=(y[--C]=y[C]+E[C]+B)/mi|0,y[C]=mi===y[C]?0:y[C]%mi;return B&&(y=[B].concat(y),++g),k(v,y,g)},i.precision=i.sd=function(v,C){var R,F,B,l=this;if(v!=null&&v!==!!v)return Ht(v,1,mr),C==null?C=u:Ht(C,0,8),H(new U(l),v,C);if(!(R=l.c))return null;if(B=R.length-1,F=B*be+1,B=R[B]){for(;B%10==0;B/=10,F--);for(B=R[0];B>=10;B/=10,F++);}return v&&l.e+1>F&&(F=l.e+1),F},i.shiftedBy=function(v){return Ht(v,-Bw,Bw),this.times("1e"+v)},i.squareRoot=i.sqrt=function(){var v,C,R,F,B,l=this,g=l.c,y=l.s,E=l.e,I=o+4,T=new U("0.5");if(y!==1||!g||!g[0])return new U(!y||y<0&&(!g||g[0])?NaN:g?l:1/0);if(y=Math.sqrt(+q(l)),y==0||y==1/0?(C=Cn(g),(C.length+E)%2==0&&(C+="0"),y=Math.sqrt(+C),E=xn((E+1)/2)-(E<0||E%2),y==1/0?C="5e"+E:(C=y.toExponential(),C=C.slice(0,C.indexOf("e")+1)+E),R=new U(C)):R=new U(y+""),R.c[0]){for(E=R.e,y=E+I,y<3&&(y=0);;)if(B=R,R=T.times(B.plus(e(l,B,I,1))),Cn(B.c).slice(0,y)===(C=Cn(R.c)).slice(0,y))if(R.e0&&O>0){for(l=O%y||y,T=m.substr(0,l);l0&&(T+=I+m.slice(l)),x&&(T="-"+T)}F=M?T+(R.decimalSeparator||"")+((E=+R.fractionGroupSize)?M.replace(new RegExp("\\d{"+E+"}\\B","g"),"$&"+(R.fractionGroupSeparator||"")):M):T}return(R.prefix||"")+F+(R.suffix||"")},i.toFraction=function(v){var C,R,F,B,l,g,y,E,I,T,M,x,m=this,O=m.c;if(v!=null&&(y=new U(v),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(Wr+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+q(y));if(!O)return new U(m);for(C=new U(s),I=R=new U(s),F=E=new U(s),x=Cn(O),l=C.e=x.length-m.e-1,C.c[0]=Mw[(g=l%be)<0?be+g:g],v=!v||y.comparedTo(C)>0?l>0?C:I:y,g=d,d=1/0,y=new U(x),E.c[0]=0;T=e(y,C,0,1),B=R.plus(T.times(F)),B.comparedTo(v)!=1;)R=F,F=B,I=E.plus(T.times(B=I)),E=B,C=y.minus(T.times(B=C)),y=B;return B=e(v.minus(R),F,0,1),E=E.plus(B.times(I)),R=R.plus(B.times(F)),E.s=I.s=m.s,l=l*2,M=e(I,F,l,u).minus(m).abs().comparedTo(e(E,R,l,u).minus(m).abs())<1?[I,F]:[E,R],d=g,M},i.toNumber=function(){return+q(this)},i.toPrecision=function(v,C){return v!=null&&Ht(v,1,mr),Q(this,v,C,2)},i.toString=function(v){var C,R=this,F=R.s,B=R.e;return B===null?F?(C="Infinity",F<0&&(C="-"+C)):C="NaN":(v==null?C=B<=a||B>=c?Ud(Cn(R.c),B):xs(Cn(R.c),B,"0"):v===10&&V?(R=H(new U(R),o+B+1,u),C=xs(Cn(R.c),R.e,"0")):(Ht(v,2,P.length,"Base"),C=r(xs(Cn(R.c),B,"0"),10,v,F,!0)),F<0&&R.c[0]&&(C="-"+C)),C},i.valueOf=i.toJSON=function(){return q(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&U.set(t),U}function xn(t){var e=t|0;return t>0||t===e?e:e-1}function Cn(t){for(var e,r,n=1,i=t.length,s=t[0]+"";nc^r?1:-1;for(u=(a=i.length)<(c=s.length)?a:c,o=0;os[o]^r?1:-1;return a==c?0:a>c^r?1:-1}function Ht(t,e,r,n){if(tr||t!==Nn(t))throw Error(Wr+(n||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Fd(t){var e=t.c.length-1;return xn(t.e/be)==e&&t.c[e]%2!=0}function Ud(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function xs(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e{h();hH=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Rw=Math.ceil,Nn=Math.floor,Wr="[BigNumber Error] ",V3=Wr+"Number primitive has more than 15 significant digits: ",mi=1e14,be=14,Bw=9007199254740991,Mw=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],io=1e7,mr=1e9;H3=k3(),Nu=H3});var Ie=D(ce=>{"use strict";h();Object.defineProperty(ce,"__esModule",{value:!0});ce.ErrSmartContractQuery=ce.ErrParseTransactionOutcome=ce.ErrInvalidInnerTransaction=ce.ErrBadUsage=ce.ErrInvalidTokenIdentifier=ce.ErrIsCompletedFieldIsMissingOnTransaction=ce.ErrGasLimitShouldBe0ForInnerTransaction=ce.ErrInvalidRelayedV2BuilderArguments=ce.ErrInvalidRelayedV1BuilderArguments=ce.ErrNotImplemented=ce.ErrContractInteraction=ce.ErrCodec=ce.ErrCannotParseTransactionOutcome=ce.ErrCannotParseContractResults=ce.ErrMissingFieldOnEnum=ce.ErrMissingFieldOnStruct=ce.ErrTypingSystem=ce.ErrMock=ce.ErrContractHasNoAddress=ce.ErrContract=ce.ErrExpectedTransactionEventsNotFound=ce.ErrExpectedTransactionStatusNotReached=ce.ErrTransactionWatcherTimeout=ce.ErrAsyncTimerAborted=ce.ErrAsyncTimerAlreadyRunning=ce.ErrInvalidFunctionName=ce.ErrSignatureCannotCreate=ce.ErrTransactionOptionsInvalid=ce.ErrTransactionVersionInvalid=ce.ErrNonceInvalid=ce.ErrNotEnoughGas=ce.ErrAddressEmpty=ce.ErrAddressBadHrp=ce.ErrAddressCannotCreate=ce.ErrUnexpectedCondition=ce.ErrInvariantFailed=ce.ErrBadType=ce.ErrUnsupportedOperation=ce.ErrInvalidArgument=ce.Err=void 0;var Te=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};ce.Err=Te;var Lw=class extends Te{constructor(e,r){super(`Invalid argument: ${e}`,r)}};ce.ErrInvalidArgument=Lw;var Fw=class extends Te{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};ce.ErrUnsupportedOperation=Fw;var Uw=class extends Te{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};ce.ErrBadType=Uw;var qw=class extends Te{constructor(e){super(`Invariant failed: [${e}]`)}};ce.ErrInvariantFailed=qw;var Vw=class extends Te{constructor(e){super(`Unexpected condition: [${e}]`)}};ce.ErrUnexpectedCondition=Vw;var kw=class extends Te{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};ce.ErrAddressCannotCreate=kw;var Hw=class extends Te{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};ce.ErrAddressBadHrp=Hw;var Gw=class extends Te{constructor(){super("Address is empty")}};ce.ErrAddressEmpty=Gw;var jw=class extends Te{constructor(e){super(`Not enough gas provided: ${e}`)}};ce.ErrNotEnoughGas=jw;var zw=class extends Te{constructor(e){super(`Invalid nonce: ${e}`)}};ce.ErrNonceInvalid=zw;var Qw=class extends Te{constructor(e){super(`Invalid transaction version: ${e}`)}};ce.ErrTransactionVersionInvalid=Qw;var Kw=class extends Te{constructor(e){super(`Invalid transaction options: ${e}`)}};ce.ErrTransactionOptionsInvalid=Kw;var Ww=class extends Te{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};ce.ErrSignatureCannotCreate=Ww;var $w=class extends Te{constructor(){super("Invalid function name")}};ce.ErrInvalidFunctionName=$w;var Yw=class extends Te{constructor(){super("Async timer already running")}};ce.ErrAsyncTimerAlreadyRunning=Yw;var Jw=class extends Te{constructor(){super("Async timer aborted")}};ce.ErrAsyncTimerAborted=Jw;var Xw=class extends Te{constructor(){super("TransactionWatcher has timed out")}};ce.ErrTransactionWatcherTimeout=Xw;var Zw=class extends Te{constructor(){super("Expected transaction status not reached")}};ce.ErrExpectedTransactionStatusNotReached=Zw;var ev=class extends Te{constructor(){super("Expected transaction events not found")}};ce.ErrExpectedTransactionEventsNotFound=ev;var qd=class extends Te{constructor(e){super(e)}};ce.ErrContract=qd;var tv=class extends qd{constructor(){super(` +var LK=Object.create;var Rp=Object.defineProperty;var FK=Object.getOwnPropertyDescriptor;var qK=Object.getOwnPropertyNames;var UK=Object.getPrototypeOf,kK=Object.prototype.hasOwnProperty;var Mp=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var pe=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Zt=(t,e)=>{for(var r in e)Rp(t,r,{get:e[r],enumerable:!0})},Pp=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of qK(e))!kK.call(t,i)&&i!==r&&Rp(t,i,{get:()=>e[i],enumerable:!(n=FK(e,i))||n.enumerable});return t},$r=(t,e,r)=>(Pp(t,e,"default"),r&&Pp(r,e,"default")),ge=(t,e,r)=>(r=t!=null?LK(UK(t)):{},Pp(e||!t||!t.__esModule?Rp(r,"default",{value:t,enumerable:!0}):r,t)),qe=t=>Pp(Rp({},"__esModule",{value:!0}),t);var wC=L(Dp=>{"use strict";h();Dp.byteLength=HK;Dp.toByteArray=zK;Dp.fromByteArray=KK;var bs=[],ni=[],VK=typeof Uint8Array<"u"?Uint8Array:Array,dA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(vc=0,vC=dA.length;vc0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function HK(t){var e=bC(t),r=e[0],n=e[1];return(r+n)*3/4-n}function GK(t,e,r){return(e+r)*3/4-r}function zK(t){var e,r=bC(t),n=r[0],i=r[1],s=new VK(GK(t,n,i)),o=0,c=i>0?n-4:n,a;for(a=0;a>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ni[t.charCodeAt(a)]<<2|ni[t.charCodeAt(a+1)]>>4,s[o++]=e&255),i===1&&(e=ni[t.charCodeAt(a)]<<10|ni[t.charCodeAt(a+1)]<<4|ni[t.charCodeAt(a+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function jK(t){return bs[t>>18&63]+bs[t>>12&63]+bs[t>>6&63]+bs[t&63]}function QK(t,e,r){for(var n,i=[],s=e;sc?c:o+s));return n===1?(e=t[r-1],i.push(bs[e>>2]+bs[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(bs[e>>10]+bs[e>>4&63]+bs[e<<2&63]+"=")),i.join("")}});var AC=L(hA=>{h();hA.read=function(t,e,r,n,i){var s,o,c=i*8-n-1,a=(1<>1,f=-7,p=r?i-1:0,S=r?-1:1,I=t[e+p];for(p+=S,s=I&(1<<-f)-1,I>>=-f,f+=c;f>0;s=s*256+t[e+p],p+=S,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+p],p+=S,f-=8);if(s===0)s=1-u;else{if(s===a)return o?NaN:(I?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(I?-1:1)*o*Math.pow(2,s-n)};hA.write=function(t,e,r,n,i,s){var o,c,a,u=s*8-i-1,f=(1<>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=n?0:s-1,N=n?1:-1,R=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+p>=1?e+=S/a:e+=S*Math.pow(2,1-p),e*a>=2&&(o++,a/=2),o+p>=f?(c=0,o=f):o+p>=1?(c=(e*a-1)*Math.pow(2,i),o=o+p):(c=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[r+I]=c&255,I+=N,c/=256,i-=8);for(o=o<0;t[r+I]=o&255,I+=N,o/=256,u-=8);t[r+I-N]|=R*128}});var wo=L(Uu=>{"use strict";h();var pA=wC(),qu=AC(),EC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Uu.Buffer=se;Uu.SlowBuffer=ZK;Uu.INSPECT_MAX_BYTES=50;var Bp=2147483647;Uu.kMaxLength=Bp;se.TYPED_ARRAY_SUPPORT=WK();!se.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 WK(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(se.prototype,"parent",{enumerable:!0,get:function(){if(se.isBuffer(this))return this.buffer}});Object.defineProperty(se.prototype,"offset",{enumerable:!0,get:function(){if(se.isBuffer(this))return this.byteOffset}});function bo(t){if(t>Bp)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,se.prototype),e}function se(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return vA(t)}return TC(t,e,r)}se.poolSize=8192;function TC(t,e,r){if(typeof t=="string")return YK(t,e);if(ArrayBuffer.isView(t))return JK(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(ws(t,ArrayBuffer)||t&&ws(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ws(t,SharedArrayBuffer)||t&&ws(t.buffer,SharedArrayBuffer)))return mA(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return se.from(n,e,r);var i=XK(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return se.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}se.from=function(t,e,r){return TC(t,e,r)};Object.setPrototypeOf(se.prototype,Uint8Array.prototype);Object.setPrototypeOf(se,Uint8Array);function IC(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function $K(t,e,r){return IC(t),t<=0?bo(t):e!==void 0?typeof r=="string"?bo(t).fill(e,r):bo(t).fill(e):bo(t)}se.alloc=function(t,e,r){return $K(t,e,r)};function vA(t){return IC(t),bo(t<0?0:bA(t)|0)}se.allocUnsafe=function(t){return vA(t)};se.allocUnsafeSlow=function(t){return vA(t)};function YK(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!se.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=CC(t,e)|0,n=bo(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function gA(t){for(var e=t.length<0?0:bA(t.length)|0,r=bo(e),n=0;n=Bp)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Bp.toString(16)+" bytes");return t|0}function ZK(t){return+t!=t&&(t=0),se.alloc(+t)}se.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==se.prototype};se.compare=function(e,r){if(ws(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),ws(r,Uint8Array)&&(r=se.from(r,r.offset,r.byteLength)),!se.isBuffer(e)||!se.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?se.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(se.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function CC(t,e){if(se.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||ws(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return yA(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return MC(t).length;default:if(i)return n?-1:yA(t).length;e=(""+e).toLowerCase(),i=!0}}se.byteLength=CC;function eW(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return lW(this,e,r);case"utf8":case"utf-8":return NC(this,e,r);case"ascii":return cW(this,e,r);case"latin1":case"binary":return uW(this,e,r);case"base64":return oW(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fW(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}se.prototype._isBuffer=!0;function bc(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}se.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};EC&&(se.prototype[EC]=se.prototype.inspect);se.prototype.compare=function(e,r,n,i,s){if(ws(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),!se.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,c=n-r,a=Math.min(o,c),u=this.slice(i,s),f=e.slice(r,n),p=0;p2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,wA(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=se.from(e,n)),se.isBuffer(e))return e.length===0?-1:SC(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):SC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function SC(t,e,r,n,i){var s=1,o=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,c/=2,r/=2}function a(I,N){return s===1?I[N]:I.readUInt16BE(N*s)}var u;if(i){var f=-1;for(u=r;uo&&(r=o-c),u=r;u>=0;u--){for(var p=!0,S=0;Si&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return tW(this,e,r,n);case"utf8":case"utf-8":return rW(this,e,r,n);case"ascii":case"latin1":case"binary":return nW(this,e,r,n);case"base64":return iW(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sW(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};se.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function oW(t,e,r){return e===0&&r===t.length?pA.fromByteArray(t):pA.fromByteArray(t.slice(e,r))}function NC(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+c<=r){var a,u,f,p;switch(c){case 1:s<128&&(o=s);break;case 2:a=t[i+1],(a&192)===128&&(p=(s&31)<<6|a&63,p>127&&(o=p));break;case 3:a=t[i+1],u=t[i+2],(a&192)===128&&(u&192)===128&&(p=(s&15)<<12|(a&63)<<6|u&63,p>2047&&(p<55296||p>57343)&&(o=p));break;case 4:a=t[i+1],u=t[i+2],f=t[i+3],(a&192)===128&&(u&192)===128&&(f&192)===128&&(p=(s&15)<<18|(a&63)<<12|(u&63)<<6|f&63,p>65535&&p<1114112&&(o=p))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return aW(n)}var _C=4096;function aW(t){var e=t.length;if(e<=_C)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}se.prototype.readUintLE=se.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};se.prototype.readUint8=se.prototype.readUInt8=function(e,r){return e=e>>>0,r||Fr(e,1,this.length),this[e]};se.prototype.readUint16LE=se.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Fr(e,2,this.length),this[e]|this[e+1]<<8};se.prototype.readUint16BE=se.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Fr(e,2,this.length),this[e]<<8|this[e+1]};se.prototype.readUint32LE=se.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};se.prototype.readUint32BE=se.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};se.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};se.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Fr(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};se.prototype.readInt8=function(e,r){return e=e>>>0,r||Fr(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};se.prototype.readInt16LE=function(e,r){e=e>>>0,r||Fr(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};se.prototype.readInt16BE=function(e,r){e=e>>>0,r||Fr(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};se.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};se.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};se.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),qu.read(this,e,!0,23,4)};se.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Fr(e,4,this.length),qu.read(this,e,!1,23,4)};se.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Fr(e,8,this.length),qu.read(this,e,!0,52,8)};se.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Fr(e,8,this.length),qu.read(this,e,!1,52,8)};function Cn(t,e,r,n,i,s){if(!se.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}se.prototype.writeUintLE=se.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Cn(this,e,r,n,s,0)}var o=1,c=0;for(this[r]=e&255;++c>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Cn(this,e,r,n,s,0)}var o=n-1,c=1;for(this[r+o]=e&255;--o>=0&&(c*=256);)this[r+o]=e/c&255;return r+n};se.prototype.writeUint8=se.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,1,255,0),this[r]=e&255,r+1};se.prototype.writeUint16LE=se.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};se.prototype.writeUint16BE=se.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};se.prototype.writeUint32LE=se.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};se.prototype.writeUint32BE=se.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};se.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Cn(this,e,r,n,s-1,-s)}var o=0,c=1,a=0;for(this[r]=e&255;++o>0)-a&255;return r+n};se.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Cn(this,e,r,n,s-1,-s)}var o=n-1,c=1,a=0;for(this[r+o]=e&255;--o>=0&&(c*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/c>>0)-a&255;return r+n};se.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};se.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};se.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};se.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};se.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Cn(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function OC(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function PC(t,e,r,n,i){return e=+e,r=r>>>0,i||OC(t,e,r,4,34028234663852886e22,-34028234663852886e22),qu.write(t,e,r,n,23,4),r+4}se.prototype.writeFloatLE=function(e,r,n){return PC(this,e,r,!0,n)};se.prototype.writeFloatBE=function(e,r,n){return PC(this,e,r,!1,n)};function RC(t,e,r,n,i){return e=+e,r=r>>>0,i||OC(t,e,r,8,17976931348623157e292,-17976931348623157e292),qu.write(t,e,r,n,52,8),r+8}se.prototype.writeDoubleLE=function(e,r,n){return RC(this,e,r,!0,n)};se.prototype.writeDoubleBE=function(e,r,n){return RC(this,e,r,!1,n)};se.prototype.copy=function(e,r,n,i){if(!se.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function pW(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function MC(t){return pA.toByteArray(hW(t))}function Lp(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function ws(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function wA(t){return t!==t}var mW=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var qC=L((AEe,FC)=>{h();var Ar=FC.exports={},As,Es;function AA(){throw new Error("setTimeout has not been defined")}function EA(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?As=setTimeout:As=AA}catch{As=AA}try{typeof clearTimeout=="function"?Es=clearTimeout:Es=EA}catch{Es=EA}})();function DC(t){if(As===setTimeout)return setTimeout(t,0);if((As===AA||!As)&&setTimeout)return As=setTimeout,setTimeout(t,0);try{return As(t,0)}catch{try{return As.call(null,t,0)}catch{return As.call(this,t,0)}}}function yW(t){if(Es===clearTimeout)return clearTimeout(t);if((Es===EA||!Es)&&clearTimeout)return Es=clearTimeout,clearTimeout(t);try{return Es(t)}catch{try{return Es.call(null,t)}catch{return Es.call(this,t)}}}var Ao=[],ku=!1,wc,Fp=-1;function vW(){!ku||!wc||(ku=!1,wc.length?Ao=wc.concat(Ao):Fp=-1,Ao.length&&BC())}function BC(){if(!ku){var t=DC(vW);ku=!0;for(var e=Ao.length;e;){for(wc=Ao,Ao=[];++Fp1)for(var r=1;r{b=ge(wo()),O=ge(qC()),bW=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=bW});var jt={};Zt(jt,{BigNumber:()=>VC,default:()=>Vu});function kC(t){var e,r,n,i=k.prototype={constructor:k,toString:null,valueOf:null},s=new k(1),o=20,c=4,a=-7,u=21,f=-1e7,p=1e7,S=!1,I=1,N=0,R={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},D="0123456789abcdefghijklmnopqrstuvwxyz",U=!0;function k(C,B){var x,g,v,l,d,m,w,_,A=this;if(!(A instanceof k))return new k(C,B);if(B==null){if(C&&C._isBigNumber===!0){A.s=C.s,!C.c||C.e>p?A.c=A.e=null:C.e=10;d/=10,l++);l>p?A.c=A.e=null:(A.e=l,A.c=[C]);return}_=String(C)}else{if(!wW.test(_=String(C)))return n(A,_,m);A.s=_.charCodeAt(0)==45?(_=_.slice(1),-1):1}(l=_.indexOf("."))>-1&&(_=_.replace(".","")),(d=_.search(/e/i))>0?(l<0&&(l=d),l+=+_.slice(d+1),_=_.substring(0,d)):l<0&&(l=_.length)}else{if(fr(B,2,D.length,"Base"),B==10&&U)return A=new k(C),V(A,o+A.e+1,c);if(_=String(C),m=typeof C=="number"){if(C*0!=0)return n(A,_,m,B);if(A.s=1/C<0?(_=_.slice(1),-1):1,k.DEBUG&&_.replace(/^0\.0*|\./,"").length>15)throw Error(UC+C)}else A.s=_.charCodeAt(0)===45?(_=_.slice(1),-1):1;for(x=D.slice(0,B),l=d=0,w=_.length;dl){l=w;continue}}else if(!v&&(_==_.toUpperCase()&&(_=_.toLowerCase())||_==_.toLowerCase()&&(_=_.toUpperCase()))){v=!0,d=-1,l=0;continue}return n(A,String(C),m,B)}m=!1,_=r(_,B,10,A.s),(l=_.indexOf("."))>-1?_=_.replace(".",""):l=_.length}for(d=0;_.charCodeAt(d)===48;d++);for(w=_.length;_.charCodeAt(--w)===48;);if(_=_.slice(d,++w)){if(w-=d,m&&k.DEBUG&&w>15&&(C>_A||C!==si(C)))throw Error(UC+A.s*C);if((l=l-d-1)>p)A.c=A.e=null;else if(l=-qr&&v<=qr&&v===si(v)){if(g[0]===0){if(v===0&&g.length===1)return!0;break e}if(B=(v+1)%ke,B<1&&(B+=ke),String(g[0]).length==B){for(B=0;B=Wi||x!==si(x))break e;if(x!==0)return!0}}}else if(g===null&&v===null&&(l===null||l===1||l===-1))return!0;throw Error(xn+"Invalid BigNumber: "+C)},k.maximum=k.max=function(){return H(arguments,-1)},k.minimum=k.min=function(){return H(arguments,1)},k.random=function(){var C=9007199254740992,B=Math.random()*C&2097151?function(){return si(Math.random()*C)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var g,v,l,d,m,w=0,_=[],A=new k(s);if(x==null?x=o:fr(x,0,qr),d=SA(x/ke),S)if(crypto.getRandomValues){for(g=crypto.getRandomValues(new Uint32Array(d*=2));w>>11),m>=9e15?(v=crypto.getRandomValues(new Uint32Array(2)),g[w]=v[0],g[w+1]=v[1]):(_.push(m%1e14),w+=2);w=d/2}else if(crypto.randomBytes){for(g=crypto.randomBytes(d*=7);w=9e15?crypto.randomBytes(7).copy(g,w):(_.push(m%1e14),w+=7);w=d/7}else throw S=!1,Error(xn+"crypto unavailable");if(!S)for(;w=10;m/=10,w++);wv-1&&(m[d+1]==null&&(m[d+1]=0),m[d+1]+=m[d]/v|0,m[d]%=v)}return m.reverse()}return function(x,g,v,l,d){var m,w,_,A,y,T,E,M,W=x.indexOf("."),Y=o,P=c;for(W>=0&&(A=N,N=0,x=x.replace(".",""),M=new k(g),T=M.pow(x.length-W),N=A,M.c=B(So(ii(T.c),T.e,"0"),10,v,C),M.e=M.c.length),E=B(x,g,v,d?(m=D,C):(m=C,D)),_=A=E.length;E[--A]==0;E.pop());if(!E[0])return m.charAt(0);if(W<0?--_:(T.c=E,T.e=_,T.s=l,T=e(T,M,Y,P,v),E=T.c,y=T.r,_=T.e),w=_+Y+1,W=E[w],A=v/2,y=y||w<0||E[w+1]!=null,y=P<4?(W!=null||y)&&(P==0||P==(T.s<0?3:2)):W>A||W==A&&(P==4||y||P==6&&E[w-1]&1||P==(T.s<0?8:7)),w<1||!E[0])x=y?So(m.charAt(1),-Y,m.charAt(0)):m.charAt(0);else{if(E.length=w,y)for(--v;++E[--w]>v;)E[w]=0,w||(++_,E=[1].concat(E));for(A=E.length;!E[--A];);for(W=0,x="";W<=A;x+=m.charAt(E[W++]));x=So(x,_,m.charAt(0))}return x}}(),e=function(){function C(g,v,l){var d,m,w,_,A=0,y=g.length,T=v%ta,E=v/ta|0;for(g=g.slice();y--;)w=g[y]%ta,_=g[y]/ta|0,d=E*w+_*T,m=T*w+d%ta*ta+A,A=(m/l|0)+(d/ta|0)+E*_,g[y]=m%l;return A&&(g=[A].concat(g)),g}function B(g,v,l,d){var m,w;if(l!=d)w=l>d?1:-1;else for(m=w=0;mv[m]?1:-1;break}return w}function x(g,v,l,d){for(var m=0;l--;)g[l]-=m,m=g[l]1;g.splice(0,1));}return function(g,v,l,d,m){var w,_,A,y,T,E,M,W,Y,P,G,Q,$,ee,ie,X,re,ae=g.s==v.s?1:-1,Z=g.c,oe=v.c;if(!Z||!Z[0]||!oe||!oe[0])return new k(!g.s||!v.s||(Z?oe&&Z[0]==oe[0]:!oe)?NaN:Z&&Z[0]==0||!oe?ae*0:ae/0);for(W=new k(ae),Y=W.c=[],_=g.e-v.e,ae=l+_+1,m||(m=Wi,_=oi(g.e/ke)-oi(v.e/ke),ae=ae/ke|0),A=0;oe[A]==(Z[A]||0);A++);if(oe[A]>(Z[A]||0)&&_--,ae<0)Y.push(1),y=!0;else{for(ee=Z.length,X=oe.length,A=0,ae+=2,T=si(m/(oe[0]+1)),T>1&&(oe=C(oe,T,m),Z=C(Z,T,m),X=oe.length,ee=Z.length),$=X,P=Z.slice(0,X),G=P.length;G=m/2&&ie++;do{if(T=0,w=B(oe,P,X,G),w<0){if(Q=P[0],X!=G&&(Q=Q*m+(P[1]||0)),T=si(Q/ie),T>1)for(T>=m&&(T=m-1),E=C(oe,T,m),M=E.length,G=P.length;B(E,P,M,G)==1;)T--,x(E,X=10;ae/=10,A++);V(W,l+(W.e=A+_*ke-1)+1,d,y)}else W.e=_,W.r=+y;return W}}();function z(C,B,x,g){var v,l,d,m,w;if(x==null?x=c:fr(x,0,8),!C.c)return C.toString();if(v=C.c[0],d=C.e,B==null)w=ii(C.c),w=g==1||g==2&&(d<=a||d>=u)?Up(w,d):So(w,d,"0");else if(C=V(new k(C),B,x),l=C.e,w=ii(C.c),m=w.length,g==1||g==2&&(B<=l||l<=a)){for(;mm){if(--B>0)for(w+=".";B--;w+="0");}else if(B+=l-m,B>0)for(l+1==m&&(w+=".");B--;w+="0");return C.s<0&&v?"-"+w:w}function H(C,B){for(var x,g,v=1,l=new k(C[0]);v=10;v/=10,g++);return(x=g+x*ke-1)>p?C.c=C.e=null:x=10;m/=10,v++);if(l=B-v,l<0)l+=ke,d=B,w=y[_=0],A=si(w/T[v-d-1]%10);else if(_=SA((l+1)/ke),_>=y.length)if(g){for(;y.length<=_;y.push(0));w=A=0,v=1,l%=ke,d=l-ke+1}else break e;else{for(w=m=y[_],v=1;m>=10;m/=10,v++);l%=ke,d=l-ke+v,A=d<0?0:si(w/T[v-d-1]%10)}if(g=g||B<0||y[_+1]!=null||(d<0?w:w%T[v-d-1]),g=x<4?(A||g)&&(x==0||x==(C.s<0?3:2)):A>5||A==5&&(x==4||g||x==6&&(l>0?d>0?w/T[v-d]:0:y[_-1])%10&1||x==(C.s<0?8:7)),B<1||!y[0])return y.length=0,g?(B-=C.e+1,y[0]=T[(ke-B%ke)%ke],C.e=-B||0):y[0]=C.e=0,C;if(l==0?(y.length=_,m=1,_--):(y.length=_+1,m=T[ke-l],y[_]=d>0?si(w/T[v-d]%T[d])*m:0),g)for(;;)if(_==0){for(l=1,d=y[0];d>=10;d/=10,l++);for(d=y[0]+=m,m=1;d>=10;d/=10,m++);l!=m&&(C.e++,y[0]==Wi&&(y[0]=1));break}else{if(y[_]+=m,y[_]!=Wi)break;y[_--]=0,m=1}for(l=y.length;y[--l]===0;y.pop());}C.e>p?C.c=C.e=null:C.e=u?Up(B,x):So(B,x,"0"),C.s<0?"-"+B:B)}return i.absoluteValue=i.abs=function(){var C=new k(this);return C.s<0&&(C.s=1),C},i.comparedTo=function(C,B){return Ac(this,new k(C,B))},i.decimalPlaces=i.dp=function(C,B){var x,g,v,l=this;if(C!=null)return fr(C,0,qr),B==null?B=c:fr(B,0,8),V(new k(l),C+l.e+1,B);if(!(x=l.c))return null;if(g=((v=x.length-1)-oi(this.e/ke))*ke,v=x[v])for(;v%10==0;v/=10,g--);return g<0&&(g=0),g},i.dividedBy=i.div=function(C,B){return e(this,new k(C,B),o,c)},i.dividedToIntegerBy=i.idiv=function(C,B){return e(this,new k(C,B),0,1)},i.exponentiatedBy=i.pow=function(C,B){var x,g,v,l,d,m,w,_,A,y=this;if(C=new k(C),C.c&&!C.isInteger())throw Error(xn+"Exponent not an integer: "+q(C));if(B!=null&&(B=new k(B)),m=C.e>14,!y.c||!y.c[0]||y.c[0]==1&&!y.e&&y.c.length==1||!C.c||!C.c[0])return A=new k(Math.pow(+q(y),m?C.s*(2-qp(C)):+q(C))),B?A.mod(B):A;if(w=C.s<0,B){if(B.c?!B.c[0]:!B.s)return new k(NaN);g=!w&&y.isInteger()&&B.isInteger(),g&&(y=y.mod(B))}else{if(C.e>9&&(y.e>0||y.e<-1||(y.e==0?y.c[0]>1||m&&y.c[1]>=24e7:y.c[0]<8e13||m&&y.c[0]<=9999975e7)))return l=y.s<0&&qp(C)?-0:0,y.e>-1&&(l=1/l),new k(w?1/l:l);N&&(l=SA(N/ke+2))}for(m?(x=new k(.5),w&&(C.s=1),_=qp(C)):(v=Math.abs(+q(C)),_=v%2),A=new k(s);;){if(_){if(A=A.times(y),!A.c)break;l?A.c.length>l&&(A.c.length=l):g&&(A=A.mod(B))}if(v){if(v=si(v/2),v===0)break;_=v%2}else if(C=C.times(x),V(C,C.e+1,1),C.e>14)_=qp(C);else{if(v=+q(C),v===0)break;_=v%2}y=y.times(y),l?y.c&&y.c.length>l&&(y.c.length=l):g&&(y=y.mod(B))}return g?A:(w&&(A=s.div(A)),B?A.mod(B):l?V(A,N,c,d):A)},i.integerValue=function(C){var B=new k(this);return C==null?C=c:fr(C,0,8),V(B,B.e+1,C)},i.isEqualTo=i.eq=function(C,B){return Ac(this,new k(C,B))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(C,B){return Ac(this,new k(C,B))>0},i.isGreaterThanOrEqualTo=i.gte=function(C,B){return(B=Ac(this,new k(C,B)))===1||B===0},i.isInteger=function(){return!!this.c&&oi(this.e/ke)>this.c.length-2},i.isLessThan=i.lt=function(C,B){return Ac(this,new k(C,B))<0},i.isLessThanOrEqualTo=i.lte=function(C,B){return(B=Ac(this,new k(C,B)))===-1||B===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(C,B){var x,g,v,l,d=this,m=d.s;if(C=new k(C,B),B=C.s,!m||!B)return new k(NaN);if(m!=B)return C.s=-B,d.plus(C);var w=d.e/ke,_=C.e/ke,A=d.c,y=C.c;if(!w||!_){if(!A||!y)return A?(C.s=-B,C):new k(y?d:NaN);if(!A[0]||!y[0])return y[0]?(C.s=-B,C):new k(A[0]?d:c==3?-0:0)}if(w=oi(w),_=oi(_),A=A.slice(),m=w-_){for((l=m<0)?(m=-m,v=A):(_=w,v=y),v.reverse(),B=m;B--;v.push(0));v.reverse()}else for(g=(l=(m=A.length)<(B=y.length))?m:B,m=B=0;B0)for(;B--;A[x++]=0);for(B=Wi-1;g>m;){if(A[--g]=0;){for(x=0,T=Q[v]%Y,E=Q[v]/Y|0,d=w,l=v+d;l>v;)_=G[--d]%Y,A=G[d]/Y|0,m=E*_+A*T,_=T*_+m%Y*Y+M[l]+x,x=(_/W|0)+(m/Y|0)+E*A,M[l--]=_%W;M[l]=x}return x?++g:M.splice(0,1),F(C,M,g)},i.negated=function(){var C=new k(this);return C.s=-C.s||null,C},i.plus=function(C,B){var x,g=this,v=g.s;if(C=new k(C,B),B=C.s,!v||!B)return new k(NaN);if(v!=B)return C.s=-B,g.minus(C);var l=g.e/ke,d=C.e/ke,m=g.c,w=C.c;if(!l||!d){if(!m||!w)return new k(v/0);if(!m[0]||!w[0])return w[0]?C:new k(m[0]?g:v*0)}if(l=oi(l),d=oi(d),m=m.slice(),v=l-d){for(v>0?(d=l,x=w):(v=-v,x=m),x.reverse();v--;x.push(0));x.reverse()}for(v=m.length,B=w.length,v-B<0&&(x=w,w=m,m=x,B=v),v=0;B;)v=(m[--B]=m[B]+w[B]+v)/Wi|0,m[B]=Wi===m[B]?0:m[B]%Wi;return v&&(m=[v].concat(m),++d),F(C,m,d)},i.precision=i.sd=function(C,B){var x,g,v,l=this;if(C!=null&&C!==!!C)return fr(C,1,qr),B==null?B=c:fr(B,0,8),V(new k(l),C,B);if(!(x=l.c))return null;if(v=x.length-1,g=v*ke+1,v=x[v]){for(;v%10==0;v/=10,g--);for(v=x[0];v>=10;v/=10,g++);}return C&&l.e+1>g&&(g=l.e+1),g},i.shiftedBy=function(C){return fr(C,-_A,_A),this.times("1e"+C)},i.squareRoot=i.sqrt=function(){var C,B,x,g,v,l=this,d=l.c,m=l.s,w=l.e,_=o+4,A=new k("0.5");if(m!==1||!d||!d[0])return new k(!m||m<0&&(!d||d[0])?NaN:d?l:1/0);if(m=Math.sqrt(+q(l)),m==0||m==1/0?(B=ii(d),(B.length+w)%2==0&&(B+="0"),m=Math.sqrt(+B),w=oi((w+1)/2)-(w<0||w%2),m==1/0?B="5e"+w:(B=m.toExponential(),B=B.slice(0,B.indexOf("e")+1)+w),x=new k(B)):x=new k(m+""),x.c[0]){for(w=x.e,m=w+_,m<3&&(m=0);;)if(v=x,x=A.times(v.plus(e(l,v,_,1))),ii(v.c).slice(0,m)===(B=ii(x.c)).slice(0,m))if(x.e0&&M>0){for(l=M%m||m,A=E.substr(0,l);l0&&(A+=_+E.slice(l)),T&&(A="-"+A)}g=y?A+(x.decimalSeparator||"")+((w=+x.fractionGroupSize)?y.replace(new RegExp("\\d{"+w+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):y):A}return(x.prefix||"")+g+(x.suffix||"")},i.toFraction=function(C){var B,x,g,v,l,d,m,w,_,A,y,T,E=this,M=E.c;if(C!=null&&(m=new k(C),!m.isInteger()&&(m.c||m.s!==1)||m.lt(s)))throw Error(xn+"Argument "+(m.isInteger()?"out of range: ":"not an integer: ")+q(m));if(!M)return new k(E);for(B=new k(s),_=x=new k(s),g=w=new k(s),T=ii(M),l=B.e=T.length-E.e-1,B.c[0]=TA[(d=l%ke)<0?ke+d:d],C=!C||m.comparedTo(B)>0?l>0?B:_:m,d=p,p=1/0,m=new k(T),w.c[0]=0;A=e(m,B,0,1),v=x.plus(A.times(g)),v.comparedTo(C)!=1;)x=g,g=v,_=w.plus(A.times(v=_)),w=v,B=m.minus(A.times(v=B)),m=v;return v=e(C.minus(x),g,0,1),w=w.plus(v.times(_)),x=x.plus(v.times(g)),w.s=_.s=E.s,l=l*2,y=e(_,g,l,c).minus(E).abs().comparedTo(e(w,x,l,c).minus(E).abs())<1?[_,g]:[w,x],p=d,y},i.toNumber=function(){return+q(this)},i.toPrecision=function(C,B){return C!=null&&fr(C,1,qr),z(this,C,B,2)},i.toString=function(C){var B,x=this,g=x.s,v=x.e;return v===null?g?(B="Infinity",g<0&&(B="-"+B)):B="NaN":(C==null?B=v<=a||v>=u?Up(ii(x.c),v):So(ii(x.c),v,"0"):C===10&&U?(x=V(new k(x),o+v+1,c),B=So(ii(x.c),x.e,"0")):(fr(C,2,D.length,"Base"),B=r(So(ii(x.c),v,"0"),10,C,g,!0)),g<0&&x.c[0]&&(B="-"+B)),B},i.valueOf=i.toJSON=function(){return q(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&k.set(t),k}function oi(t){var e=t|0;return t>0||t===e?e:e-1}function ii(t){for(var e,r,n=1,i=t.length,s=t[0]+"";nu^r?1:-1;for(c=(a=i.length)<(u=s.length)?a:u,o=0;os[o]^r?1:-1;return a==u?0:a>u^r?1:-1}function fr(t,e,r,n){if(tr||t!==si(t))throw Error(xn+(n||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function qp(t){var e=t.c.length-1;return oi(t.e/ke)==e&&t.c[e]%2!=0}function Up(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function So(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e{h();wW=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,SA=Math.ceil,si=Math.floor,xn="[BigNumber Error] ",UC=xn+"Number primitive has more than 15 significant digits: ",Wi=1e14,ke=14,_A=9007199254740991,TA=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ta=1e7,qr=1e9;VC=kC(),Vu=VC});var Ve=L(ue=>{"use strict";h();Object.defineProperty(ue,"__esModule",{value:!0});ue.ErrSmartContractQuery=ue.ErrParseTransactionOutcome=ue.ErrInvalidInnerTransaction=ue.ErrBadUsage=ue.ErrInvalidTokenIdentifier=ue.ErrIsCompletedFieldIsMissingOnTransaction=ue.ErrGasLimitShouldBe0ForInnerTransaction=ue.ErrInvalidRelayedV2BuilderArguments=ue.ErrInvalidRelayedV1BuilderArguments=ue.ErrNotImplemented=ue.ErrContractInteraction=ue.ErrCodec=ue.ErrCannotParseTransactionOutcome=ue.ErrCannotParseContractResults=ue.ErrMissingFieldOnEnum=ue.ErrMissingFieldOnStruct=ue.ErrTypingSystem=ue.ErrMock=ue.ErrContractHasNoAddress=ue.ErrContract=ue.ErrExpectedTransactionEventsNotFound=ue.ErrExpectedTransactionStatusNotReached=ue.ErrTransactionWatcherTimeout=ue.ErrAsyncTimerAborted=ue.ErrAsyncTimerAlreadyRunning=ue.ErrInvalidFunctionName=ue.ErrSignatureCannotCreate=ue.ErrTransactionOptionsInvalid=ue.ErrTransactionVersionInvalid=ue.ErrNonceInvalid=ue.ErrNotEnoughGas=ue.ErrAddressEmpty=ue.ErrAddressBadHrp=ue.ErrAddressCannotCreate=ue.ErrUnexpectedCondition=ue.ErrInvariantFailed=ue.ErrBadType=ue.ErrUnsupportedOperation=ue.ErrInvalidArgument=ue.Err=void 0;var Qe=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};ue.Err=Qe;var IA=class extends Qe{constructor(e,r){super(`Invalid argument: ${e}`,r)}};ue.ErrInvalidArgument=IA;var CA=class extends Qe{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};ue.ErrUnsupportedOperation=CA;var xA=class extends Qe{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};ue.ErrBadType=xA;var NA=class extends Qe{constructor(e){super(`Invariant failed: [${e}]`)}};ue.ErrInvariantFailed=NA;var OA=class extends Qe{constructor(e){super(`Unexpected condition: [${e}]`)}};ue.ErrUnexpectedCondition=OA;var PA=class extends Qe{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};ue.ErrAddressCannotCreate=PA;var RA=class extends Qe{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};ue.ErrAddressBadHrp=RA;var MA=class extends Qe{constructor(){super("Address is empty")}};ue.ErrAddressEmpty=MA;var DA=class extends Qe{constructor(e){super(`Not enough gas provided: ${e}`)}};ue.ErrNotEnoughGas=DA;var BA=class extends Qe{constructor(e){super(`Invalid nonce: ${e}`)}};ue.ErrNonceInvalid=BA;var LA=class extends Qe{constructor(e){super(`Invalid transaction version: ${e}`)}};ue.ErrTransactionVersionInvalid=LA;var FA=class extends Qe{constructor(e){super(`Invalid transaction options: ${e}`)}};ue.ErrTransactionOptionsInvalid=FA;var qA=class extends Qe{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};ue.ErrSignatureCannotCreate=qA;var UA=class extends Qe{constructor(){super("Invalid function name")}};ue.ErrInvalidFunctionName=UA;var kA=class extends Qe{constructor(){super("Async timer already running")}};ue.ErrAsyncTimerAlreadyRunning=kA;var VA=class extends Qe{constructor(){super("Async timer aborted")}};ue.ErrAsyncTimerAborted=VA;var HA=class extends Qe{constructor(){super("TransactionWatcher has timed out")}};ue.ErrTransactionWatcherTimeout=HA;var GA=class extends Qe{constructor(){super("Expected transaction status not reached")}};ue.ErrExpectedTransactionStatusNotReached=GA;var zA=class extends Qe{constructor(){super("Expected transaction events not found")}};ue.ErrExpectedTransactionEventsNotFound=zA;var kp=class extends Qe{constructor(e){super(e)}};ue.ErrContract=kp;var jA=class extends kp{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). -`)}};ce.ErrContractHasNoAddress=tv;var rv=class extends Te{constructor(e){super(e)}};ce.ErrMock=rv;var nv=class extends Te{constructor(e){super(e)}};ce.ErrTypingSystem=nv;var iv=class extends Te{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};ce.ErrMissingFieldOnStruct=iv;var sv=class extends Te{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};ce.ErrMissingFieldOnEnum=sv;var ov=class extends Te{constructor(e){super(`cannot parse contract results: ${e}`)}};ce.ErrCannotParseContractResults=ov;var av=class extends Te{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};ce.ErrCannotParseTransactionOutcome=av;var uv=class extends Te{constructor(e){super(e)}};ce.ErrCodec=uv;var cv=class extends Te{constructor(e){super(e)}};ce.ErrContractInteraction=cv;var lv=class extends Te{constructor(){super("Method not yet implemented")}};ce.ErrNotImplemented=lv;var fv=class extends Te{constructor(){super("invalid arguments for relayed v1 builder")}};ce.ErrInvalidRelayedV1BuilderArguments=fv;var hv=class extends Te{constructor(){super("invalid arguments for relayed v2 builder")}};ce.ErrInvalidRelayedV2BuilderArguments=hv;var dv=class extends Te{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ce.ErrGasLimitShouldBe0ForInnerTransaction=dv;var gv=class extends Te{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};ce.ErrIsCompletedFieldIsMissingOnTransaction=gv;var pv=class extends Te{constructor(e){super(e)}};ce.ErrInvalidTokenIdentifier=pv;var mv=class extends Te{constructor(e){super(e)}};ce.ErrBadUsage=mv;var yv=class extends Te{constructor(e){super(e)}};ce.ErrInvalidInnerTransaction=yv;var wv=class extends Te{constructor(e){super(e)}};ce.ErrParseTransactionOutcome=wv;var vv=class extends Te{constructor(e,r){super(r),this.returnCode=e}};ce.ErrSmartContractQuery=vv});var Ia=D(On=>{"use strict";h();var dH=On&&On.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(On,"__esModule",{value:!0});On.TokenPayment=On.TokenComputer=On.TokenTransfer=On.Token=void 0;var Sa=dH((nr(),xe(hr))),xu=Ie(),G3="EGLD",j3=18;Sa.default.set({ROUNDING_MODE:1});var Vd=class{constructor(e){this.identifier=e.identifier,this.nonce=e.nonce||0n}};On.Token=Vd;var kd=class t{constructor(e){if(this.isLegacyTokenTransferOptions(e)){let r=new Sa.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new xu.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0,this.token=new Vd({identifier:e.tokenIdentifier,nonce:BigInt(e.nonce)}),this.amount=BigInt(this.amountAsBigInteger.toFixed(0))}else this.token=e.token,this.amount=e.amount,this.tokenIdentifier=e.token.identifier,this.nonce=Number(e.token.nonce),this.amountAsBigInteger=new Sa.default(this.amount.toString()),this.numDecimals=0}isLegacyTokenTransferOptions(e){return e.tokenIdentifier!==void 0}static egldFromAmount(e){let r=new Sa.default(e).shiftedBy(j3).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:G3,nonce:0,amountAsBigInteger:e,numDecimals:j3})}static fungibleFromAmount(e,r,n){let i=new Sa.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Sa.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amount.toString()}valueOf(){return new Sa.default(this.amount.toString())}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.token.identifier==G3}isFungible(){return this.token.nonce==0n}};On.TokenTransfer=kd;var Av=class{constructor(){}isFungible(e){return e.nonce===0n}extractNonceFromExtendedIdentifier(e){let r=e.split("-");if(this.checkIfExtendedIdentifierWasProvided(r),this.checkLengthOfRandomSequence(r[1]),r.length==2)return 0;let n=p.Buffer.from(r[2],"hex");return gH(n)}extractIdentifierFromExtendedIdentifier(e){let r=e.split("-");return this.checkIfExtendedIdentifierWasProvided(r),this.ensureTokenTickerValidity(r[0]),this.checkLengthOfRandomSequence(r[1]),r[0]+"-"+r[1]}checkIfExtendedIdentifierWasProvided(e){if(e.length<2||e.length>3)throw new xu.ErrInvalidTokenIdentifier("Invalid extended token identifier provided")}checkLengthOfRandomSequence(e){if(e.length!==6)throw new xu.ErrInvalidTokenIdentifier("The identifier is not valid. The random sequence does not have the right length")}ensureTokenTickerValidity(e){if(e.length<3||e.length>10)throw new xu.ErrInvalidTokenIdentifier("The token ticker should be between 3 and 10 characters");if(!e.match(/^[a-zA-Z0-9]+$/))throw new xu.ErrInvalidTokenIdentifier("The token ticker should only contain alphanumeric characters");if(e!=e.toUpperCase())throw new xu.ErrInvalidTokenIdentifier("The token ticker should be upper case")}};On.TokenComputer=Av;function gH(t){return t.readUIntBE(0,t.length)}var Ev=class extends kd{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};On.TokenPayment=Ev});var yr=D(me=>{"use strict";h();Object.defineProperty(me,"__esModule",{value:!0});me.ESDT_CONTRACT_ADDRESS=me.DELEGATION_MANAGER_SC_ADDRESS=me.CONTRACT_DEPLOY_ADDRESS=me.BECH32_ADDRESS_LENGTH=me.DEFAULT_HRP=me.UNKNOWN_SIGNER=me.SDK_JS_SIGNER=me.METACHAIN_ID=me.WasmVirtualMachine=me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=me.HEX_TRANSACTION_HASH_LENGTH=me.MESSAGE_PREFIX=me.DEFAULT_MESSAGE_VERSION=me.ESDT_CONTRACT_ADDRESS_HEX=me.DELEGATION_MANAGER_SC_ADDRESS_HEX=me.CONTRACT_DEPLOY_ADDRESS_HEX=me.VM_TYPE_WASM_VM=me.ARGUMENTS_SEPARATOR=me.ESDT_TRANSFER_VALUE=me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_GAS_LIMIT=me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=me.TRANSACTION_VERSION_DEFAULT=me.TRANSACTION_OPTIONS_TX_GUARDED=me.TRANSACTION_OPTIONS_TX_HASH_SIGN=me.TRANSACTION_OPTIONS_DEFAULT=me.TRANSACTION_MIN_GAS_PRICE=void 0;me.TRANSACTION_MIN_GAS_PRICE=1e9;me.TRANSACTION_OPTIONS_DEFAULT=0;me.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;me.TRANSACTION_OPTIONS_TX_GUARDED=2;me.TRANSACTION_VERSION_DEFAULT=2;me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=2;me.ESDT_TRANSFER_GAS_LIMIT=5e5;me.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";me.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";me.ESDT_TRANSFER_VALUE="0";me.ARGUMENTS_SEPARATOR="@";me.VM_TYPE_WASM_VM=new Uint8Array([5,0]);me.CONTRACT_DEPLOY_ADDRESS_HEX="0000000000000000000000000000000000000000000000000000000000000000";me.DELEGATION_MANAGER_SC_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000004ffff";me.ESDT_CONTRACT_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000002ffff";me.DEFAULT_MESSAGE_VERSION=1;me.MESSAGE_PREFIX=`Elrond Signed Message: -`;me.HEX_TRANSACTION_HASH_LENGTH=64;me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=3;me.WasmVirtualMachine="0500";me.METACHAIN_ID=4294967295;me.SDK_JS_SIGNER="sdk-js";me.UNKNOWN_SIGNER="unknown";me.DEFAULT_HRP="erd";me.BECH32_ADDRESS_LENGTH=62;me.CONTRACT_DEPLOY_ADDRESS="erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu";me.DELEGATION_MANAGER_SC_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqylllslmq6y6";me.ESDT_CONTRACT_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"});var so=D(Ta=>{"use strict";h();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.Logger=Ta.LogLevel=void 0;var _a;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(_a=Ta.LogLevel||(Ta.LogLevel={}));var Hd=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=_a.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=_a.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=_a.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=_a.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=_a.Error||console.error(e,r)}};Ta.Logger=Hd;Hd.logLevel=_a.Debug});var Jl=D(Dn=>{"use strict";h();var pH=Dn&&Dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mH=Dn&&Dn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yH=Dn&&Dn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pH(e,t,r);return mH(e,t),e};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.TransactionOptions=Dn.TransactionVersion=void 0;var yi=yr(),z3=yH(Ie()),bv=class t{constructor(e){if(e=Number(e),e<1)throw new z3.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(yi.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(yi.TRANSACTION_VERSION_DEFAULT)}valueOf(){return this.value}};Dn.TransactionVersion=bv;var Sv=class t{constructor(e){if(e=Number(e),e<0)throw new z3.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(yi.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=yi.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=yi.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&yi.TRANSACTION_OPTIONS_TX_HASH_SIGN)==yi.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&yi.TRANSACTION_OPTIONS_TX_GUARDED)==yi.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=yi.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=yi.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dn.TransactionOptions=Sv});var _v=D((Lpe,W3)=>{"use strict";h();var jd="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Iv={};for(Xl=0;Xl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Q3(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Ou(e)^n>>5}for(e=Ou(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=Q3(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Ou(n)^o,i+=jd.charAt(o)}for(s=0;s<6;++s)n=Ou(n);for(n^=1,s=0;s<6;++s){var u=n>>(5-s)*5&31;i+=jd.charAt(u)}return i}function K3(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var u=Q3(s);if(typeof u=="string")return u;for(var a=[],c=0;c=o.length)&&a.push(d)}return u!==1?"Invalid checksum for "+t:{prefix:s,words:a}}function vH(){var t=K3.apply(null,arguments);if(typeof t=="object")return t}function AH(t){var e=K3.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zd(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,u.push(i>>s&o);if(n)s>0&&u.push(i<=e)return"Excess padding";if(i<{"use strict";h();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.LibraryConfig=void 0;var Qd=class{};Kd.LibraryConfig=Qd;Qd.DefaultAddressHrp="erd"});var Du=D(Dt=>{"use strict";h();var _H=Dt&&Dt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TH=Dt&&Dt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CH=Dt&&Dt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_H(e,t,r);return TH(e,t),e},NH=Dt&&Dt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.addressToHex=Dt.bigIntToHex=Dt.byteArrayToHex=Dt.boolToHex=Dt.utf8ToHex=Dt.zeroPadStringIfOddLength=Dt.isPaddedHex=Dt.numberToPaddedHex=void 0;var xH=NH((nr(),xe(hr))),OH=ke(),DH=CH(Pu());function PH(t){let e;typeof t=="bigint"||typeof t=="number"?e=t:e=new xH.default(t);let r=e.toString(16);return $d(r)}Dt.numberToPaddedHex=PH;function RH(t){t=t||"";let e=p.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Dt.isPaddedHex=RH;function $d(t){return t=t||"",t.length%2==1?"0"+t:t}Dt.zeroPadStringIfOddLength=$d;function $3(t){let e=p.Buffer.from(t).toString("hex");return $d(e)}Dt.utf8ToHex=$3;function BH(t){return $3(t.toString())}Dt.boolToHex=BH;function MH(t){let e=p.Buffer.from(t).toString("hex");return $d(e)}Dt.byteArrayToHex=MH;function LH(t){return t==0?"":DH.getHexMagnitudeOfBigInt(t)}Dt.bigIntToHex=LH;function FH(t){return OH.Address.fromBech32(t.toString()).pubkey().toString("hex")}Dt.addressToHex=FH});var Pu=D(ir=>{"use strict";h();var UH=ir&&ir.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ir,"__esModule",{value:!0});ir.prependByteToBuffer=ir.flipBufferBitsInPlace=ir.getHexMagnitudeOfBigInt=ir.bigIntToBuffer=ir.bufferToBigInt=ir.cloneBuffer=ir.isMsbZero=ir.isMsbOne=void 0;var Tv=UH((nr(),xe(hr))),qH=Du();function Y3(t,e=0){return t[e]>>7==1}ir.isMsbOne=Y3;function VH(t,e=0){return!Y3(t,e)}ir.isMsbZero=VH;function kH(t){let e=p.Buffer.alloc(t.length);return t.copy(e),e}ir.cloneBuffer=kH;function HH(t){let e=t.toString("hex");return new Tv.default(`0x${e}`,16)}ir.bufferToBigInt=HH;function GH(t){let e=J3(t);return p.Buffer.from(e,"hex")}ir.bigIntToBuffer=GH;function J3(t){return t=new Tv.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Tv.default(-1))),qH.numberToPaddedHex(t)):""}ir.getHexMagnitudeOfBigInt=J3;function jH(t){for(let e=0;e{"use strict";h();var QH=Lt&&Lt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KH=Lt&&Lt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X3=Lt&&Lt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QH(e,t,r);return KH(e,t),e},WH=Lt&&Lt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.bufferToHex=Lt.addressToHex=Lt.bigIntToHex=Lt.utf8ToHex=Lt.bigIntToBuffer=Lt.bufferToBigInt=Lt.stringToBuffer=void 0;var $H=WH((nr(),xe(hr))),Z3=X3(Pu()),YH=X3(Du());function JH(t){return p.Buffer.from(t)}Lt.stringToBuffer=JH;function XH(t){return t.length==0?new $H.default(0):Z3.bufferToBigInt(t)}Lt.bufferToBigInt=XH;function ZH(t){return t==0?p.Buffer.from([]):Z3.bigIntToBuffer(t)}Lt.bigIntToBuffer=ZH;var Cv=Du();Object.defineProperty(Lt,"utf8ToHex",{enumerable:!0,get:function(){return Cv.utf8ToHex}});Object.defineProperty(Lt,"bigIntToHex",{enumerable:!0,get:function(){return Cv.bigIntToHex}});Object.defineProperty(Lt,"addressToHex",{enumerable:!0,get:function(){return Cv.addressToHex}});function eG(t){let e=t.toString("hex");return YH.zeroPadStringIfOddLength(e)}Lt.bufferToHex=eG});var Os=D((Qpe,Nv)=>{"use strict";h();var Ru=typeof Reflect=="object"?Reflect:null,eN=Ru&&typeof Ru.apply=="function"?Ru.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jd;Ru&&typeof Ru.ownKeys=="function"?Jd=Ru.ownKeys:Object.getOwnPropertySymbols?Jd=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jd=function(e){return Object.getOwnPropertyNames(e)};function tG(t){console&&console.warn&&console.warn(t)}var rN=Number.isNaN||function(e){return e!==e};function Ct(){Ct.init.call(this)}Nv.exports=Ct;Nv.exports.once=sG;Ct.EventEmitter=Ct;Ct.prototype._events=void 0;Ct.prototype._eventsCount=0;Ct.prototype._maxListeners=void 0;var tN=10;function Xd(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ct,"defaultMaxListeners",{enumerable:!0,get:function(){return tN},set:function(t){if(typeof t!="number"||t<0||rN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");tN=t}});Ct.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};Ct.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||rN(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 nN(t){return t._maxListeners===void 0?Ct.defaultMaxListeners:t._maxListeners}Ct.prototype.getMaxListeners=function(){return nN(this)};Ct.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var a=s[e];if(a===void 0)return!1;if(typeof a=="function")eN(a,this,r);else for(var c=a.length,f=uN(a,c),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,tG(u)}return t}Ct.prototype.addListener=function(e,r){return iN(this,e,r,!1)};Ct.prototype.on=Ct.prototype.addListener;Ct.prototype.prependListener=function(e,r){return iN(this,e,r,!0)};function rG(){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 sN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=rG.bind(n);return i.listener=r,n.wrapFn=i,i}Ct.prototype.once=function(e,r){return Xd(r),this.on(e,sN(this,e,r)),this};Ct.prototype.prependOnceListener=function(e,r){return Xd(r),this.prependListener(e,sN(this,e,r)),this};Ct.prototype.removeListener=function(e,r){var n,i,s,o,u;if(Xd(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){u=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():nG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||r)}return this};Ct.prototype.off=Ct.prototype.removeListener;Ct.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function oN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?iG(i):uN(i,i.length)}Ct.prototype.listeners=function(e){return oN(this,e,!0)};Ct.prototype.rawListeners=function(e){return oN(this,e,!1)};Ct.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):aN.call(t,e)};Ct.prototype.listenerCount=aN;function aN(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ct.prototype.eventNames=function(){return this._eventsCount>0?Jd(this._events):[]};function uN(t,e){for(var r=new Array(e),n=0;n{h();lN.exports=Os().EventEmitter});var Ov=D(()=>{h()});var mN=D((Zpe,pN)=>{"use strict";h();function fN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function hN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return Zd.alloc(0);for(var n=Zd.allocUnsafe(r>>>0),i=this.head,s=0;i;)gG(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(u===o.length?s+=o:s+=o.slice(0,r),r-=u,r===0){u===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(u));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=Zd.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,u=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,u),r-=u,r===0){u===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(u));break}++s}return this.length-=s,n}},{key:dG,value:function(r,n){return Dv(this,hN(hN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var Rv=D((t0e,wN)=>{"use strict";h();function pG(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,S.default.nextTick(Pv,this,t)):S.default.nextTick(Pv,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?S.default.nextTick(eg,r):(r._writableState.errorEmitted=!0,S.default.nextTick(yN,r,s)):S.default.nextTick(yN,r,s):e?(S.default.nextTick(eg,r),e(s)):S.default.nextTick(eg,r)}),this)}function yN(t,e){Pv(t,e),eg(t)}function eg(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function mG(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Pv(t,e){t.emit("error",e)}function yG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}wN.exports={destroy:pG,undestroy:mG,errorOrDestroy:yG}});var Ca=D((n0e,EN)=>{"use strict";h();function wG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var AN={};function Pn(t,e,r){r||(r=Error);function n(s,o,u){return typeof e=="string"?e:e(s,o,u)}var i=function(s){wG(o,s);function o(u,a,c){return s.call(this,n(u,a,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,AN[t]=i}function vN(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function vG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function AG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function EG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Pn("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Pn("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&vG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(AG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(vN(e,"type"));else{var s=EG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(vN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Pn("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Pn("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Pn("ERR_STREAM_PREMATURE_CLOSE","Premature close");Pn("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Pn("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Pn("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Pn("ERR_STREAM_WRITE_AFTER_END","write after end");Pn("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Pn("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Pn("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");EN.exports.codes=AN});var Bv=D((s0e,bN)=>{"use strict";h();var bG=Ca().codes.ERR_INVALID_OPT_VALUE;function SG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function IG(t,e,r,n){var i=SG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new bG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}bN.exports={getHighWaterMark:IG}});var Bu=D((a0e,Mv)=>{h();typeof Object.create=="function"?Mv.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mv.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var IN=D((c0e,SN)=>{h();SN.exports=_G;function _G(t,e){if(Lv("noDeprecation"))return t;var r=!1;function n(){if(!r){if(Lv("throwDeprecation"))throw new Error(e);Lv("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function Lv(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var qv=D((f0e,ON)=>{"use strict";h();ON.exports=Gt;function TN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){XG(e,t)}}var Mu;Gt.WritableState=ef;var TG={deprecate:IN()},CN=xv(),rg=no().Buffer,CG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function NG(t){return rg.from(t)}function xG(t){return rg.isBuffer(t)||t instanceof CG}var Uv=Rv(),OG=Bv(),DG=OG.getHighWaterMark,oo=Ca().codes,PG=oo.ERR_INVALID_ARG_TYPE,RG=oo.ERR_METHOD_NOT_IMPLEMENTED,BG=oo.ERR_MULTIPLE_CALLBACK,MG=oo.ERR_STREAM_CANNOT_PIPE,LG=oo.ERR_STREAM_DESTROYED,FG=oo.ERR_STREAM_NULL_VALUES,UG=oo.ERR_STREAM_WRITE_AFTER_END,qG=oo.ERR_UNKNOWN_ENCODING,Lu=Uv.errorOrDestroy;Bu()(Gt,CN);function VG(){}function ef(t,e,r){Mu=Mu||Na(),t=t||{},typeof r!="boolean"&&(r=e instanceof Mu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=DG(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){KG(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new TN(this)}ef.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(ef.prototype,"buffer",{get:TG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var tg;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(tg=Function.prototype[Symbol.hasInstance],Object.defineProperty(Gt,Symbol.hasInstance,{value:function(e){return tg.call(this,e)?!0:this!==Gt?!1:e&&e._writableState instanceof ef}})):tg=function(e){return e instanceof this};function Gt(t){Mu=Mu||Na();var e=this instanceof Mu;if(!e&&!tg.call(Gt,this))return new Gt(t);this._writableState=new ef(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),CN.call(this)}Gt.prototype.pipe=function(){Lu(this,new MG)};function kG(t,e){var r=new UG;Lu(t,r),S.default.nextTick(e,r)}function HG(t,e,r,n){var i;return r===null?i=new FG:typeof r!="string"&&!e.objectMode&&(i=new PG("chunk",["string","Buffer"],r)),i?(Lu(t,i),S.default.nextTick(n,i),!1):!0}Gt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&xG(t);return s&&!rg.isBuffer(t)&&(t=NG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=VG),n.ending?kG(this,r):(s||HG(this,n,t,r))&&(n.pendingcb++,i=jG(this,n,s,t,e,r)),i};Gt.prototype.cork=function(){this._writableState.corked++};Gt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&NN(this,t))};Gt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new qG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function GG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=rg.from(e,r)),e}Object.defineProperty(Gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function jG(t,e,r,n,i,s){if(!r){var o=GG(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var u=e.objectMode?1:n.length;e.length+=u;var a=e.length{"use strict";h();var ZG=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};PN.exports=Vi;var DN=Hv(),kv=qv();Bu()(Vi,DN);for(Vv=ZG(kv.prototype),ng=0;ng{h();var sg=no(),ki=sg.Buffer;function RN(t,e){for(var r in t)e[r]=t[r]}ki.from&&ki.alloc&&ki.allocUnsafe&&ki.allocUnsafeSlow?BN.exports=sg:(RN(sg,Gv),Gv.Buffer=xa);function xa(t,e,r){return ki(t,e,r)}xa.prototype=Object.create(ki.prototype);RN(ki,xa);xa.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ki(t,e,r)};xa.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ki(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};xa.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ki(t)};xa.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return sg.SlowBuffer(t)}});var Qv=D(FN=>{"use strict";h();var zv=MN().Buffer,LN=zv.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function rj(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function nj(t){var e=rj(t);if(typeof e!="string"&&(zv.isEncoding===LN||!LN(t)))throw new Error("Unknown encoding: "+t);return e||t}FN.StringDecoder=tf;function tf(t){this.encoding=nj(t);var e;switch(this.encoding){case"utf16le":this.text=cj,this.end=lj,e=4;break;case"utf8":this.fillLast=oj,e=4;break;case"base64":this.text=fj,this.end=hj,e=3;break;default:this.write=dj,this.end=gj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=zv.allocUnsafe(e)}tf.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function ij(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function sj(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function oj(t){var e=this.lastTotal-this.lastNeed,r=sj(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function aj(t,e){var r=ij(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function uj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function cj(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function lj(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function fj(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function hj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function dj(t){return t.toString(this.encoding)}function gj(t){return t&&t.length?this.write(t):""}});var og=D((w0e,VN)=>{"use strict";h();var UN=Ca().codes.ERR_STREAM_PREMATURE_CLOSE;function pj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";h();var ag;function ao(t,e,r){return e=wj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wj(t){var e=vj(t,"string");return typeof e=="symbol"?e:String(e)}function vj(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Aj=og(),uo=Symbol("lastResolve"),Oa=Symbol("lastReject"),rf=Symbol("error"),ug=Symbol("ended"),Da=Symbol("lastPromise"),Kv=Symbol("handlePromise"),Pa=Symbol("stream");function co(t,e){return{value:t,done:e}}function Ej(t){var e=t[uo];if(e!==null){var r=t[Pa].read();r!==null&&(t[Da]=null,t[uo]=null,t[Oa]=null,e(co(r,!1)))}}function bj(t){S.default.nextTick(Ej,t)}function Sj(t,e){return function(r,n){t.then(function(){if(e[ug]){r(co(void 0,!0));return}e[Kv](r,n)},n)}}var Ij=Object.getPrototypeOf(function(){}),_j=Object.setPrototypeOf((ag={get stream(){return this[Pa]},next:function(){var e=this,r=this[rf];if(r!==null)return Promise.reject(r);if(this[ug])return Promise.resolve(co(void 0,!0));if(this[Pa].destroyed)return new Promise(function(o,u){S.default.nextTick(function(){e[rf]?u(e[rf]):o(co(void 0,!0))})});var n=this[Da],i;if(n)i=new Promise(Sj(n,this));else{var s=this[Pa].read();if(s!==null)return Promise.resolve(co(s,!1));i=new Promise(this[Kv])}return this[Da]=i,i}},ao(ag,Symbol.asyncIterator,function(){return this}),ao(ag,"return",function(){var e=this;return new Promise(function(r,n){e[Pa].destroy(null,function(i){if(i){n(i);return}r(co(void 0,!0))})})}),ag),Ij),Tj=function(e){var r,n=Object.create(_j,(r={},ao(r,Pa,{value:e,writable:!0}),ao(r,uo,{value:null,writable:!0}),ao(r,Oa,{value:null,writable:!0}),ao(r,rf,{value:null,writable:!0}),ao(r,ug,{value:e._readableState.endEmitted,writable:!0}),ao(r,Kv,{value:function(s,o){var u=n[Pa].read();u?(n[Da]=null,n[uo]=null,n[Oa]=null,s(co(u,!1))):(n[uo]=s,n[Oa]=o)},writable:!0}),r));return n[Da]=null,Aj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Oa];s!==null&&(n[Da]=null,n[uo]=null,n[Oa]=null,s(i)),n[rf]=i;return}var o=n[uo];o!==null&&(n[Da]=null,n[uo]=null,n[Oa]=null,o(co(void 0,!0))),n[ug]=!0}),e.on("readable",bj.bind(null,n)),n};kN.exports=Tj});var jN=D((b0e,GN)=>{h();GN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Hv=D((_0e,ex)=>{"use strict";h();ex.exports=Fe;var Fu;Fe.ReadableState=WN;var I0e=Os().EventEmitter,KN=function(e,r){return e.listeners(r).length},sf=xv(),cg=no().Buffer,Cj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Nj(t){return cg.from(t)}function xj(t){return cg.isBuffer(t)||t instanceof Cj}var Wv=Ov(),Ce;Wv&&Wv.debuglog?Ce=Wv.debuglog("stream"):Ce=function(){};var Oj=mN(),tA=Rv(),Dj=Bv(),Pj=Dj.getHighWaterMark,lg=Ca().codes,Rj=lg.ERR_INVALID_ARG_TYPE,Bj=lg.ERR_STREAM_PUSH_AFTER_EOF,Mj=lg.ERR_METHOD_NOT_IMPLEMENTED,Lj=lg.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Uu,$v,Yv;Bu()(Fe,sf);var nf=tA.errorOrDestroy,Jv=["error","close","destroy","pause","resume"];function Fj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function WN(t,e,r){Fu=Fu||Na(),t=t||{},typeof r!="boolean"&&(r=e instanceof Fu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Pj(this,t,"readableHighWaterMark",r),this.buffer=new Oj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Uu||(Uu=Qv().StringDecoder),this.decoder=new Uu(t.encoding),this.encoding=t.encoding)}function Fe(t){if(Fu=Fu||Na(),!(this instanceof Fe))return new Fe(t);var e=this instanceof Fu;this._readableState=new WN(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),sf.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=tA.destroy;Fe.prototype._undestroy=tA.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=cg.from(t,e),e=""),n=!0),$N(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return $N(this,t,null,!0,!1)};function $N(t,e,r,n,i){Ce("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Vj(t,s);else{var o;if(i||(o=Uj(s,e)),o)nf(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==cg.prototype&&(e=Nj(e)),n)s.endEmitted?nf(t,new Lj):Xv(t,s,e,!0);else if(s.ended)nf(t,new Bj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?Xv(t,s,e,!1):eA(t,s)):Xv(t,s,e,!1)}else n||(s.reading=!1,eA(t,s))}return!s.ended&&(s.length=zN?t=zN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function QN(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=qj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){Ce("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Ce("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Zv(this):fg(this),null;if(t=QN(t,e),t===0&&e.ended)return e.length===0&&Zv(this),null;var n=e.needReadable;Ce("need readable",n),(e.length===0||e.length-t0?i=XN(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Zv(this)),i!==null&&this.emit("data",i),i};function Vj(t,e){if(Ce("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?fg(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,YN(t)))}}function fg(t){var e=t._readableState;Ce("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ce("emitReadable",e.flowing),e.emittedReadable=!0,S.default.nextTick(YN,t))}function YN(t){var e=t._readableState;Ce("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,rA(t)}function eA(t,e){e.readingMore||(e.readingMore=!0,S.default.nextTick(kj,t,e))}function kj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&ZN(n.pipes,t)!==-1)&&!c&&(Ce("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function w(P){Ce("onerror",P),N(),t.removeListener("error",w),KN(t,"error")===0&&nf(t,P)}Fj(t,"error",w);function A(){t.removeListener("finish",_),N()}t.once("close",A);function _(){Ce("onfinish"),t.removeListener("close",A),N()}t.once("finish",_);function N(){Ce("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ce("pipe resume"),r.resume()),t};function Hj(t){return function(){var r=t._readableState;Ce("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&KN(t,"data")&&(r.flowing=!0,rA(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Ce("on readable",n.length,n.reading),n.length?fg(this):n.reading||S.default.nextTick(Gj,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=sf.prototype.removeListener.call(this,t,e);return t==="readable"&&S.default.nextTick(JN,this),r};Fe.prototype.removeAllListeners=function(t){var e=sf.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&S.default.nextTick(JN,this),e};function JN(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function Gj(t){Ce("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ce("resume"),t.flowing=!t.readableListening,jj(this,t)),t.paused=!1,this};function jj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,S.default.nextTick(zj,t,e))}function zj(t,e){Ce("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),rA(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return Ce("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ce("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function rA(t){var e=t._readableState;for(Ce("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ce("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(Ce("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var u=e.push(o);u||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(u){return function(){return t[u].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Zv(t){var e=t._readableState;Ce("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,S.default.nextTick(Qj,e,t))}function Qj(t,e){if(Ce("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return Yv===void 0&&(Yv=jN()),Yv(Fe,t,e)});function ZN(t,e){for(var r=0,n=t.length;r{"use strict";h();rx.exports=Ds;var hg=Ca().codes,Kj=hg.ERR_METHOD_NOT_IMPLEMENTED,Wj=hg.ERR_MULTIPLE_CALLBACK,$j=hg.ERR_TRANSFORM_ALREADY_TRANSFORMING,Yj=hg.ERR_TRANSFORM_WITH_LENGTH_0,dg=Na();Bu()(Ds,dg);function Jj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Wj);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";h();ix.exports=of;var nx=nA();Bu()(of,nx);function of(t){if(!(this instanceof of))return new of(t);nx.call(this,t)}of.prototype._transform=function(t,e,r){r(null,t)}});var lx=D((D0e,cx)=>{"use strict";h();var iA;function Zj(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var ux=Ca().codes,ez=ux.ERR_MISSING_ARGS,tz=ux.ERR_STREAM_DESTROYED;function ox(t){if(t)throw t}function rz(t){return t.setHeader&&typeof t.abort=="function"}function nz(t,e,r,n){n=Zj(n);var i=!1;t.on("close",function(){i=!0}),iA===void 0&&(iA=og()),iA(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,rz(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new tz("pipe"))}}}function ax(t){t()}function iz(t,e){return t.pipe(e)}function sz(t){return!t.length||typeof t[t.length-1]!="function"?ox:t.pop()}function oz(){for(var t=arguments.length,e=new Array(t),r=0;r0;return nz(o,a,c,function(f){i||(i=f),f&&s.forEach(ax),!a&&(s.forEach(ax),n(i))})});return e.reduce(iz)}cx.exports=oz});var sA=D((Rn,fx)=>{h();Rn=fx.exports=Hv();Rn.Stream=Rn;Rn.Readable=Rn;Rn.Writable=qv();Rn.Duplex=Na();Rn.Transform=nA();Rn.PassThrough=sx();Rn.finished=og();Rn.pipeline=lx()});var gx=D((B0e,dx)=>{h();var{Transform:az}=sA();dx.exports=t=>class hx extends az{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!p.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return p.Buffer.isBuffer(r)||(r=p.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new hx(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var yx=D((L0e,mx)=>{h();var{Transform:uz}=sA();mx.exports=t=>class px extends uz{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!p.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return p.Buffer.isBuffer(r)||(r=p.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new px(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var vx=D((U0e,wx)=>{h();var cz=gx(),lz=yx();wx.exports=function(t){let e=cz(t),r=lz(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var bx=D(Ex=>{h();var Ax=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Ex.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],a=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],w=f^(i<<1|s>>>31),A=d^(s<<1|i>>>31),_=t[0]^w,N=t[1]^A,P=t[10]^w,V=t[11]^A,U=t[20]^w,Q=t[21]^A,L=t[30]^w,k=t[31]^A,H=t[40]^w,q=t[41]^A;w=r^(o<<1|u>>>31),A=n^(u<<1|o>>>31);let v=t[2]^w,C=t[3]^A,R=t[12]^w,F=t[13]^A,B=t[22]^w,l=t[23]^A,g=t[32]^w,y=t[33]^A,E=t[42]^w,I=t[43]^A;w=i^(a<<1|c>>>31),A=s^(c<<1|a>>>31);let T=t[4]^w,M=t[5]^A,x=t[14]^w,m=t[15]^A,O=t[24]^w,Y=t[25]^A,$=t[34]^w,b=t[35]^A,j=t[44]^w,z=t[45]^A;w=o^(f<<1|d>>>31),A=u^(d<<1|f>>>31);let W=t[6]^w,ie=t[7]^A,te=t[16]^w,ee=t[17]^A,se=t[26]^w,oe=t[27]^A,J=t[36]^w,ue=t[37]^A,vt=t[46]^w,At=t[47]^A;w=a^(r<<1|n>>>31),A=c^(n<<1|r>>>31);let Pi=t[8]^w,Et=t[9]^A,bt=t[18]^w,Ri=t[19]^A,St=t[28]^w,It=t[29]^A,Bi=t[38]^w,_t=t[39]^A,Tt=t[48]^w,Mi=t[49]^A,Ke=_,We=N,si=V<<4|P>>>28,$e=P<<4|V>>>28,Ye=U<<3|Q>>>29,oi=Q<<3|U>>>29,Je=k<<9|L>>>23,Xe=L<<9|k>>>23,ai=H<<18|q>>>14,Ze=q<<18|H>>>14,et=v<<1|C>>>31,ui=C<<1|v>>>31,tt=F<<12|R>>>20,rt=R<<12|F>>>20,ci=B<<10|l>>>22,nt=l<<10|B>>>22,it=y<<13|g>>>19,li=g<<13|y>>>19,st=E<<2|I>>>30,ot=I<<2|E>>>30,fi=M<<30|T>>>2,at=T<<30|M>>>2,ut=x<<6|m>>>26,hi=m<<6|x>>>26,ct=Y<<11|O>>>21,lt=O<<11|Y>>>21,di=$<<15|b>>>17,ft=b<<15|$>>>17,ht=z<<29|j>>>3,gi=j<<29|z>>>3,dt=W<<28|ie>>>4,gt=ie<<28|W>>>4,pi=ee<<23|te>>>9,pt=te<<23|ee>>>9,mt=se<<25|oe>>>7,An=oe<<25|se>>>7,En=J<<21|ue>>>11,bn=ue<<21|J>>>11,Sn=At<<24|vt>>>8,In=vt<<24|At>>>8,_n=Pi<<27|Et>>>5,la=Et<<27|Pi>>>5,fa=bt<<20|Ri>>>12,ha=Ri<<20|bt>>>12,da=It<<7|St>>>25,ga=St<<7|It>>>25,pa=Bi<<8|_t>>>24,ma=_t<<8|Bi>>>24,ya=Tt<<14|Mi>>>18,wa=Mi<<14|Tt>>>18;t[0]=Ke^~tt&ct,t[1]=We^~rt<,t[10]=dt^~fa&Ye,t[11]=gt^~ha&oi,t[20]=et^~ut&mt,t[21]=ui^~hi&An,t[30]=_n^~si&ci,t[31]=la^~$e&nt,t[40]=fi^~pi&da,t[41]=at^~pt&ga,t[2]=tt^~ct&En,t[3]=rt^~lt&bn,t[12]=fa^~Ye&it,t[13]=ha^~oi&li,t[22]=ut^~mt&pa,t[23]=hi^~An&ma,t[32]=si^~ci&di,t[33]=$e^~nt&ft,t[42]=pi^~da&Je,t[43]=pt^~ga&Xe,t[4]=ct^~En&ya,t[5]=lt^~bn&wa,t[14]=Ye^~it&ht,t[15]=oi^~li&gi,t[24]=mt^~pa&ai,t[25]=An^~ma&Ze,t[34]=ci^~di&Sn,t[35]=nt^~ft&In,t[44]=da^~Je&st,t[45]=ga^~Xe&ot,t[6]=En^~ya&Ke,t[7]=bn^~wa&We,t[16]=it^~ht&dt,t[17]=li^~gi>,t[26]=pa^~ai&et,t[27]=ma^~Ze&ui,t[36]=di^~Sn&_n,t[37]=ft^~In&la,t[46]=Je^~st&fi,t[47]=Xe^~ot&at,t[8]=ya^~Ke&tt,t[9]=wa^~We&rt,t[18]=ht^~dt&fa,t[19]=gi^~gt&ha,t[28]=ai^~et&ut,t[29]=Ze^~ui&hi,t[38]=Sn^~_n&si,t[39]=In^~la&$e,t[48]=st^~fi&pi,t[49]=ot^~at&pt,t[0]^=Ax[e*2],t[1]^=Ax[e*2+1]}}});var Ix=D((H0e,Sx)=>{h();var gg=bx();function qu(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}qu.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};qu.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(gg.p1600(this.state),this.count=0);return e};qu.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};Sx.exports=qu});var af=D((j0e,_x)=>{h();_x.exports=vx()(Ix())});var ke=D($r=>{"use strict";h();var fz=$r&&$r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hz=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tx=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fz(e,t,r);return hz(e,t),e},dz=$r&&$r.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($r,"__esModule",{value:!0});$r.AddressComputer=$r.Address=void 0;var Vu=Tx(_v()),gz=dz((nr(),xe(hr))),ku=Wd(),oA=yr(),Ra=Tx(Ie()),pz=Yd(),mz=af(),aA=32,yz="0".repeat(16),pg=class t{constructor(e,r){if(!e){this.publicKey=p.Buffer.from([]),this.hrp=r||ku.LibraryConfig.DefaultAddressHrp;return}if(ArrayBuffer.isView(e)){if(e.length!=aA)throw new Ra.ErrAddressCannotCreate(e);this.publicKey=p.Buffer.from(e),this.hrp=r||ku.LibraryConfig.DefaultAddressHrp;return}if(e instanceof t){if(r)throw new Ra.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");this.publicKey=e.publicKey,this.hrp=e.hrp;return}if(typeof e=="string"){if(t.isValidHex(e)){this.publicKey=p.Buffer.from(e,"hex"),this.hrp=r||ku.LibraryConfig.DefaultAddressHrp;return}if(r)throw new Ra.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");let{hrp:n,pubkey:i}=uA({value:e,allowCustomHrp:!1});this.publicKey=i,this.hrp=n;return}throw new Ra.ErrAddressCannotCreate(e)}static newFromBech32(e){let{hrp:r,pubkey:n}=uA({value:e,allowCustomHrp:!0});return new t(n,r)}static fromBech32(e){let{hrp:r,pubkey:n}=uA({value:e,allowCustomHrp:!1});return new t(n,r)}static newFromHex(e,r){if(!t.isValidHex(e))throw new Ra.ErrAddressCannotCreate(e);return new t(p.Buffer.from(e,"hex"),r)}static fromHex(e,r){return t.newFromHex(e,r)}static fromAddress(e){return new t(e)}static fromBuffer(e,r){return new t(e,r)}static fromString(e,r){return new t(e,r)}static isValidHex(e){return p.Buffer.from(e,"hex").length==aA}static empty(){return new t("")}static isValid(e){let r=Vu.decodeUnsafe(e),n=r?.prefix,i=r?p.Buffer.from(Vu.fromWords(r.words)):void 0;return!(n!==ku.LibraryConfig.DefaultAddressHrp||i?.length!==aA)}hex(){return this.toHex()}toHex(){return this.isEmpty()?"":this.publicKey.toString("hex")}bech32(){return this.toBech32()}toBech32(){if(this.isEmpty())return"";let e=Vu.toWords(this.pubkey());return Vu.encode(this.hrp,e)}pubkey(){return this.getPublicKey()}getPublicKey(){return this.publicKey}getHrp(){return this.hrp}isEmpty(){return this.publicKey.length==0}equals(e){return e?this.publicKey.toString()==e.publicKey.toString():!1}toString(){return this.toBech32()}toJSON(){return{bech32:this.toBech32(),pubkey:this.toHex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.isSmartContract()}isSmartContract(){return this.toHex().startsWith(yz)}};$r.Address=pg;var cA=class{constructor(e){this.numberOfShardsWithoutMeta=e||oA.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META}computeContractAddress(e,r){let n=p.Buffer.alloc(8,0),i=e.getPublicKey(),s=i.slice(30),o=p.Buffer.alloc(8),u=new gz.default(r.toString()),a=pz.bigIntToBuffer(u);o.write(a.reverse().toString("hex"),"hex");let c=p.Buffer.concat([i,o]),f=mz("keccak256").update(c).digest(),d=p.Buffer.from(oA.WasmVirtualMachine,"hex"),w=p.Buffer.concat([n,d,f.slice(10,30),s]);return new pg(w)}getShardOfAddress(e){return this.getShardOfPubkey(e.getPublicKey(),this.numberOfShardsWithoutMeta)}getShardOfPubkey(e,r){let n=parseInt("11",2),i=parseInt("01",2),s=e[31];if(this.isPubkeyOfMetachain(e))return oA.METACHAIN_ID;let o=s&n;return o>r-1&&(o=s&i),o}isPubkeyOfMetachain(e){let r=p.Buffer.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=p.Buffer.from(e).slice(0,r.length);return!!(r.equals(n)||p.Buffer.alloc(32).equals(p.Buffer.from(e)))}};$r.AddressComputer=cA;function uA(t){let e=t.value,r=t.allowCustomHrp,n,i;try{let s=Vu.decode(e);n=s.prefix,i=p.Buffer.from(Vu.fromWords(s.words))}catch(s){throw new Ra.ErrAddressCannotCreate(e,s)}if(!r&&n!=ku.LibraryConfig.DefaultAddressHrp)throw new Ra.ErrAddressBadHrp(ku.LibraryConfig.DefaultAddressHrp,n);return{hrp:n,pubkey:i}}});var Bn=D(Ft=>{"use strict";h();var wz=Ft&&Ft.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vz=Ft&&Ft.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Az=Ft&&Ft.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wz(e,t,r);return vz(e,t),e};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.isEmpty=Ft.guardEmpty=Ft.guardNotEmpty=Ft.guardLength=Ft.guardSameLength=Ft.guardValueIsSetWithMessage=Ft.guardValueIsSet=Ft.guardTrue=void 0;var Hu=Az(Ie());function Ez(t,e){if(!t)throw new Hu.ErrInvariantFailed(`[<${e}>] isn't true`)}Ft.guardTrue=Ez;function bz(t,e){Cx(`${t} isn't set (null or undefined)`,e)}Ft.guardValueIsSet=bz;function Cx(t,e){if(e==null||e===void 0)throw new Hu.ErrInvariantFailed(t)}Ft.guardValueIsSetWithMessage=Cx;function Sz(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Hu.ErrInvariantFailed("arrays do not have the same length")}Ft.guardSameLength=Sz;function Iz(t,e){let r=t.length||0;if(r!=e)throw new Hu.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Ft.guardLength=Iz;function _z(t,e){if(lA(t))throw new Hu.ErrInvariantFailed(`${e} is empty`)}Ft.guardNotEmpty=_z;function Tz(t,e){if(!lA(t))throw new Hu.ErrInvariantFailed(`${e} is not empty`)}Ft.guardEmpty=Tz;function lA(t){return t.isEmpty?t.isEmpty():t.length===0}Ft.isEmpty=lA});var Nx=D(mg=>{"use strict";h();Object.defineProperty(mg,"__esModule",{value:!0});mg.TypeFormula=void 0;var fA=class{constructor(e,r){this.name=e,this.typeParameters=r}toString(){if(this.typeParameters.length>0){let e=this.typeParameters.map(r=>r.toString()).join(", ");return`${this.name}<${e}>`}else return this.name}};mg.TypeFormula=fA});var xx=D(yg=>{"use strict";h();Object.defineProperty(yg,"__esModule",{value:!0});yg.TypeFormulaParser=void 0;var uf=Nx(),Hi=class t{parseExpression(e){e=e.trim();let r=this.tokenizeExpression(e).filter(s=>s!==t.COMMA),n=[];for(let s of r)if(this.isPunctuation(s))if(this.isEndOfTypeParameters(s)){let o=this.acquireTypeWithParameters(n);n.push(o)}else if(this.isBeginningOfTypeParameters(s))n.push(s);else throw new Error(`Unexpected token (punctuation): ${s}`);else n.push(s);if(n.length!==1)throw new Error(`Unexpected stack length at end of parsing: ${n.length}`);if(t.PUNCTUATION.includes(n[0]))throw new Error("Unexpected root element.");let i=n[0];if(i instanceof uf.TypeFormula)return i;if(typeof i=="string")return new uf.TypeFormula(i,[]);throw new Error(`Unexpected item on stack: ${i}`)}tokenizeExpression(e){let r=[],n="";for(let i of e)this.isPunctuation(i)?(n&&(r.push(n.trim()),n=""),r.push(i)):n+=i;return n&&r.push(n.trim()),r}acquireTypeWithParameters(e){let r=this.acquireTypeParameters(e),n=e.pop();return new uf.TypeFormula(n,r.reverse())}acquireTypeParameters(e){let r=[];for(;;){let n=e.pop();if(n===void 0)throw new Error("Badly specified type parameters");if(this.isBeginningOfTypeParameters(n))break;if(n instanceof uf.TypeFormula)r.push(n);else if(typeof n=="string")r.push(new uf.TypeFormula(n,[]));else throw new Error(`Unexpected type parameter object in stack: ${n}`)}return r}isPunctuation(e){return t.PUNCTUATION.includes(e)}isEndOfTypeParameters(e){return e===t.END_TYPE_PARAMETERS}isBeginningOfTypeParameters(e){return e===t.BEGIN_TYPE_PARAMETERS}};yg.TypeFormulaParser=Hi;Hi.BEGIN_TYPE_PARAMETERS="<";Hi.END_TYPE_PARAMETERS=">";Hi.COMMA=",";Hi.PUNCTUATION=[Hi.COMMA,Hi.BEGIN_TYPE_PARAMETERS,Hi.END_TYPE_PARAMETERS]});var Ox=D(wg=>{"use strict";h();Object.defineProperty(wg,"__esModule",{value:!0});wg.getJavascriptPrototypesInHierarchy=void 0;function Cz(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}wg.getJavascriptPrototypesInHierarchy=Cz});var or=D(sr=>{"use strict";h();Object.defineProperty(sr,"__esModule",{value:!0});sr.NullType=sr.TypePlaceholder=sr.isTyped=sr.PrimitiveValue=sr.TypedValue=sr.CustomType=sr.PrimitiveType=sr.TypeCardinality=sr.Type=void 0;var hA=Ox(),Dx=Bn(),lo=class t{constructor(e,r=[],n=cf.fixed(1)){Dx.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return hA.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return Dx.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return hA.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};sr.Type=lo;lo.ClassName="Type";var cf=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};sr.TypeCardinality=cf;cf.MaxCardinality=4096;var vg=class t extends lo{constructor(e){super(e)}getClassName(){return t.ClassName}};sr.PrimitiveType=vg;vg.ClassName="PrimitiveType";var Ag=class t extends lo{getClassName(){return t.ClassName}};sr.CustomType=Ag;Ag.ClassName="CustomType";var lf=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return hA.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};sr.TypedValue=lf;lf.ClassName="TypedValue";var Eg=class t extends lf{constructor(e){super(e)}getClassName(){return t.ClassName}};sr.PrimitiveValue=Eg;Eg.ClassName="PrimitiveValue";function Nz(t){return t.belongsToTypesystem!==void 0}sr.isTyped=Nz;var bg=class t extends lo{constructor(){super("...")}getClassName(){return t.ClassName}};sr.TypePlaceholder=bg;bg.ClassName="TypePlaceholder";var Sg=class t extends lo{constructor(){super("?")}getClassName(){return t.ClassName}};sr.NullType=Sg;Sg.ClassName="NullType"});var ff=D(Ig=>{"use strict";h();Object.defineProperty(Ig,"__esModule",{value:!0});Ig.TypeExpressionParser=void 0;var xz=xx(),Oz=Ie(),Dz=or(),dA=class{constructor(){this.backingTypeFormulaParser=new xz.TypeFormulaParser}parse(e){try{return this.doParse(e)}catch(r){throw new Oz.ErrTypingSystem(`Failed to parse type expression: ${e}. Error: ${r}`)}}doParse(e){let r=this.backingTypeFormulaParser.parseExpression(e);return this.typeFormulaToType(r)}typeFormulaToType(e){let r=e.typeParameters.map(n=>this.typeFormulaToType(n));return new Dz.Type(e.name,r)}};Ig.TypeExpressionParser=dA});var pA=D(fo=>{"use strict";h();Object.defineProperty(fo,"__esModule",{value:!0});fo.EndpointParameterDefinition=fo.EndpointModifiers=fo.EndpointDefinition=void 0;var Pz=ff(),Px="?",Rz="N / A",gA=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?Px:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>hf.fromJSON(s)),n=e.outputs.map(s=>hf.fromJSON(s)),i=new _g(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};fo.EndpointDefinition=gA;var _g=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};fo.EndpointModifiers=_g;var hf=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Pz.TypeExpressionParser().parse(e.type);return new t(e.name||Px,e.description||Rz,r)}};fo.EndpointParameterDefinition=hf});var Gu=D(Yr=>{"use strict";h();var Bz=Yr&&Yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mz=Yr&&Yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lz=Yr&&Yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bz(e,t,r);return Mz(e,t),e};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.Fields=Yr.Field=Yr.FieldDefinition=void 0;var mA=Lz(Ie()),Fz=ff(),yA=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new Fz.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};Yr.FieldDefinition=yA;var wA=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new mA.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new mA.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};Yr.Field=wA;var vA=class{static checkTyping(e,r){if(e.length!=r.length)throw new mA.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";h();Object.defineProperty(ho,"__esModule",{value:!0});ho.EnumValue=ho.EnumVariantDefinition=ho.EnumType=void 0;var Uz=Ie(),AA=Bn(),Tg=Gu(),Bx=or(),Rx=256,Cg=class t extends Bx.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>Ng.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>({...n,discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return AA.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return AA.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};ho.EnumType=Cg;Cg.ClassName="EnumType";var Ng=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],AA.guardTrue(rTg.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Tg.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ho.EnumVariantDefinition=Ng;var xg=class t extends Bx.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Tg.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Tg.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Uz.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};ho.EnumValue=xg;xg.ClassName="EnumValue"});var Lx=D(ju=>{"use strict";h();Object.defineProperty(ju,"__esModule",{value:!0});ju.EventTopicDefinition=ju.EventDefinition=void 0;var qz=ff(),Mx="?",EA=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?Mx:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>Og.fromJSON(n));return new t(e.identifier,r)}};ju.EventDefinition=EA;var Og=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new qz.TypeExpressionParser().parse(e.type);return new t({name:e.name||Mx,type:r,indexed:e.indexed})}};ju.EventTopicDefinition=Og});var Qu=D(zu=>{"use strict";h();Object.defineProperty(zu,"__esModule",{value:!0});zu.Struct=zu.StructType=void 0;var Vz=Ie(),Dg=Gu(),Fx=or(),Pg=class t extends Fx.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Dg.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Dg.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};zu.StructType=Pg;Pg.ClassName="StructType";var Rg=class t extends Fx.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Dg.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Vz.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return Dg.Fields.equals(r,n)}};zu.Struct=Rg;Rg.ClassName="Struct"});var Wu=D(Ku=>{"use strict";h();Object.defineProperty(Ku,"__esModule",{value:!0});Ku.AddressValue=Ku.AddressType=void 0;var kz=ke(),Ux=or(),gf=class t extends Ux.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Ku.AddressType=gf;gf.ClassName="AddressType";var Bg=class t extends Ux.PrimitiveValue{constructor(e){super(new gf),this.value=new kz.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ku.AddressValue=Bg;Bg.ClassName="AddressValue"});var Lg=D($u=>{"use strict";h();Object.defineProperty($u,"__esModule",{value:!0});$u.OptionalValue=$u.OptionalType=void 0;var Hz=Bn(),pf=or(),mf=class t extends pf.Type{constructor(e){super("Optional",[e],pf.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(pf.NullType.ClassName);return r||n}};$u.OptionalType=mf;mf.ClassName="OptionalType";var Mg=class t extends pf.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new mf(new pf.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return Hz.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};$u.OptionalValue=Mg;Mg.ClassName="OptionalValue"});var wf=D(Yu=>{"use strict";h();Object.defineProperty(Yu,"__esModule",{value:!0});Yu.BooleanValue=Yu.BooleanType=void 0;var qx=or(),yf=class t extends qx.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Yu.BooleanType=yf;yf.ClassName="BooleanType";var Fg=class t extends qx.PrimitiveValue{constructor(e){super(new yf),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Yu.BooleanValue=Fg;Fg.ClassName="BooleanValue"});var go=D(Ju=>{"use strict";h();Object.defineProperty(Ju,"__esModule",{value:!0});Ju.BytesValue=Ju.BytesType=void 0;var Vx=or(),vf=class t extends Vx.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Ju.BytesType=vf;vf.ClassName="BytesType";var Ug=class t extends Vx.PrimitiveValue{constructor(e){super(new vf),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=p.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=p.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ju.BytesValue=Ug;Ug.ClassName="BytesValue"});var Hx=D(Xu=>{"use strict";h();Object.defineProperty(Xu,"__esModule",{value:!0});Xu.CodeMetadataValue=Xu.CodeMetadataType=void 0;var kx=or(),qg=class extends kx.PrimitiveType{constructor(){super("CodeMetadata")}};Xu.CodeMetadataType=qg;var bA=class extends kx.PrimitiveValue{constructor(e){super(new qg),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Xu.CodeMetadataValue=bA});var kg=D(Zu=>{"use strict";h();Object.defineProperty(Zu,"__esModule",{value:!0});Zu.CompositeValue=Zu.CompositeType=void 0;var Gz=Bn(),SA=or(),Af=class t extends SA.Type{constructor(...e){super("Composite",e,SA.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Zu.CompositeType=Af;Af.ClassName="CompositeType";var Vg=class t extends SA.TypedValue{constructor(e,r){super(e),Gz.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Af(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.CollectionOfTypedValues=void 0;var IA=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.List=Gi.OptionValue=Gi.ListType=Gi.OptionType=void 0;var jz=Bn(),zz=_A(),Ma=or(),Ba=class t extends Ma.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Ma.NullType.ClassName);return r||n}};Gi.OptionType=Ba;Ba.ClassName="OptionType";var Ef=class t extends Ma.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};Gi.ListType=Ef;Ef.ClassName="ListType";var Gg=class t extends Ma.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Ba(new Ma.NullType);return new t(e)}static newMissingTyped(e){return new t(new Ba(e))}static newProvided(e){let r=new Ba(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return jz.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};Gi.OptionValue=Gg;Gg.ClassName="OptionValue";var jg=class t extends Ma.TypedValue{constructor(e,r){super(e),this.backingCollection=new zz.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Ma.TypePlaceholder,[]);let r=e[0].getType(),n=new Ef(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Gi.List=jg;jg.ClassName="List"});var Kg=D(ec=>{"use strict";h();Object.defineProperty(ec,"__esModule",{value:!0});ec.ArrayVec=ec.ArrayVecType=void 0;var Gx=Bn(),Qz=_A(),jx=or(),zg=class t extends jx.Type{constructor(e,r){super("Array",[r]),Gx.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};ec.ArrayVecType=zg;zg.ClassName="ArrayVecType";var Qg=class t extends jx.TypedValue{constructor(e,r){super(e),Gx.guardLength(r,e.length),this.backingCollection=new Qz.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ec.ArrayVec=Qg;Qg.ClassName="ArrayVec"});var If=D(tc=>{"use strict";h();Object.defineProperty(tc,"__esModule",{value:!0});tc.H256Value=tc.H256Type=void 0;var zx=or(),Sf=class t extends zx.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};tc.H256Type=Sf;Sf.ClassName="H256Type";var Wg=class t extends zx.PrimitiveValue{constructor(e){super(new Sf),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};tc.H256Value=Wg;Wg.ClassName="H256Value"});var Yg=D(rc=>{"use strict";h();Object.defineProperty(rc,"__esModule",{value:!0});rc.NothingValue=rc.NothingType=void 0;var Qx=or(),_f=class t extends Qx.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};rc.NothingType=_f;_f.ClassName="NothingType";var $g=class t extends Qx.PrimitiveValue{constructor(){super(new _f)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};rc.NothingValue=$g;$g.ClassName="NothingValue"});var Lf=D(Ee=>{"use strict";h();var Kz=Ee&&Ee.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wz=Ee&&Ee.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$z=Ee&&Ee.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kz(e,t,r);return Wz(e,t),e},Yz=Ee&&Ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.BigIntValue=Ee.BigUIntValue=Ee.I64Value=Ee.U64Value=Ee.I32Value=Ee.U32Value=Ee.I16Value=Ee.U16Value=Ee.I8Value=Ee.U8Value=Ee.NumericalValue=Ee.BigIntType=Ee.BigUIntType=Ee.I64Type=Ee.U64Type=Ee.I32Type=Ee.U32Type=Ee.I16Type=Ee.U16Type=Ee.I8Type=Ee.U8Type=Ee.NumericalType=void 0;var Jz=Yz((nr(),xe(hr))),Kx=$z(Ie()),Wx=or(),Jr=class t extends Wx.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ee.NumericalType=Jr;Jr.ClassName="NumericalType";var Tf=class t extends Jr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ee.U8Type=Tf;Tf.ClassName="U8Type";var Cf=class t extends Jr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ee.I8Type=Cf;Cf.ClassName="I8Type";var Nf=class t extends Jr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ee.U16Type=Nf;Nf.ClassName="U16Type";var xf=class t extends Jr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ee.I16Type=xf;xf.ClassName="I16Type";var Of=class t extends Jr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ee.U32Type=Of;Of.ClassName="U32Type";var Df=class t extends Jr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ee.I32Type=Df;Df.ClassName="I32Type";var Pf=class t extends Jr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ee.U64Type=Pf;Pf.ClassName="U64Type";var Rf=class t extends Jr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ee.I64Type=Rf;Rf.ClassName="I64Type";var Bf=class t extends Jr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ee.BigUIntType=Bf;Bf.ClassName="BigUIntType";var Mf=class t extends Jr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ee.BigIntType=Mf;Mf.ClassName="BigIntType";var Xr=class t extends Wx.PrimitiveValue{constructor(e,r){if(super(e),typeof r=="bigint"&&(r=r.toString()),this.value=new Jz.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new Kx.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new Kx.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ee.NumericalValue=Xr;Xr.ClassName="NumericalValue";var Jg=class t extends Xr{constructor(e){super(new Tf,e)}getClassName(){return t.ClassName}};Ee.U8Value=Jg;Jg.ClassName="U8Value";var Xg=class t extends Xr{constructor(e){super(new Cf,e)}getClassName(){return t.ClassName}};Ee.I8Value=Xg;Xg.ClassName="I8Value";var Zg=class t extends Xr{constructor(e){super(new Nf,e)}getClassName(){return t.ClassName}};Ee.U16Value=Zg;Zg.ClassName="U16Value";var ep=class t extends Xr{constructor(e){super(new xf,e)}getClassName(){return t.ClassName}};Ee.I16Value=ep;ep.ClassName="I16Value";var tp=class t extends Xr{constructor(e){super(new Of,e)}getClassName(){return t.ClassName}};Ee.U32Value=tp;tp.ClassName="U32Value";var rp=class t extends Xr{constructor(e){super(new Df,e)}getClassName(){return t.ClassName}};Ee.I32Value=rp;rp.ClassName="I32Value";var np=class t extends Xr{constructor(e){super(new Pf,e)}getClassName(){return t.ClassName}};Ee.U64Value=np;np.ClassName="U64Value";var ip=class t extends Xr{constructor(e){super(new Rf,e)}getClassName(){return t.ClassName}};Ee.I64Value=ip;ip.ClassName="I64Value";var sp=class t extends Xr{constructor(e){super(new Bf,e)}getClassName(){return t.ClassName}};Ee.BigUIntValue=sp;sp.ClassName="BigUIntValue";var op=class t extends Xr{constructor(e){super(new Mf,e)}getClassName(){return t.ClassName}};Ee.BigIntValue=op;op.ClassName="BigIntValue"});var up=D(nc=>{"use strict";h();Object.defineProperty(nc,"__esModule",{value:!0});nc.StringValue=nc.StringType=void 0;var $x=or(),Ff=class t extends $x.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};nc.StringType=Ff;Ff.ClassName="StringType";var ap=class t extends $x.PrimitiveValue{constructor(e){super(new Ff),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=p.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};nc.StringValue=ap;ap.ClassName="StringValue"});var sc=D(ic=>{"use strict";h();Object.defineProperty(ic,"__esModule",{value:!0});ic.TokenIdentifierValue=ic.TokenIdentifierType=void 0;var Yx=or(),Xz="EGLD",Uf=class t extends Yx.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};ic.TokenIdentifierType=Uf;Uf.ClassName="TokenIdentifierType";var cp=class t extends Yx.PrimitiveValue{constructor(e){super(new Uf),this.value=e}static egld(){return new t(Xz)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};ic.TokenIdentifierValue=cp;cp.ClassName="TokenIdentifierValue"});var fp=D(Mn=>{"use strict";h();var Zz=Mn&&Mn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eQ=Mn&&Mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tQ=Mn&&Mn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zz(e,t,r);return eQ(e,t),e};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.Tuple=Mn.TupleType=void 0;var rQ=tQ(Ie()),Jx=Gu(),Xx=Qu(),qf=class t extends Xx.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new Jx.FieldDefinition(Zx(i),"anonymous tuple field",n))}};Mn.TupleType=qf;qf.ClassName="TupleType";function Zx(t){return`field${t}`}var lp=class t extends Xx.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new rQ.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new qf(...r),i=e.map((s,o)=>new Jx.Field(s,Zx(o)));return new t(n,i)}};Mn.Tuple=lp;lp.ClassName="Tuple"});var gp=D(po=>{"use strict";h();Object.defineProperty(po,"__esModule",{value:!0});po.VariadicValue=po.CountedVariadicType=po.VariadicType=void 0;var oc=or(),La=class t extends oc.Type{constructor(e,r=!1){super("Variadic",[e],oc.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};po.VariadicType=La;La.ClassName="VariadicType";var hp=class extends oc.Type{constructor(e){super("Variadic",[e],oc.TypeCardinality.variable())}getClassName(){return La.ClassName}};po.CountedVariadicType=hp;hp.ClassName="VariadicType";var dp=class t extends oc.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new La(new oc.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new La(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();var nQ=zi&&zi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iQ=zi&&zi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sQ=zi&&zi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nQ(e,t,r);return iQ(e,t),e};Object.defineProperty(zi,"__esModule",{value:!0});zi.TypeMapper=void 0;var e6=sQ(Ie()),oQ=Wu(),TA=Lg(),aQ=wf(),uQ=go(),cQ=Hx(),pp=kg(),CA=df(),lQ=Gu(),t6=bf(),ji=Kg(),fQ=If(),r6=Yg(),Ln=Lf(),hQ=up(),n6=Qu(),i6=sc(),mo=fp(),mp=gp(),NA=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new t6.OptionType(r[0])],["List",(...r)=>new t6.ListType(r[0])],["VarArgs",(...r)=>new mp.VariadicType(r[0])],["MultiResultVec",(...r)=>new mp.VariadicType(r[0])],["variadic",(...r)=>new mp.VariadicType(r[0])],["counted-variadic",(...r)=>new mp.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new TA.OptionalType(r[0])],["optional",(...r)=>new TA.OptionalType(r[0])],["OptionalResult",(...r)=>new TA.OptionalType(r[0])],["multi",(...r)=>new pp.CompositeType(...r)],["MultiArg",(...r)=>new pp.CompositeType(...r)],["MultiResult",(...r)=>new pp.CompositeType(...r)],["multi",(...r)=>new pp.CompositeType(...r)],["tuple",(...r)=>new mo.TupleType(...r)],["tuple2",(...r)=>new mo.TupleType(...r)],["tuple3",(...r)=>new mo.TupleType(...r)],["tuple4",(...r)=>new mo.TupleType(...r)],["tuple5",(...r)=>new mo.TupleType(...r)],["tuple6",(...r)=>new mo.TupleType(...r)],["tuple7",(...r)=>new mo.TupleType(...r)],["tuple8",(...r)=>new mo.TupleType(...r)],["array2",(...r)=>new ji.ArrayVecType(2,r[0])],["array8",(...r)=>new ji.ArrayVecType(8,r[0])],["array16",(...r)=>new ji.ArrayVecType(16,r[0])],["array20",(...r)=>new ji.ArrayVecType(20,r[0])],["array32",(...r)=>new ji.ArrayVecType(32,r[0])],["array46",(...r)=>new ji.ArrayVecType(46,r[0])],["array48",(...r)=>new ji.ArrayVecType(48,r[0])],["array64",(...r)=>new ji.ArrayVecType(64,r[0])],["array128",(...r)=>new ji.ArrayVecType(128,r[0])],["array256",(...r)=>new ji.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Ln.U8Type],["u16",new Ln.U16Type],["u32",new Ln.U32Type],["u64",new Ln.U64Type],["U64",new Ln.U64Type],["BigUint",new Ln.BigUIntType],["i8",new Ln.I8Type],["i16",new Ln.I16Type],["i32",new Ln.I32Type],["i64",new Ln.I64Type],["Bigint",new Ln.BigIntType],["BigInt",new Ln.BigIntType],["bool",new aQ.BooleanType],["bytes",new uQ.BytesType],["Address",new oQ.AddressType],["H256",new fQ.H256Type],["utf-8 string",new hQ.StringType],["TokenIdentifier",new i6.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new i6.TokenIdentifierType],["CodeMetadata",new cQ.CodeMetadataType],["nothing",new r6.NothingType],["AsyncCall",new r6.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new e6.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(CA.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(n6.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new n6.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new CA.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new CA.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new lQ.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new e6.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};zi.TypeMapper=NA});var u6=D(Qi=>{"use strict";h();var dQ=Qi&&Qi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gQ=Qi&&Qi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pQ=Qi&&Qi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dQ(e,t,r);return gQ(e,t),e};Object.defineProperty(Qi,"__esModule",{value:!0});Qi.AbiRegistry=void 0;var s6=pQ(Ie()),Vf=Bn(),ac=pA(),o6=df(),DA=Lx(),a6=Qu(),mQ=xA(),yQ="?",PA=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.upgradeConstructorDefinition=e.upgradeConstructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||yQ,n=e.constructor||{},i=e.upgradeConstructor||{},s=e.endpoints||[],o=e.types||{},u=e.events||[],a=ac.EndpointDefinition.fromJSON({name:"constructor",...n}),c=ac.EndpointDefinition.fromJSON({name:"upgradeConstructor",...i}),f=s.map(N=>ac.EndpointDefinition.fromJSON(N)),d=[];for(let N in o){let P=o[N];if(P.type=="struct")d.push(a6.StructType.fromJSON({name:N,fields:P.fields}));else if(P.type=="enum"||P.type=="explicit-enum")d.push(o6.EnumType.fromJSON({name:N,variants:P.variants}));else throw new s6.ErrTypingSystem(`Cannot handle custom type: ${N}`)}let w=u.map(N=>DA.EventDefinition.fromJSON(N));return new t({name:r,constructorDefinition:a,upgradeConstructorDefinition:c,endpoints:f,customTypes:d,events:w}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Vf.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(a6.StructType.ClassName));return Vf.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(o6.EnumType.ClassName));return Vf.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Vf.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Vf.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new mQ.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new s6.ErrTypingSystem("Did not re-map all custom types");let n=OA(this.constructorDefinition,e),i=this.upgradeConstructorDefinition?OA(this.upgradeConstructorDefinition,e):void 0,s=[];for(let a of this.endpoints)s.push(OA(a,e));let o=this.events.map(a=>wQ(a,e));return new t({name:this.name,constructorDefinition:n,upgradeConstructorDefinition:i,endpoints:s,customTypes:r,events:o})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(u=>u.getName()==e.getName())>=0)return;for(let u of e.getNamesOfDependencies()){let a=r.find(c=>c.getName()==u);a&&this.mapCustomTypeDepthFirst(a,r,n,i)}let o=n.mapType(e);i.push(o)}};Qi.AbiRegistry=PA;function OA(t,e){let r=t.input.map(i=>new ac.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new ac.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new ac.EndpointDefinition(t.name,r,n,t.modifiers)}function wQ(t,e){let r=t.inputs.map(n=>new DA.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new DA.EventDefinition(t.identifier,r)}});var l6=D(uc=>{"use strict";h();Object.defineProperty(uc,"__esModule",{value:!0});uc.createListOfTokenIdentifiers=uc.createListOfAddresses=void 0;var vQ=Wu(),c6=bf(),AQ=sc();function EQ(t){let e=t.map(n=>new vQ.AddressValue(n));return c6.List.fromItems(e)}uc.createListOfAddresses=EQ;function bQ(t){let e=t.map(n=>new AQ.TokenIdentifierValue(n));return c6.List.fromItems(e)}uc.createListOfTokenIdentifiers=bQ});var I6=D(Pr=>{"use strict";h();var SQ=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IQ=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Q=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SQ(e,t,r);return IQ(e,t),e};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.onPrimitiveTypeSelect=Pr.onPrimitiveValueSelect=Pr.onTypedValueSelect=Pr.onTypeSelect=void 0;var wp=_Q(Ie()),f6=Wu(),h6=wf(),d6=go(),g6=df(),yp=bf(),p6=If(),m6=Lf(),y6=Yg(),w6=Qu(),v6=sc(),A6=fp(),E6=or(),b6=Kg(),S6=up();function TQ(t,e){if(t.hasExactClass(yp.OptionType.ClassName))return e.onOption();if(t.hasExactClass(yp.ListType.ClassName))return e.onList();if(t.hasExactClass(b6.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(E6.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(w6.StructType.ClassName))return e.onStruct();if(t.hasExactClass(A6.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(g6.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`type isn't known: ${t}`)}Pr.onTypeSelect=TQ;function CQ(t,e){if(t.hasClassOrSuperclass(E6.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(yp.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(yp.List.ClassName))return e.onList();if(t.hasExactClass(b6.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(w6.Struct.ClassName))return e.onStruct();if(t.hasExactClass(A6.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(g6.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`value isn't typed: ${t}`)}Pr.onTypedValueSelect=CQ;function NQ(t,e){if(t.hasExactClass(h6.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(m6.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(f6.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(d6.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(S6.StringValue.ClassName))return e.onString();if(t.hasExactClass(p6.H256Value.ClassName))return e.onH256();if(t.hasExactClass(v6.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(y6.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Pr.onPrimitiveValueSelect=NQ;function xQ(t,e){if(t.hasExactClass(h6.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(m6.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(f6.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(d6.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(S6.StringType.ClassName))return e.onString();if(t.hasExactClass(p6.H256Type.ClassName))return e.onH256();if(t.hasExactClass(v6.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(y6.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new wp.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Pr.onPrimitiveTypeSelect=xQ});var $t=D(He=>{"use strict";h();var OQ=He&&He.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ut=He&&He.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OQ(e,t,r)};Object.defineProperty(He,"__esModule",{value:!0});Ut(u6(),He);Ut(Wu(),He);Ut(Lg(),He);Ut(wf(),He);Ut(go(),He);Ut(kg(),He);Ut(pA(),He);Ut(df(),He);Ut(l6(),He);Ut(Gu(),He);Ut(bf(),He);Ut(Kg(),He);Ut(If(),He);Ut(I6(),He);Ut(Yg(),He);Ut(Lf(),He);Ut(up(),He);Ut(Qu(),He);Ut(sc(),He);Ut(fp(),He);Ut(ff(),He);Ut(xA(),He);Ut(or(),He);Ut(gp(),He)});var T6=D(Ki=>{"use strict";h();var DQ=Ki&&Ki.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PQ=Ki&&Ki.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RQ=Ki&&Ki.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DQ(e,t,r);return PQ(e,t),e};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.OptionValueBinaryCodec=void 0;var _6=RQ(Ie()),vp=$t(),RA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[vp.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new _6.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[vp.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new vp.OptionValue(r);if(e[0]!=1)throw new _6.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new vp.OptionValue(r,n)}encodeNested(e){return e.isSet()?p.Buffer.concat([p.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):p.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?p.Buffer.concat([p.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):p.Buffer.from([])}};Ki.OptionValueBinaryCodec=RA});var C6=D(Ap=>{"use strict";h();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.AddressBinaryCodec=void 0;var BQ=ke(),MQ=$t(),BA=class{decodeNested(e){let r=e.slice(0,32),n=new BQ.Address(r);return[new MQ.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Ap.AddressBinaryCodec=BA});var x6=D(Wi=>{"use strict";h();var LQ=Wi&&Wi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FQ=Wi&&Wi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UQ=Wi&&Wi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LQ(e,t,r);return FQ(e,t),e};Object.defineProperty(Wi,"__esModule",{value:!0});Wi.BooleanBinaryCodec=void 0;var qQ=UQ(Ie()),N6=$t(),kf=class t{decodeNested(e){let r=e.readUInt8(0);return[new N6.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new qQ.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new N6.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?p.Buffer.from([t.TRUE]):p.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?p.Buffer.from([t.TRUE]):p.Buffer.from([])}};Wi.BooleanBinaryCodec=kf;kf.TRUE=1;kf.FALSE=0});var bp=D(Ep=>{"use strict";h();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.SizeOfU32=void 0;Ep.SizeOfU32=4});var D6=D(cc=>{"use strict";h();var VQ=cc&&cc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cc,"__esModule",{value:!0});cc.NumericalBinaryCodec=void 0;var Hf=VQ((nr(),xe(hr))),MA=$t(),O6=bp(),Yt=Pu(),LA=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=O6.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),u=i+n;return[o,u]}decodeTopLevel(e,r){let n=Yt.cloneBuffer(e);if(e.length==0)return new MA.NumericalValue(r,new Hf.default(0));if(!r.withSign||Yt.isMsbZero(n)){let c=Yt.bufferToBigInt(n);return new MA.NumericalValue(r,c)}Yt.flipBufferBitsInPlace(n);let a=Yt.bufferToBigInt(n).multipliedBy(new Hf.default(-1)).minus(new Hf.default(1));return new MA.NumericalValue(r,a)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=p.Buffer.alloc(O6.SizeOfU32);return n.writeUInt32BE(r.length),p.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return p.Buffer.alloc(r,0);if(!e.withSign){let o=Yt.bigIntToBuffer(e.value),u=p.Buffer.alloc(r-o.length,0);return p.Buffer.concat([u,o])}if(e.value.isPositive()){let o=Yt.bigIntToBuffer(e.value);Yt.isMsbOne(o)&&(o=Yt.prependByteToBuffer(o,0));let u=p.Buffer.alloc(r-o.length,0);return p.Buffer.concat([u,o])}let n=e.value.plus(new Hf.default(1)),i=Yt.bigIntToBuffer(n);Yt.flipBufferBitsInPlace(i),Yt.isMsbZero(i)&&(i=Yt.prependByteToBuffer(i,255));let s=p.Buffer.alloc(r-i.length,255);return p.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?p.Buffer.alloc(0):r?this.encodePrimitive(e):Yt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=Yt.bigIntToBuffer(e.value);return Yt.isMsbOne(i)&&(i=Yt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Hf.default(1)),n=Yt.bigIntToBuffer(r);return Yt.flipBufferBitsInPlace(n),Yt.isMsbZero(n)&&(n=Yt.prependByteToBuffer(n,255)),n}};cc.NumericalBinaryCodec=LA});var P6=D(Sp=>{"use strict";h();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.H256BinaryCodec=void 0;var kQ=If(),FA=class{decodeNested(e){let r=e.slice(0,32);return[new kQ.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Sp.H256BinaryCodec=FA});var Tp=D(_p=>{"use strict";h();Object.defineProperty(_p,"__esModule",{value:!0});_p.BytesBinaryCodec=void 0;var R6=go(),Ip=bp(),UA=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(Ip.SizeOfU32,Ip.SizeOfU32+r);return[new R6.BytesValue(n),Ip.SizeOfU32+r]}decodeTopLevel(e){return new R6.BytesValue(e)}encodeNested(e){let r=p.Buffer.alloc(Ip.SizeOfU32);return r.writeUInt32BE(e.getLength()),p.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};_p.BytesBinaryCodec=UA});var M6=D(Cp=>{"use strict";h();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.TokenIdentifierCodec=void 0;var HQ=go(),B6=sc(),GQ=Tp(),qA=class{constructor(){this.bytesCodec=new GQ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new B6.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new B6.TokenIdentifierValue(r.toString())}encodeNested(e){let r=HQ.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return p.Buffer.from(e.valueOf())}};Cp.TokenIdentifierCodec=qA});var F6=D(Np=>{"use strict";h();Object.defineProperty(Np,"__esModule",{value:!0});Np.NothingCodec=void 0;var L6=$t(),VA=class{decodeNested(){return[new L6.NothingValue,0]}decodeTopLevel(){return new L6.NothingValue}encodeNested(){return p.Buffer.from([])}encodeTopLevel(){return p.Buffer.from([])}};Np.NothingCodec=VA});var q6=D(xp=>{"use strict";h();Object.defineProperty(xp,"__esModule",{value:!0});xp.StringBinaryCodec=void 0;var U6=$t(),jQ=go(),zQ=Tp(),kA=class{constructor(){this.bytesBinaryCodec=new zQ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new U6.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new U6.StringValue(e.toString())}encodeNested(e){let r=jQ.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return p.Buffer.from(e.valueOf())}};xp.StringBinaryCodec=kA});var V6=D(Dp=>{"use strict";h();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.PrimitiveBinaryCodec=void 0;var Op=$t(),QQ=C6(),KQ=x6(),WQ=D6(),$Q=P6(),YQ=Tp(),JQ=M6(),XQ=F6(),ZQ=q6(),HA=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new KQ.BooleanBinaryCodec,this.numericalCodec=new WQ.NumericalBinaryCodec,this.addressCodec=new QQ.AddressBinaryCodec,this.h256Codec=new $Q.H256BinaryCodec,this.bytesCodec=new YQ.BytesBinaryCodec,this.stringCodec=new ZQ.StringBinaryCodec,this.tokenIdentifierCodec=new JQ.TokenIdentifierCodec,this.nothingCodec=new XQ.NothingCodec}decodeNested(e,r){return Op.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return Op.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return Op.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 Op.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()})}};Dp.PrimitiveBinaryCodec=HA});var G6=D(Pp=>{"use strict";h();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.ListBinaryCodec=void 0;var k6=$t(),H6=bp(),GA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,u=H6.SizeOfU32;e=o.slice(u);for(let a=0;a0;){let[u,a]=this.binaryCodec.decodeNested(e,n);i.push(u),o+=a,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new k6.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=p.Buffer.alloc(H6.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return p.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return p.Buffer.concat(r)}};Pp.ListBinaryCodec=GA});var zA=D(Rp=>{"use strict";h();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.FieldsBinaryCodec=void 0;var eK=$t(),jA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,u]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(u),i+=u;let a=new eK.Field(o,s.name);n.push(a)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return p.Buffer.concat(r)}};Rp.FieldsBinaryCodec=jA});var KA=D(Bp=>{"use strict";h();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.StructBinaryCodec=void 0;var tK=$t(),rK=zA(),QA=class{constructor(e){this.fieldsCodec=new rK.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new tK.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Bp.StructBinaryCodec=QA});var j6=D(Lp=>{"use strict";h();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.EnumBinaryCodec=void 0;var Mp=$t(),nK=zA(),WA=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new nK.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[u,a]=this.fieldsCodec.decodeNested(e,o);return[new Mp.EnumValue(r,s,u),i+a]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Mp.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Mp.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return p.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Mp.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return p.Buffer.concat([o,i])}};Lp.EnumBinaryCodec=WA});var z6=D(Fp=>{"use strict";h();Object.defineProperty(Fp,"__esModule",{value:!0});Fp.TupleBinaryCodec=void 0;var iK=KA(),$A=class{constructor(e){this.structCodec=new iK.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Fp.TupleBinaryCodec=$A});var Q6=D(Up=>{"use strict";h();Object.defineProperty(Up,"__esModule",{value:!0});Up.ArrayVecBinaryCodec=void 0;var sK=$t(),YA=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let u=0;u{"use strict";h();var oK=Fn&&Fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aK=Fn&&Fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uK=Fn&&Fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oK(e,t,r);return aK(e,t),e};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.BinaryCodecConstraints=Fn.BinaryCodec=void 0;var K6=uK(Ie()),qp=$t(),W6=Bn(),cK=T6(),lK=V6(),fK=G6(),hK=KA(),dK=j6(),gK=z6(),pK=Q6(),JA=class{constructor(e=null){this.constraints=e||new Vp,this.optionCodec=new cK.OptionValueBinaryCodec(this),this.listCodec=new fK.ListBinaryCodec(this),this.arrayCodec=new pK.ArrayVecBinaryCodec(this),this.primitiveCodec=new lK.PrimitiveBinaryCodec(this),this.structCodec=new hK.StructBinaryCodec(this),this.tupleCodec=new gK.TupleBinaryCodec(this),this.enumCodec=new dK.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),qp.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=qp.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return W6.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qp.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 W6.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qp.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)})}};Fn.BinaryCodec=JA;var Vp=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new K6.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new K6.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Fn.BinaryCodecConstraints=Vp});var $6=D(Un=>{"use strict";h();var mK=Un&&Un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Un,"__esModule",{value:!0});Un.decodeBigNumber=Un.decodeString=Un.decodeBool=Un.decodeUnsignedNumber=void 0;var yK=mK((nr(),xe(hr))),kp=$t(),wK=XA(),Hp=new wK.BinaryCodec;function vK(t){let e=Hp.decodeTopLevel(t,new kp.BigUIntType);return Number(e.valueOf())}Un.decodeUnsignedNumber=vK;function AK(t){return!!Hp.decodeTopLevel(t,new kp.BooleanType).valueOf()}Un.decodeBool=AK;function EK(t){let e=Hp.decodeTopLevel(t,new kp.BytesType);return String(e.valueOf())}Un.decodeString=EK;function bK(t){let e=Hp.decodeTopLevel(t,new kp.BigUIntType);return new yK.default(e.valueOf())}Un.decodeBigNumber=bK});var ZA=D(yo=>{"use strict";h();var SK=yo&&yo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y6=yo&&yo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SK(e,t,r)};Object.defineProperty(yo,"__esModule",{value:!0});Y6(XA(),yo);Y6($6(),yo)});var lc=D(Gp=>{"use strict";h();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.ArgSerializer=void 0;var J6=yr(),IK=ZA(),X6=$t(),eE=Lg(),tE=kg(),rE=gp(),_K={codec:new IK.BinaryCodec},nE=class{constructor(e){e={..._K,...e},this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(J6.ARGUMENTS_SEPARATOR).map(r=>p.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(J6.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(eE.OptionalValue.ClassName)){let a=o;a.isSet()&&i(a.getTypedValue());return}if(o.hasExactClass(rE.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(tE.CompositeValue.ClassName)){let a=o;for(let c of a.getItems())i(c);return}let u=r.codec.encodeTopLevel(o);n.push(u)}function s(o){if(o.getType().isCounted){let a=new X6.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(a))}for(let a of o.getItems())i(a)}return n}};Gp.ArgSerializer=nE});var iE=D((Qye,Z6)=>{h();Ps.notEqual=CK;Ps.notOk=NK;Ps.equal=TK;Ps.ok=Ps;Z6.exports=Ps;function TK(t,e,r){Ps(t==e,r)}function CK(t,e,r){Ps(t!=e,r)}function NK(t,e){Ps(!t,e)}function Ps(t,e){if(!t)throw new Error(e||"AssertionError")}});var tO=D((Wye,eO)=>{h();eO.exports=sE;sE.supported=typeof WebAssembly<"u";function sE(t){if(!sE.supported)return null;var e=t&&t.imports,r=xK("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(a){i.exports.memory.grow(Math.ceil(Math.abs(a-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(a){if(i.exports)return a();if(n){n.then(a.bind(null,null)).catch(a);return}try{if(t&&t.async)throw new Error("async");u({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(u)}o(a)}function u(a){i.exports=a.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function xK(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(OK)):new(no()).Buffer(t,"base64")}function OK(t){return t.charCodeAt(0)}});var uO=D((Xye,Yi)=>{h();var $i=iE(),Pt=tO()(),Rs=64,jp=[];Yi.exports=qn;var rO=Yi.exports.BYTES_MIN=16,nO=Yi.exports.BYTES_MAX=64,Yye=Yi.exports.BYTES=32,iO=Yi.exports.KEYBYTES_MIN=16,sO=Yi.exports.KEYBYTES_MAX=64,Jye=Yi.exports.KEYBYTES=32,oO=Yi.exports.SALTBYTES=16,aO=Yi.exports.PERSONALBYTES=16;function qn(t,e,r,n,i){if(!(this instanceof qn))return new qn(t,e,r,n,i);if(!(Pt&&Pt.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&($i(t>=rO,"digestLength must be at least "+rO+", was given "+t),$i(t<=nO,"digestLength must be at most "+nO+", was given "+t),e!=null&&$i(e.length>=iO,"key must be at least "+iO+", was given "+e.length),e!=null&&$i(e.length<=sO,"key must be at least "+sO+", was given "+e.length),r!=null&&$i(r.length===oO,"salt must be exactly "+oO+", was given "+r.length),n!=null&&$i(n.length===aO,"personal must be exactly "+aO+", was given "+n.length)),jp.length||(jp.push(Rs),Rs+=216),this.digestLength=t,this.finalized=!1,this.pointer=jp.pop(),Pt.memory.fill(0,0,64),Pt.memory[0]=this.digestLength,Pt.memory[1]=e?e.length:0,Pt.memory[2]=1,Pt.memory[3]=1,r&&Pt.memory.set(r,32),n&&Pt.memory.set(n,48),this.pointer+216>Pt.memory.length&&Pt.realloc(this.pointer+216),Pt.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Pt.memory.fill(0,Rs,Rs+e.length),Pt.memory[this.pointer+200]=128)}qn.prototype.update=function(t){return $i(this.finalized===!1,"Hash instance finalized"),$i(t,"input must be TypedArray or Buffer"),Rs+t.length>Pt.memory.length&&Pt.realloc(Rs+t.length),Pt.memory.set(t,Rs),Pt.exports.blake2b_update(this.pointer,Rs,Rs+t.length),this};qn.prototype.digest=function(t){if($i(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,jp.push(this.pointer),Pt.exports.blake2b_final(this.pointer),!t||t==="binary")return Pt.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return PK(Pt.memory,this.pointer+128,this.digestLength);$i(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{h();var Ao=iE(),jf=uO();function zp(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function cO(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function mO(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function wo(t,e,r,n,i,s){var o=Gf[i],u=Gf[i+1],a=Gf[s],c=Gf[s+1];zp(_e,t,e),cO(_e,t,o,u);var f=_e[n]^_e[t],d=_e[n+1]^_e[t+1];_e[n]=d,_e[n+1]=f,zp(_e,r,n),f=_e[e]^_e[r],d=_e[e+1]^_e[r+1],_e[e]=f>>>24^d<<8,_e[e+1]=d>>>24^f<<8,zp(_e,t,e),cO(_e,t,a,c),f=_e[n]^_e[t],d=_e[n+1]^_e[t+1],_e[n]=f>>>16^d<<16,_e[n+1]=d>>>16^f<<16,zp(_e,r,n),f=_e[e]^_e[r],d=_e[e+1]^_e[r+1],_e[e]=d>>>31^f<<1,_e[e+1]=f>>>31^d<<1}var yO=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),BK=[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],Rr=new Uint8Array(BK.map(function(t){return t*2})),_e=new Uint32Array(32),Gf=new Uint32Array(32);function wO(t,e){var r=0;for(r=0;r<16;r++)_e[r]=t.h[r],_e[r+16]=yO[r];for(_e[24]=_e[24]^t.t,_e[25]=_e[25]^t.t/4294967296,e&&(_e[28]=~_e[28],_e[29]=~_e[29]),r=0;r<32;r++)Gf[r]=mO(t.b,4*r);for(r=0;r<12;r++)wo(0,8,16,24,Rr[r*16+0],Rr[r*16+1]),wo(2,10,18,26,Rr[r*16+2],Rr[r*16+3]),wo(4,12,20,28,Rr[r*16+4],Rr[r*16+5]),wo(6,14,22,30,Rr[r*16+6],Rr[r*16+7]),wo(0,10,20,30,Rr[r*16+8],Rr[r*16+9]),wo(2,12,22,24,Rr[r*16+10],Rr[r*16+11]),wo(4,14,16,26,Rr[r*16+12],Rr[r*16+13]),wo(6,8,18,28,Rr[r*16+14],Rr[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^_e[r]^_e[r+16]}var vo=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 fc(t,e,r,n){vo.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,vo[0]=t,e&&(vo[1]=e.length),vo[2]=1,vo[3]=1,r&&vo.set(r,32),n&&vo.set(n,48);for(var i=0;i<16;i++)this.h[i]=yO[i]^mO(vo,i*4);e&&(vO(this,e),this.c=128)}fc.prototype.update=function(t){return Ao(t!=null,"input must be Uint8Array or Buffer"),vO(this,t),this};fc.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ao(e.length>=this.outlen,"out must have at least outlen bytes of space"),MK(this,e),t==="hex"?LK(e):e};fc.prototype.final=fc.prototype.digest;fc.ready=function(t){jf.ready(function(){t()})};function vO(t,e){for(var r=0;r>2]>>8*(r&3);return e}function LK(t){for(var e="",r=0;r=lO,"outlen must be at least "+lO+", was given "+e),Ao(e<=fO,"outlen must be at most "+fO+", was given "+e),r!=null&&Ao(r.length>=hO,"key must be at least "+hO+", was given "+r.length),r!=null&&Ao(r.length<=dO,"key must be at most "+dO+", was given "+r.length),n!=null&&Ao(n.length===gO,"salt must be exactly "+gO+", was given "+n.length),i!=null&&Ao(i.length===pO,"personal must be exactly "+pO+", was given "+i.length)),new AO(e,r,n,i)};Zr.exports.ready=function(t){jf.ready(function(){t()})};Zr.exports.WASM_SUPPORTED=jf.SUPPORTED;Zr.exports.WASM_LOADED=!1;var lO=Zr.exports.BYTES_MIN=16,fO=Zr.exports.BYTES_MAX=64,e1e=Zr.exports.BYTES=32,hO=Zr.exports.KEYBYTES_MIN=16,dO=Zr.exports.KEYBYTES_MAX=64,t1e=Zr.exports.KEYBYTES=32,gO=Zr.exports.SALTBYTES=16,pO=Zr.exports.PERSONALBYTES=16;jf.ready(function(t){t||(Zr.exports.WASM_LOADED=!0,AO=jf)})});var EO=D(Qp=>{"use strict";h();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.Code=void 0;var UK=oE(),qK=32,aE=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return p.Buffer.from(this.hex,"hex")}computeHash(){let e=UK(qK).update(this.valueOf()).digest();return p.Buffer.from(e)}};Qp.Code=aE});var uE=D(Kp=>{"use strict";h();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.CodeMetadata=void 0;var hc=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBytes(e){return t.fromBuffer(p.Buffer.from(e))}static fromBuffer(e){if(e.length{"use strict";h();var VK=Ji&&Ji.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kK=Ji&&Ji.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HK=Ji&&Ji.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VK(e,t,r);return kK(e,t),e};Object.defineProperty(Ji,"__esModule",{value:!0});Ji.ContractFunction=void 0;var GK=HK(Ie()),cE=class t{constructor(e){if(this.name=e,e==null)throw new GK.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Ji.ContractFunction=cE});var hE=D(Wp=>{"use strict";h();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.Compatibility=void 0;var jK=ke(),fE=class{static guardAddressIsSetAndNonZero(e,r,n){!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==jK.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`)}};Wp.Compatibility=fE});var Bs=D($p=>{"use strict";h();Object.defineProperty($p,"__esModule",{value:!0});$p.TransactionPayload=void 0;var dE=class t{constructor(e){this.data=p.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=p.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>p.Buffer.from(e,"hex"))}length(){return p.Buffer.from(this.data).length}};$p.TransactionPayload=dE});var dc=D(Yp=>{"use strict";h();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.TransactionBuilder=void 0;var zK=yr(),QK=en(),KK=Bs(),gE=class{constructor(e){this.config=e.config,this.sender=e.sender,this.receiver=e.receiver,this.dataParts=e.dataParts,this.providedGasLimit=e.gasLimit,this.addDataMovementGas=e.addDataMovementGas,this.amount=e.amount}computeGasLimit(e){return this.addDataMovementGas?this.config.minGasLimit+this.config.gasLimitPerByte*BigInt(e.length())+this.providedGasLimit:this.providedGasLimit}buildTransactionPayload(){let e=this.dataParts.join(zK.ARGUMENTS_SEPARATOR);return new KK.TransactionPayload(e)}build(){let e=this.buildTransactionPayload(),r=this.computeGasLimit(e);return new QK.Transaction({sender:this.sender.bech32(),receiver:this.receiver.bech32(),gasLimit:r,value:this.amount||0n,data:e.valueOf(),chainID:this.config.chainID})}};Yp.TransactionBuilder=gE});var bO=D(Jp=>{"use strict";h();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.DelegationTransactionsFactory=void 0;var WK=ke(),$K=yr(),YK=Ie(),hn=Vn(),tn=dc(),pE=class{constructor(e){this.config=e.config,this.argSerializer=new hn.ArgSerializer,this.delegationManagerAddress=WK.Address.fromHex($K.DELEGATION_MANAGER_SC_ADDRESS_HEX,this.config.addressHrp)}createTransactionForNewDelegationContract(e){let r=["createNewDelegationContract",...this.argSerializer.valuesToStrings([new hn.BigUIntValue(e.totalDelegationCap),new hn.BigUIntValue(e.serviceFee)])],n=this.config.gasLimitCreateDelegationContract+this.config.additionalGasLimitForDelegationOperations;return new tn.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.delegationManagerAddress,dataParts:r,gasLimit:n,addDataMovementGas:!0,amount:e.amount}).build()}createTransactionForAddingNodes(e){if(e.publicKeys.length!==e.signedMessages.length)throw new YK.Err("The number of public keys should match the number of signed messages");let r=e.signedMessages.map(o=>new hn.BytesValue(p.Buffer.from(o))),n=this.argSerializer.valuesToStrings(r),i=e.publicKeys.length,s=["addNodes"];for(let o=0;o{h();var SO=(nr(),xe(hr)),IO=_O.exports;(function(){"use strict";function t(c){return c<10?"0"+c:c}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,i,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o;function u(c){return r.lastIndex=0,r.test(c)?'"'+c.replace(r,function(f){var d=s[f];return typeof d=="string"?d:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+c+'"'}function a(c,f){var d,w,A,_,N=n,P,V=f[c],U=V!=null&&(V instanceof SO||SO.isBigNumber(V));switch(V&&typeof V=="object"&&typeof V.toJSON=="function"&&(V=V.toJSON(c)),typeof o=="function"&&(V=o.call(f,c,V)),typeof V){case"string":return U?V:u(V);case"number":return isFinite(V)?String(V):"null";case"boolean":case"null":case"bigint":return String(V);case"object":if(!V)return"null";if(n+=i,P=[],Object.prototype.toString.apply(V)==="[object Array]"){for(_=V.length,d=0;d<_;d+=1)P[d]=a(d,V)||"null";return A=P.length===0?"[]":n?`[ -`+n+P.join(`, +`)}};ue.ErrContractHasNoAddress=jA;var QA=class extends Qe{constructor(e){super(e)}};ue.ErrMock=QA;var KA=class extends Qe{constructor(e){super(e)}};ue.ErrTypingSystem=KA;var WA=class extends Qe{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};ue.ErrMissingFieldOnStruct=WA;var $A=class extends Qe{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};ue.ErrMissingFieldOnEnum=$A;var YA=class extends Qe{constructor(e){super(`cannot parse contract results: ${e}`)}};ue.ErrCannotParseContractResults=YA;var JA=class extends Qe{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};ue.ErrCannotParseTransactionOutcome=JA;var XA=class extends Qe{constructor(e){super(e)}};ue.ErrCodec=XA;var ZA=class extends Qe{constructor(e){super(e)}};ue.ErrContractInteraction=ZA;var e2=class extends Qe{constructor(){super("Method not yet implemented")}};ue.ErrNotImplemented=e2;var t2=class extends Qe{constructor(){super("invalid arguments for relayed v1 builder")}};ue.ErrInvalidRelayedV1BuilderArguments=t2;var r2=class extends Qe{constructor(){super("invalid arguments for relayed v2 builder")}};ue.ErrInvalidRelayedV2BuilderArguments=r2;var n2=class extends Qe{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ue.ErrGasLimitShouldBe0ForInnerTransaction=n2;var i2=class extends Qe{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};ue.ErrIsCompletedFieldIsMissingOnTransaction=i2;var s2=class extends Qe{constructor(e){super(e)}};ue.ErrInvalidTokenIdentifier=s2;var o2=class extends Qe{constructor(e){super(e)}};ue.ErrBadUsage=o2;var a2=class extends Qe{constructor(e){super(e)}};ue.ErrInvalidInnerTransaction=a2;var c2=class extends Qe{constructor(e){super(e)}};ue.ErrParseTransactionOutcome=c2;var u2=class extends Qe{constructor(e,r){super(r),this.returnCode=e}};ue.ErrSmartContractQuery=u2});var xr=L(me=>{"use strict";h();Object.defineProperty(me,"__esModule",{value:!0});me.ESDT_CONTRACT_ADDRESS=me.DELEGATION_MANAGER_SC_ADDRESS=me.CONTRACT_DEPLOY_ADDRESS=me.BECH32_ADDRESS_LENGTH=me.DEFAULT_HRP=me.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER=me.UNKNOWN_SIGNER=me.SDK_JS_SIGNER=me.METACHAIN_ID=me.WasmVirtualMachine=me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=me.HEX_TRANSACTION_HASH_LENGTH=me.MESSAGE_PREFIX=me.DEFAULT_MESSAGE_VERSION=me.ESDT_CONTRACT_ADDRESS_HEX=me.DELEGATION_MANAGER_SC_ADDRESS_HEX=me.CONTRACT_DEPLOY_ADDRESS_HEX=me.VM_TYPE_WASM_VM=me.ARGUMENTS_SEPARATOR=me.ESDT_TRANSFER_VALUE=me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDTNFT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_FUNCTION_NAME=me.ESDT_TRANSFER_GAS_LIMIT=me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=me.TRANSACTION_VERSION_DEFAULT=me.TRANSACTION_OPTIONS_TX_GUARDED=me.TRANSACTION_OPTIONS_TX_HASH_SIGN=me.TRANSACTION_OPTIONS_DEFAULT=me.TRANSACTION_MIN_GAS_PRICE=void 0;me.TRANSACTION_MIN_GAS_PRICE=1e9;me.TRANSACTION_OPTIONS_DEFAULT=0;me.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;me.TRANSACTION_OPTIONS_TX_GUARDED=2;me.TRANSACTION_VERSION_DEFAULT=2;me.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS=2;me.ESDT_TRANSFER_GAS_LIMIT=5e5;me.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";me.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";me.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";me.ESDT_TRANSFER_VALUE="0";me.ARGUMENTS_SEPARATOR="@";me.VM_TYPE_WASM_VM=new Uint8Array([5,0]);me.CONTRACT_DEPLOY_ADDRESS_HEX="0000000000000000000000000000000000000000000000000000000000000000";me.DELEGATION_MANAGER_SC_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000004ffff";me.ESDT_CONTRACT_ADDRESS_HEX="000000000000000000010000000000000000000000000000000000000002ffff";me.DEFAULT_MESSAGE_VERSION=1;me.MESSAGE_PREFIX=`Elrond Signed Message: +`;me.HEX_TRANSACTION_HASH_LENGTH=64;me.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META=3;me.WasmVirtualMachine="0500";me.METACHAIN_ID=4294967295;me.SDK_JS_SIGNER="sdk-js";me.UNKNOWN_SIGNER="unknown";me.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER="EGLD-000000";me.DEFAULT_HRP="erd";me.BECH32_ADDRESS_LENGTH=62;me.CONTRACT_DEPLOY_ADDRESS="erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu";me.DELEGATION_MANAGER_SC_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqylllslmq6y6";me.ESDT_CONTRACT_ADDRESS="erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"});var Sc=L(ai=>{"use strict";h();var AW=ai&&ai.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ai,"__esModule",{value:!0});ai.TokenPayment=ai.TokenComputer=ai.TokenTransfer=ai.Token=void 0;var Ec=AW((qt(),qe(jt))),Hu=Ve(),EW=xr(),HC="EGLD",GC=18;Ec.default.set({ROUNDING_MODE:1});var kd=class{constructor(e){this.identifier=e.identifier,this.nonce=e.nonce||0n}};ai.Token=kd;var Vp=class t{constructor(e){if(this.isLegacyTokenTransferOptions(e)){let r=new Ec.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new Hu.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0,this.token=new kd({identifier:e.tokenIdentifier,nonce:BigInt(e.nonce)}),this.amount=BigInt(this.amountAsBigInteger.toFixed(0))}else this.token=e.token,this.amount=e.amount,this.tokenIdentifier=e.token.identifier,this.nonce=Number(e.token.nonce),this.amountAsBigInteger=new Ec.default(this.amount.toString()),this.numDecimals=0}static newFromEgldAmount(e){let r=new kd({identifier:EW.EGLD_IDENTIFIER_FOR_MULTI_ESDTNFT_TRANSFER});return new t({token:r,amount:e})}isLegacyTokenTransferOptions(e){return e.tokenIdentifier!==void 0}static egldFromAmount(e){let r=new Ec.default(e).shiftedBy(GC).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:HC,nonce:0,amountAsBigInteger:e,numDecimals:GC})}static fungibleFromAmount(e,r,n){let i=new Ec.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Ec.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amount.toString()}valueOf(){return new Ec.default(this.amount.toString())}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.token.identifier==HC}isFungible(){return this.token.nonce==0n}};ai.TokenTransfer=Vp;var l2=class{constructor(){}isFungible(e){return e.nonce===0n}extractNonceFromExtendedIdentifier(e){let r=e.split("-");if(this.checkIfExtendedIdentifierWasProvided(r),this.checkLengthOfRandomSequence(r[1]),r.length==2)return 0;let n=b.Buffer.from(r[2],"hex");return SW(n)}extractIdentifierFromExtendedIdentifier(e){let r=e.split("-");return this.checkIfExtendedIdentifierWasProvided(r),this.ensureTokenTickerValidity(r[0]),this.checkLengthOfRandomSequence(r[1]),r[0]+"-"+r[1]}checkIfExtendedIdentifierWasProvided(e){if(e.length<2||e.length>3)throw new Hu.ErrInvalidTokenIdentifier("Invalid extended token identifier provided")}checkLengthOfRandomSequence(e){if(e.length!==6)throw new Hu.ErrInvalidTokenIdentifier("The identifier is not valid. The random sequence does not have the right length")}ensureTokenTickerValidity(e){if(e.length<3||e.length>10)throw new Hu.ErrInvalidTokenIdentifier("The token ticker should be between 3 and 10 characters");if(!e.match(/^[a-zA-Z0-9]+$/))throw new Hu.ErrInvalidTokenIdentifier("The token ticker should only contain alphanumeric characters");if(e!=e.toUpperCase())throw new Hu.ErrInvalidTokenIdentifier("The token ticker should be upper case")}};ai.TokenComputer=l2;function SW(t){return t.readUIntBE(0,t.length)}var f2=class extends Vp{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ai.TokenPayment=f2});var ra=L(Tc=>{"use strict";h();Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Logger=Tc.LogLevel=void 0;var _c;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(_c=Tc.LogLevel||(Tc.LogLevel={}));var Hp=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=_c.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=_c.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=_c.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=_c.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=_c.Error||console.error(e,r)}};Tc.Logger=Hp;Hp.logLevel=_c.Debug});var Vd=L(ci=>{"use strict";h();var _W=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TW=ci&&ci.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IW=ci&&ci.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_W(e,t,r);return TW(e,t),e};Object.defineProperty(ci,"__esModule",{value:!0});ci.TransactionOptions=ci.TransactionVersion=void 0;var $i=xr(),zC=IW(Ve()),d2=class t{constructor(e){if(e=Number(e),e<1)throw new zC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t($i.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t($i.TRANSACTION_VERSION_DEFAULT)}valueOf(){return this.value}};ci.TransactionVersion=d2;var h2=class t{constructor(e){if(e=Number(e),e<0)throw new zC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t($i.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=$i.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=$i.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&$i.TRANSACTION_OPTIONS_TX_HASH_SIGN)==$i.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&$i.TRANSACTION_OPTIONS_TX_GUARDED)==$i.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=$i.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=$i.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};ci.TransactionOptions=h2});var g2=L((BEe,KC)=>{"use strict";h();var zp="qpzry9x8gf2tvdw0s3jn54khce6mua7l",p2={};for(Hd=0;Hd>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function jC(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Gu(e)^n>>5}for(e=Gu(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=jC(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Gu(n)^o,i+=zp.charAt(o)}for(s=0;s<6;++s)n=Gu(n);for(n^=1,s=0;s<6;++s){var c=n>>(5-s)*5&31;i+=zp.charAt(c)}return i}function QC(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var c=jC(s);if(typeof c=="string")return c;for(var a=[],u=0;u=o.length)&&a.push(p)}return c!==1?"Invalid checksum for "+t:{prefix:s,words:a}}function xW(){var t=QC.apply(null,arguments);if(typeof t=="object")return t}function NW(t){var e=QC.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function jp(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,c.push(i>>s&o);if(n)s>0&&c.push(i<=e)return"Excess padding";if(i<{"use strict";h();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.LibraryConfig=void 0;var Qp=class{};Kp.LibraryConfig=Qp;Qp.DefaultAddressHrp="erd"});var zu=L(er=>{"use strict";h();var DW=er&&er.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BW=er&&er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LW=er&&er.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DW(e,t,r);return BW(e,t),e},FW=er&&er.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(er,"__esModule",{value:!0});er.addressToHex=er.bigIntToHex=er.byteArrayToHex=er.boolToHex=er.utf8ToHex=er.zeroPadStringIfOddLength=er.isPaddedHex=er.numberToPaddedHex=void 0;var qW=FW((qt(),qe(jt))),UW=Nt(),kW=LW(na());function VW(t){let e;typeof t=="bigint"||typeof t=="number"?e=t:e=new qW.default(t);let r=e.toString(16);return $p(r)}er.numberToPaddedHex=VW;function HW(t){t=t||"";let e=b.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}er.isPaddedHex=HW;function $p(t){return t=t||"",t.length%2==1?"0"+t:t}er.zeroPadStringIfOddLength=$p;function WC(t){let e=b.Buffer.from(t).toString("hex");return $p(e)}er.utf8ToHex=WC;function GW(t){return WC(t.toString())}er.boolToHex=GW;function zW(t){let e=b.Buffer.from(t).toString("hex");return $p(e)}er.byteArrayToHex=zW;function jW(t){return t==0?"":kW.getHexMagnitudeOfBigInt(t)}er.bigIntToHex=jW;function QW(t){return UW.Address.fromBech32(t.toString()).pubkey().toString("hex")}er.addressToHex=QW});var na=L(Nr=>{"use strict";h();var KW=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.prependByteToBuffer=Nr.flipBufferBitsInPlace=Nr.getHexMagnitudeOfBigInt=Nr.bigIntToBuffer=Nr.bufferToBigInt=Nr.cloneBuffer=Nr.isMsbZero=Nr.isMsbOne=void 0;var m2=KW((qt(),qe(jt))),WW=zu();function $C(t,e=0){return t[e]>>7==1}Nr.isMsbOne=$C;function $W(t,e=0){return!$C(t,e)}Nr.isMsbZero=$W;function YW(t){let e=b.Buffer.alloc(t.length);return t.copy(e),e}Nr.cloneBuffer=YW;function JW(t){let e=t.toString("hex");return new m2.default(`0x${e}`,16)}Nr.bufferToBigInt=JW;function XW(t){let e=YC(t);return b.Buffer.from(e,"hex")}Nr.bigIntToBuffer=XW;function YC(t){return t=new m2.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new m2.default(-1))),WW.numberToPaddedHex(t)):""}Nr.getHexMagnitudeOfBigInt=YC;function ZW(t){for(let e=0;e{"use strict";h();var t$=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r$=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JC=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t$(e,t,r);return r$(e,t),e},n$=ar&&ar.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ar,"__esModule",{value:!0});ar.bufferToHex=ar.addressToHex=ar.bigIntToHex=ar.utf8ToHex=ar.bigIntToBuffer=ar.bufferToBigInt=ar.stringToBuffer=void 0;var i$=n$((qt(),qe(jt))),XC=JC(na()),s$=JC(zu());function o$(t){return b.Buffer.from(t)}ar.stringToBuffer=o$;function a$(t){return t.length==0?new i$.default(0):XC.bufferToBigInt(t)}ar.bufferToBigInt=a$;function c$(t){return t==0?b.Buffer.from([]):XC.bigIntToBuffer(t)}ar.bigIntToBuffer=c$;var y2=zu();Object.defineProperty(ar,"utf8ToHex",{enumerable:!0,get:function(){return y2.utf8ToHex}});Object.defineProperty(ar,"bigIntToHex",{enumerable:!0,get:function(){return y2.bigIntToHex}});Object.defineProperty(ar,"addressToHex",{enumerable:!0,get:function(){return y2.addressToHex}});function u$(t){let e=t.toString("hex");return s$.zeroPadStringIfOddLength(e)}ar.bufferToHex=u$});var _o=L((jEe,v2)=>{"use strict";h();var ju=typeof Reflect=="object"?Reflect:null,ZC=ju&&typeof ju.apply=="function"?ju.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Jp;ju&&typeof ju.ownKeys=="function"?Jp=ju.ownKeys:Object.getOwnPropertySymbols?Jp=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Jp=function(e){return Object.getOwnPropertyNames(e)};function l$(t){console&&console.warn&&console.warn(t)}var tx=Number.isNaN||function(e){return e!==e};function Kt(){Kt.init.call(this)}v2.exports=Kt;v2.exports.once=p$;Kt.EventEmitter=Kt;Kt.prototype._events=void 0;Kt.prototype._eventsCount=0;Kt.prototype._maxListeners=void 0;var ex=10;function Xp(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Kt,"defaultMaxListeners",{enumerable:!0,get:function(){return ex},set:function(t){if(typeof t!="number"||t<0||tx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ex=t}});Kt.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};Kt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||tx(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 rx(t){return t._maxListeners===void 0?Kt.defaultMaxListeners:t._maxListeners}Kt.prototype.getMaxListeners=function(){return rx(this)};Kt.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var c=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw c.context=o,c}var a=s[e];if(a===void 0)return!1;if(typeof a=="function")ZC(a,this,r);else for(var u=a.length,f=ax(a,u),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=o.length,l$(c)}return t}Kt.prototype.addListener=function(e,r){return nx(this,e,r,!1)};Kt.prototype.on=Kt.prototype.addListener;Kt.prototype.prependListener=function(e,r){return nx(this,e,r,!0)};function f$(){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 ix(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=f$.bind(n);return i.listener=r,n.wrapFn=i,i}Kt.prototype.once=function(e,r){return Xp(r),this.on(e,ix(this,e,r)),this};Kt.prototype.prependOnceListener=function(e,r){return Xp(r),this.prependListener(e,ix(this,e,r)),this};Kt.prototype.removeListener=function(e,r){var n,i,s,o,c;if(Xp(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){c=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():d$(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,c||r)}return this};Kt.prototype.off=Kt.prototype.removeListener;Kt.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function sx(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?h$(i):ax(i,i.length)}Kt.prototype.listeners=function(e){return sx(this,e,!0)};Kt.prototype.rawListeners=function(e){return sx(this,e,!1)};Kt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ox.call(t,e)};Kt.prototype.listenerCount=ox;function ox(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Kt.prototype.eventNames=function(){return this._eventsCount>0?Jp(this._events):[]};function ax(t,e){for(var r=new Array(e),n=0;n{h();ux.exports=_o().EventEmitter});var w2=L(()=>{h()});var gx=L((XEe,px)=>{"use strict";h();function lx(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fx(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return Zp.alloc(0);for(var n=Zp.allocUnsafe(r>>>0),i=this.head,s=0;i;)S$(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(c===o.length?s+=o:s+=o.slice(0,r),r-=c,r===0){c===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(c));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=Zp.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,c=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,c),r-=c,r===0){c===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(c));break}++s}return this.length-=s,n}},{key:E$,value:function(r,n){return A2(this,fx(fx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var S2=L((eSe,yx)=>{"use strict";h();function _$(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,O.default.nextTick(E2,this,t)):O.default.nextTick(E2,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?O.default.nextTick(eg,r):(r._writableState.errorEmitted=!0,O.default.nextTick(mx,r,s)):O.default.nextTick(mx,r,s):e?(O.default.nextTick(eg,r),e(s)):O.default.nextTick(eg,r)}),this)}function mx(t,e){E2(t,e),eg(t)}function eg(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function T$(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function E2(t,e){t.emit("error",e)}function I$(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}yx.exports={destroy:_$,undestroy:T$,errorOrDestroy:I$}});var Ic=L((rSe,wx)=>{"use strict";h();function C$(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var bx={};function ui(t,e,r){r||(r=Error);function n(s,o,c){return typeof e=="string"?e:e(s,o,c)}var i=function(s){C$(o,s);function o(c,a,u){return s.call(this,n(c,a,u))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,bx[t]=i}function vx(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function x$(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function N$(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function O$(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}ui("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);ui("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&x$(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(N$(t," argument"))i="The ".concat(t," ").concat(n," ").concat(vx(e,"type"));else{var s=O$(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(vx(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);ui("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");ui("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});ui("ERR_STREAM_PREMATURE_CLOSE","Premature close");ui("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});ui("ERR_MULTIPLE_CALLBACK","Callback called multiple times");ui("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");ui("ERR_STREAM_WRITE_AFTER_END","write after end");ui("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ui("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);ui("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");wx.exports.codes=bx});var _2=L((iSe,Ax)=>{"use strict";h();var P$=Ic().codes.ERR_INVALID_OPT_VALUE;function R$(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function M$(t,e,r,n){var i=R$(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new P$(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}Ax.exports={getHighWaterMark:M$}});var Ss=L((oSe,T2)=>{h();typeof Object.create=="function"?T2.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:T2.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Sx=L((cSe,Ex)=>{h();Ex.exports=D$;function D$(t,e){if(I2("noDeprecation"))return t;var r=!1;function n(){if(!r){if(I2("throwDeprecation"))throw new Error(e);I2("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function I2(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var N2=L((lSe,Nx)=>{"use strict";h();Nx.exports=hr;function Tx(t){var e=this;this.next=null,this.entry=null,this.finish=function(){aY(e,t)}}var Qu;hr.WritableState=zd;var B$={deprecate:Sx()},Ix=b2(),rg=wo().Buffer,L$=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function F$(t){return rg.from(t)}function q$(t){return rg.isBuffer(t)||t instanceof L$}var x2=S2(),U$=_2(),k$=U$.getHighWaterMark,ia=Ic().codes,V$=ia.ERR_INVALID_ARG_TYPE,H$=ia.ERR_METHOD_NOT_IMPLEMENTED,G$=ia.ERR_MULTIPLE_CALLBACK,z$=ia.ERR_STREAM_CANNOT_PIPE,j$=ia.ERR_STREAM_DESTROYED,Q$=ia.ERR_STREAM_NULL_VALUES,K$=ia.ERR_STREAM_WRITE_AFTER_END,W$=ia.ERR_UNKNOWN_ENCODING,Ku=x2.errorOrDestroy;Ss()(hr,Ix);function $$(){}function zd(t,e,r){Qu=Qu||Cc(),t=t||{},typeof r!="boolean"&&(r=e instanceof Qu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=k$(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){rY(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Tx(this)}zd.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(zd.prototype,"buffer",{get:B$.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var tg;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(tg=Function.prototype[Symbol.hasInstance],Object.defineProperty(hr,Symbol.hasInstance,{value:function(e){return tg.call(this,e)?!0:this!==hr?!1:e&&e._writableState instanceof zd}})):tg=function(e){return e instanceof this};function hr(t){Qu=Qu||Cc();var e=this instanceof Qu;if(!e&&!tg.call(hr,this))return new hr(t);this._writableState=new zd(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),Ix.call(this)}hr.prototype.pipe=function(){Ku(this,new z$)};function Y$(t,e){var r=new K$;Ku(t,r),O.default.nextTick(e,r)}function J$(t,e,r,n){var i;return r===null?i=new Q$:typeof r!="string"&&!e.objectMode&&(i=new V$("chunk",["string","Buffer"],r)),i?(Ku(t,i),O.default.nextTick(n,i),!1):!0}hr.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&q$(t);return s&&!rg.isBuffer(t)&&(t=F$(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=$$),n.ending?Y$(this,r):(s||J$(this,n,t,r))&&(n.pendingcb++,i=Z$(this,n,s,t,e,r)),i};hr.prototype.cork=function(){this._writableState.corked++};hr.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Cx(this,t))};hr.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new W$(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(hr.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function X$(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=rg.from(e,r)),e}Object.defineProperty(hr.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z$(t,e,r,n,i,s){if(!r){var o=X$(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var c=e.objectMode?1:n.length;e.length+=c;var a=e.length{"use strict";h();var cY=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Px.exports=_s;var Ox=R2(),P2=N2();Ss()(_s,Ox);for(O2=cY(P2.prototype),ng=0;ng{h();var sg=wo(),To=sg.Buffer;function Rx(t,e){for(var r in t)e[r]=t[r]}To.from&&To.alloc&&To.allocUnsafe&&To.allocUnsafeSlow?Mx.exports=sg:(Rx(sg,M2),M2.Buffer=Wu);function Wu(t,e,r){return To(t,e,r)}Rx(To,Wu);Wu.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return To(t,e,r)};Wu.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=To(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Wu.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return To(t)};Wu.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return sg.SlowBuffer(t)}});var L2=L(Lx=>{"use strict";h();var B2=Dx().Buffer,Bx=B2.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function fY(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function dY(t){var e=fY(t);if(typeof e!="string"&&(B2.isEncoding===Bx||!Bx(t)))throw new Error("Unknown encoding: "+t);return e||t}Lx.StringDecoder=jd;function jd(t){this.encoding=dY(t);var e;switch(this.encoding){case"utf16le":this.text=vY,this.end=bY,e=4;break;case"utf8":this.fillLast=gY,e=4;break;case"base64":this.text=wY,this.end=AY,e=3;break;default:this.write=EY,this.end=SY;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=B2.allocUnsafe(e)}jd.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function hY(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function pY(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function gY(t){var e=this.lastTotal-this.lastNeed,r=pY(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function mY(t,e){var r=hY(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function yY(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function vY(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function bY(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function wY(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function AY(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function EY(t){return t.toString(this.encoding)}function SY(t){return t&&t.length?this.write(t):""}});var og=L((ySe,Ux)=>{"use strict";h();var Fx=Ic().codes.ERR_STREAM_PREMATURE_CLOSE;function _Y(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";h();var ag;function sa(t,e,r){return e=CY(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CY(t){var e=xY(t,"string");return typeof e=="symbol"?e:String(e)}function xY(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var NY=og(),oa=Symbol("lastResolve"),xc=Symbol("lastReject"),Qd=Symbol("error"),cg=Symbol("ended"),Nc=Symbol("lastPromise"),F2=Symbol("handlePromise"),Oc=Symbol("stream");function aa(t,e){return{value:t,done:e}}function OY(t){var e=t[oa];if(e!==null){var r=t[Oc].read();r!==null&&(t[Nc]=null,t[oa]=null,t[xc]=null,e(aa(r,!1)))}}function PY(t){O.default.nextTick(OY,t)}function RY(t,e){return function(r,n){t.then(function(){if(e[cg]){r(aa(void 0,!0));return}e[F2](r,n)},n)}}var MY=Object.getPrototypeOf(function(){}),DY=Object.setPrototypeOf((ag={get stream(){return this[Oc]},next:function(){var e=this,r=this[Qd];if(r!==null)return Promise.reject(r);if(this[cg])return Promise.resolve(aa(void 0,!0));if(this[Oc].destroyed)return new Promise(function(o,c){O.default.nextTick(function(){e[Qd]?c(e[Qd]):o(aa(void 0,!0))})});var n=this[Nc],i;if(n)i=new Promise(RY(n,this));else{var s=this[Oc].read();if(s!==null)return Promise.resolve(aa(s,!1));i=new Promise(this[F2])}return this[Nc]=i,i}},sa(ag,Symbol.asyncIterator,function(){return this}),sa(ag,"return",function(){var e=this;return new Promise(function(r,n){e[Oc].destroy(null,function(i){if(i){n(i);return}r(aa(void 0,!0))})})}),ag),MY),BY=function(e){var r,n=Object.create(DY,(r={},sa(r,Oc,{value:e,writable:!0}),sa(r,oa,{value:null,writable:!0}),sa(r,xc,{value:null,writable:!0}),sa(r,Qd,{value:null,writable:!0}),sa(r,cg,{value:e._readableState.endEmitted,writable:!0}),sa(r,F2,{value:function(s,o){var c=n[Oc].read();c?(n[Nc]=null,n[oa]=null,n[xc]=null,s(aa(c,!1))):(n[oa]=s,n[xc]=o)},writable:!0}),r));return n[Nc]=null,NY(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[xc];s!==null&&(n[Nc]=null,n[oa]=null,n[xc]=null,s(i)),n[Qd]=i;return}var o=n[oa];o!==null&&(n[Nc]=null,n[oa]=null,n[xc]=null,o(aa(void 0,!0))),n[cg]=!0}),e.on("readable",PY.bind(null,n)),n};kx.exports=BY});var Gx=L((ASe,Hx)=>{h();Hx.exports=function(){throw new Error("Readable.from is not available in the browser")}});var R2=L((_Se,Zx)=>{"use strict";h();Zx.exports=it;var $u;it.ReadableState=Kx;var SSe=_o().EventEmitter,Qx=function(e,r){return e.listeners(r).length},Wd=b2(),ug=wo().Buffer,LY=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function FY(t){return ug.from(t)}function qY(t){return ug.isBuffer(t)||t instanceof LY}var q2=w2(),Ke;q2&&q2.debuglog?Ke=q2.debuglog("stream"):Ke=function(){};var UY=gx(),j2=S2(),kY=_2(),VY=kY.getHighWaterMark,lg=Ic().codes,HY=lg.ERR_INVALID_ARG_TYPE,GY=lg.ERR_STREAM_PUSH_AFTER_EOF,zY=lg.ERR_METHOD_NOT_IMPLEMENTED,jY=lg.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Yu,U2,k2;Ss()(it,Wd);var Kd=j2.errorOrDestroy,V2=["error","close","destroy","pause","resume"];function QY(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function Kx(t,e,r){$u=$u||Cc(),t=t||{},typeof r!="boolean"&&(r=e instanceof $u),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=VY(this,t,"readableHighWaterMark",r),this.buffer=new UY,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Yu||(Yu=L2().StringDecoder),this.decoder=new Yu(t.encoding),this.encoding=t.encoding)}function it(t){if($u=$u||Cc(),!(this instanceof it))return new it(t);var e=this instanceof $u;this._readableState=new Kx(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Wd.call(this)}Object.defineProperty(it.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});it.prototype.destroy=j2.destroy;it.prototype._undestroy=j2.undestroy;it.prototype._destroy=function(t,e){e(t)};it.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=ug.from(t,e),e=""),n=!0),Wx(this,t,e,!1,n)};it.prototype.unshift=function(t){return Wx(this,t,null,!0,!1)};function Wx(t,e,r,n,i){Ke("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,$Y(t,s);else{var o;if(i||(o=KY(s,e)),o)Kd(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==ug.prototype&&(e=FY(e)),n)s.endEmitted?Kd(t,new jY):H2(t,s,e,!0);else if(s.ended)Kd(t,new GY);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?H2(t,s,e,!1):z2(t,s)):H2(t,s,e,!1)}else n||(s.reading=!1,z2(t,s))}return!s.ended&&(s.length=zx?t=zx:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function jx(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=WY(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}it.prototype.read=function(t){Ke("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Ke("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?G2(this):fg(this),null;if(t=jx(t,e),t===0&&e.ended)return e.length===0&&G2(this),null;var n=e.needReadable;Ke("need readable",n),(e.length===0||e.length-t0?i=Jx(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&G2(this)),i!==null&&this.emit("data",i),i};function $Y(t,e){if(Ke("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?fg(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,$x(t)))}}function fg(t){var e=t._readableState;Ke("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ke("emitReadable",e.flowing),e.emittedReadable=!0,O.default.nextTick($x,t))}function $x(t){var e=t._readableState;Ke("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Q2(t)}function z2(t,e){e.readingMore||(e.readingMore=!0,O.default.nextTick(YY,t,e))}function YY(t,e){for(;!e.reading&&!e.ended&&(e.length1&&Xx(n.pipes,t)!==-1)&&!u&&(Ke("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function S(D){Ke("onerror",D),R(),t.removeListener("error",S),Qx(t,"error")===0&&Kd(t,D)}QY(t,"error",S);function I(){t.removeListener("finish",N),R()}t.once("close",I);function N(){Ke("onfinish"),t.removeListener("close",I),R()}t.once("finish",N);function R(){Ke("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(Ke("pipe resume"),r.resume()),t};function JY(t){return function(){var r=t._readableState;Ke("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Qx(t,"data")&&(r.flowing=!0,Q2(t))}}it.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Ke("on readable",n.length,n.reading),n.length?fg(this):n.reading||O.default.nextTick(XY,this)),r};it.prototype.addListener=it.prototype.on;it.prototype.removeListener=function(t,e){var r=Wd.prototype.removeListener.call(this,t,e);return t==="readable"&&O.default.nextTick(Yx,this),r};it.prototype.removeAllListeners=function(t){var e=Wd.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&O.default.nextTick(Yx,this),e};function Yx(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function XY(t){Ke("readable nexttick read 0"),t.read(0)}it.prototype.resume=function(){var t=this._readableState;return t.flowing||(Ke("resume"),t.flowing=!t.readableListening,ZY(this,t)),t.paused=!1,this};function ZY(t,e){e.resumeScheduled||(e.resumeScheduled=!0,O.default.nextTick(eJ,t,e))}function eJ(t,e){Ke("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Q2(t),e.flowing&&!e.reading&&t.read(0)}it.prototype.pause=function(){return Ke("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ke("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Q2(t){var e=t._readableState;for(Ke("flow",e.flowing);e.flowing&&t.read()!==null;);}it.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(Ke("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(Ke("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var c=e.push(o);c||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(c){return function(){return t[c].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function G2(t){var e=t._readableState;Ke("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,O.default.nextTick(tJ,e,t))}function tJ(t,e){if(Ke("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(it.from=function(t,e){return k2===void 0&&(k2=Gx()),k2(it,t,e)});function Xx(t,e){for(var r=0,n=t.length;r{"use strict";h();tN.exports=Io;var dg=Ic().codes,rJ=dg.ERR_METHOD_NOT_IMPLEMENTED,nJ=dg.ERR_MULTIPLE_CALLBACK,iJ=dg.ERR_TRANSFORM_ALREADY_TRANSFORMING,sJ=dg.ERR_TRANSFORM_WITH_LENGTH_0,hg=Cc();Ss()(Io,hg);function oJ(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new nJ);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";h();nN.exports=$d;var rN=K2();Ss()($d,rN);function $d(t){if(!(this instanceof $d))return new $d(t);rN.call(this,t)}$d.prototype._transform=function(t,e,r){r(null,t)}});var uN=L((OSe,cN)=>{"use strict";h();var W2;function cJ(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var aN=Ic().codes,uJ=aN.ERR_MISSING_ARGS,lJ=aN.ERR_STREAM_DESTROYED;function sN(t){if(t)throw t}function fJ(t){return t.setHeader&&typeof t.abort=="function"}function dJ(t,e,r,n){n=cJ(n);var i=!1;t.on("close",function(){i=!0}),W2===void 0&&(W2=og()),W2(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,fJ(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new lJ("pipe"))}}}function oN(t){t()}function hJ(t,e){return t.pipe(e)}function pJ(t){return!t.length||typeof t[t.length-1]!="function"?sN:t.pop()}function gJ(){for(var t=arguments.length,e=new Array(t),r=0;r0;return dJ(o,a,u,function(f){i||(i=f),f&&s.forEach(oN),!a&&(s.forEach(oN),n(i))})});return e.reduce(hJ)}cN.exports=gJ});var $2=L((li,lN)=>{h();li=lN.exports=R2();li.Stream=li;li.Readable=li;li.Writable=N2();li.Duplex=Cc();li.Transform=K2();li.PassThrough=iN();li.finished=og();li.pipeline=uN()});var hN=L((MSe,dN)=>{h();var{Transform:mJ}=$2();dN.exports=t=>class fN extends mJ{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!b.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return b.Buffer.isBuffer(r)||(r=b.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new fN(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var mN=L((BSe,gN)=>{h();var{Transform:yJ}=$2();gN.exports=t=>class pN extends yJ{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!b.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return b.Buffer.isBuffer(r)||(r=b.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new pN(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var vN=L((FSe,yN)=>{h();var vJ=hN(),bJ=mN();yN.exports=function(t){let e=vJ(t),r=bJ(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var AN=L(wN=>{h();var bN=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];wN.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],a=t[6]^t[16]^t[26]^t[36]^t[46],u=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],p=t[9]^t[19]^t[29]^t[39]^t[49],S=f^(i<<1|s>>>31),I=p^(s<<1|i>>>31),N=t[0]^S,R=t[1]^I,D=t[10]^S,U=t[11]^I,k=t[20]^S,z=t[21]^I,H=t[30]^S,F=t[31]^I,V=t[40]^S,q=t[41]^I;S=r^(o<<1|c>>>31),I=n^(c<<1|o>>>31);let C=t[2]^S,B=t[3]^I,x=t[12]^S,g=t[13]^I,v=t[22]^S,l=t[23]^I,d=t[32]^S,m=t[33]^I,w=t[42]^S,_=t[43]^I;S=i^(a<<1|u>>>31),I=s^(u<<1|a>>>31);let A=t[4]^S,y=t[5]^I,T=t[14]^S,E=t[15]^I,M=t[24]^S,W=t[25]^I,Y=t[34]^S,P=t[35]^I,G=t[44]^S,Q=t[45]^I;S=o^(f<<1|p>>>31),I=c^(p<<1|f>>>31);let $=t[6]^S,ee=t[7]^I,ie=t[16]^S,X=t[17]^I,re=t[26]^S,ae=t[27]^I,Z=t[36]^S,oe=t[37]^I,Ot=t[46]^S,De=t[47]^I;S=a^(r<<1|n>>>31),I=u^(n<<1|r>>>31);let Pt=t[8]^S,Rt=t[9]^I,Be=t[18]^S,Mt=t[19]^I,Dt=t[28]^S,Le=t[29]^I,Bt=t[38]^S,Lt=t[39]^I,Fe=t[48]^S,Ft=t[49]^I,at=N,Se=R,ct=U<<4|D>>>28,ut=D<<4|U>>>28,_e=k<<3|z>>>29,lt=z<<3|k>>>29,ft=F<<9|H>>>23,Te=H<<9|F>>>23,dt=V<<18|q>>>14,ht=q<<18|V>>>14,Ie=C<<1|B>>>31,pt=B<<1|C>>>31,gt=g<<12|x>>>20,Ce=x<<12|g>>>20,mt=v<<10|l>>>22,yt=l<<10|v>>>22,xe=m<<13|d>>>19,vt=d<<13|m>>>19,bt=w<<2|_>>>30,Ne=_<<2|w>>>30,wt=y<<30|A>>>2,At=A<<30|y>>>2,Oe=T<<6|E>>>26,Et=E<<6|T>>>26,St=W<<11|M>>>21,Pe=M<<11|W>>>21,_t=Y<<15|P>>>17,Tt=P<<15|Y>>>17,Re=Q<<29|G>>>3,It=G<<29|Q>>>3,Ct=$<<28|ee>>>4,Me=ee<<28|$>>>4,xt=X<<23|ie>>>9,rt=ie<<23|X>>>9,nt=re<<25|ae>>>7,nn=ae<<25|re>>>7,sn=Z<<21|oe>>>11,on=oe<<21|Z>>>11,an=De<<24|Ot>>>8,cn=Ot<<24|De>>>8,un=Pt<<27|Rt>>>5,Ui=Rt<<27|Pt>>>5,ki=Be<<20|Mt>>>12,Vi=Mt<<20|Be>>>12,Hi=Le<<7|Dt>>>25,Gi=Dt<<7|Le>>>25,zi=Bt<<8|Lt>>>24,ji=Lt<<8|Bt>>>24,Qi=Fe<<14|Ft>>>18,Ki=Ft<<14|Fe>>>18;t[0]=at^~gt&St,t[1]=Se^~Ce&Pe,t[10]=Ct^~ki&_e,t[11]=Me^~Vi<,t[20]=Ie^~Oe&nt,t[21]=pt^~Et&nn,t[30]=un^~ct&mt,t[31]=Ui^~ut&yt,t[40]=wt^~xt&Hi,t[41]=At^~rt&Gi,t[2]=gt^~St&sn,t[3]=Ce^~Pe&on,t[12]=ki^~_e&xe,t[13]=Vi^~lt&vt,t[22]=Oe^~nt&zi,t[23]=Et^~nn&ji,t[32]=ct^~mt&_t,t[33]=ut^~yt&Tt,t[42]=xt^~Hi&ft,t[43]=rt^~Gi&Te,t[4]=St^~sn&Qi,t[5]=Pe^~on&Ki,t[14]=_e^~xe&Re,t[15]=lt^~vt&It,t[24]=nt^~zi&dt,t[25]=nn^~ji&ht,t[34]=mt^~_t&an,t[35]=yt^~Tt&cn,t[44]=Hi^~ft&bt,t[45]=Gi^~Te&Ne,t[6]=sn^~Qi&at,t[7]=on^~Ki&Se,t[16]=xe^~Re&Ct,t[17]=vt^~It&Me,t[26]=zi^~dt&Ie,t[27]=ji^~ht&pt,t[36]=_t^~an&un,t[37]=Tt^~cn&Ui,t[46]=ft^~bt&wt,t[47]=Te^~Ne&At,t[8]=Qi^~at>,t[9]=Ki^~Se&Ce,t[18]=Re^~Ct&ki,t[19]=It^~Me&Vi,t[28]=dt^~Ie&Oe,t[29]=ht^~pt&Et,t[38]=an^~un&ct,t[39]=cn^~Ui&ut,t[48]=bt^~wt&xt,t[49]=Ne^~At&rt,t[0]^=bN[e*2],t[1]^=bN[e*2+1]}}});var SN=L((VSe,EN)=>{h();var pg=AN();function Ju(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Ju.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};Ju.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(pg.p1600(this.state),this.count=0);return e};Ju.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};EN.exports=Ju});var Yd=L((GSe,_N)=>{h();_N.exports=vN()(SN())});var Nt=L(Nn=>{"use strict";h();var wJ=Nn&&Nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AJ=Nn&&Nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TN=Nn&&Nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wJ(e,t,r);return AJ(e,t),e},EJ=Nn&&Nn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.AddressComputer=Nn.Address=void 0;var Xu=TN(g2()),SJ=EJ((qt(),qe(jt))),Zu=Wp(),Y2=xr(),Pc=TN(Ve()),_J=Yp(),TJ=Yd(),J2=32,IJ="0".repeat(16),gg=class t{constructor(e,r){if(!e){this.publicKey=b.Buffer.from([]),this.hrp=r||Zu.LibraryConfig.DefaultAddressHrp;return}if(ArrayBuffer.isView(e)){if(e.length!=J2)throw new Pc.ErrAddressCannotCreate(e);this.publicKey=b.Buffer.from(e),this.hrp=r||Zu.LibraryConfig.DefaultAddressHrp;return}if(e instanceof t){if(r)throw new Pc.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");this.publicKey=e.publicKey,this.hrp=e.hrp;return}if(typeof e=="string"){if(t.isValidHex(e)){this.publicKey=b.Buffer.from(e,"hex"),this.hrp=r||Zu.LibraryConfig.DefaultAddressHrp;return}if(r)throw new Pc.ErrInvalidArgument("this variant of the Address constructor does not accept the 'hrp' argument");let{hrp:n,pubkey:i}=X2({value:e,allowCustomHrp:!1});this.publicKey=i,this.hrp=n;return}throw new Pc.ErrAddressCannotCreate(e)}static newFromBech32(e){let{hrp:r,pubkey:n}=X2({value:e,allowCustomHrp:!0});return new t(n,r)}static fromBech32(e){let{hrp:r,pubkey:n}=X2({value:e,allowCustomHrp:!1});return new t(n,r)}static newFromHex(e,r){if(!t.isValidHex(e))throw new Pc.ErrAddressCannotCreate(e);return new t(b.Buffer.from(e,"hex"),r)}static fromHex(e,r){return t.newFromHex(e,r)}static fromAddress(e){return new t(e)}static fromBuffer(e,r){return new t(e,r)}static fromString(e,r){return new t(e,r)}static isValidHex(e){return b.Buffer.from(e,"hex").length==J2}static empty(){return new t("")}static isValid(e){let r=Xu.decodeUnsafe(e),n=r?.prefix,i=r?b.Buffer.from(Xu.fromWords(r.words)):void 0;return!(n!==Zu.LibraryConfig.DefaultAddressHrp||i?.length!==J2)}hex(){return this.toHex()}toHex(){return this.isEmpty()?"":this.publicKey.toString("hex")}bech32(){return this.toBech32()}toBech32(){if(this.isEmpty())return"";let e=Xu.toWords(this.pubkey());return Xu.encode(this.hrp,e)}pubkey(){return this.getPublicKey()}getPublicKey(){return this.publicKey}getHrp(){return this.hrp}isEmpty(){return this.publicKey.length==0}equals(e){return e?this.publicKey.toString()==e.publicKey.toString():!1}toString(){return this.toBech32()}toJSON(){return{bech32:this.toBech32(),pubkey:this.toHex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.isSmartContract()}isSmartContract(){return this.toHex().startsWith(IJ)}};Nn.Address=gg;var Z2=class{constructor(e){this.numberOfShardsWithoutMeta=e||Y2.CURRENT_NUMBER_OF_SHARDS_WITHOUT_META}computeContractAddress(e,r){let n=b.Buffer.alloc(8,0),i=e.getPublicKey(),s=i.slice(30),o=b.Buffer.alloc(8),c=new SJ.default(r.toString()),a=_J.bigIntToBuffer(c);o.write(a.reverse().toString("hex"),"hex");let u=b.Buffer.concat([i,o]),f=TJ("keccak256").update(u).digest(),p=b.Buffer.from(Y2.WasmVirtualMachine,"hex"),S=b.Buffer.concat([n,p,f.slice(10,30),s]);return new gg(S)}getShardOfAddress(e){return this.getShardOfPubkey(e.getPublicKey(),this.numberOfShardsWithoutMeta)}getShardOfPubkey(e,r){let n=parseInt("11",2),i=parseInt("01",2),s=e[31];if(this.isPubkeyOfMetachain(e))return Y2.METACHAIN_ID;let o=s&n;return o>r-1&&(o=s&i),o}isPubkeyOfMetachain(e){let r=b.Buffer.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=b.Buffer.from(e).slice(0,r.length);return!!(r.equals(n)||b.Buffer.alloc(32).equals(b.Buffer.from(e)))}};Nn.AddressComputer=Z2;function X2(t){let e=t.value,r=t.allowCustomHrp,n,i;try{let s=Xu.decode(e);n=s.prefix,i=b.Buffer.from(Xu.fromWords(s.words))}catch(s){throw new Pc.ErrAddressCannotCreate(e,s)}if(!r&&n!=Zu.LibraryConfig.DefaultAddressHrp)throw new Pc.ErrAddressBadHrp(Zu.LibraryConfig.DefaultAddressHrp,n);return{hrp:n,pubkey:i}}});var fi=L(cr=>{"use strict";h();var CJ=cr&&cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xJ=cr&&cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NJ=cr&&cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CJ(e,t,r);return xJ(e,t),e};Object.defineProperty(cr,"__esModule",{value:!0});cr.isEmpty=cr.guardEmpty=cr.guardNotEmpty=cr.guardLength=cr.guardSameLength=cr.guardValueIsSetWithMessage=cr.guardValueIsSet=cr.guardTrue=void 0;var el=NJ(Ve());function OJ(t,e){if(!t)throw new el.ErrInvariantFailed(`[<${e}>] isn't true`)}cr.guardTrue=OJ;function PJ(t,e){IN(`${t} isn't set (null or undefined)`,e)}cr.guardValueIsSet=PJ;function IN(t,e){if(e==null||e===void 0)throw new el.ErrInvariantFailed(t)}cr.guardValueIsSetWithMessage=IN;function RJ(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new el.ErrInvariantFailed("arrays do not have the same length")}cr.guardSameLength=RJ;function MJ(t,e){let r=t.length||0;if(r!=e)throw new el.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}cr.guardLength=MJ;function DJ(t,e){if(eE(t))throw new el.ErrInvariantFailed(`${e} is empty`)}cr.guardNotEmpty=DJ;function BJ(t,e){if(!eE(t))throw new el.ErrInvariantFailed(`${e} is not empty`)}cr.guardEmpty=BJ;function eE(t){return t.isEmpty?t.isEmpty():t.length===0}cr.isEmpty=eE});var CN=L(mg=>{"use strict";h();Object.defineProperty(mg,"__esModule",{value:!0});mg.TypeFormula=void 0;var tE=class{constructor(e,r,n){this.name=e,this.typeParameters=r,this.metadata=n}toString(){let r=this.typeParameters.length>0?`<${this.typeParameters.map(i=>i.toString()).join(", ")}>`:"",n=`${this.name}${r}`;return this.metadata!==void 0?`${n}*${this.metadata}*`:n}};mg.TypeFormula=tE});var xN=L(yg=>{"use strict";h();Object.defineProperty(yg,"__esModule",{value:!0});yg.TypeFormulaParser=void 0;var tl=CN(),Ts=class t{parseExpression(e){e=e.trim();let r=this.tokenizeExpression(e).filter(s=>s!==t.COMMA),n=[];for(let s of r)if(this.isPunctuation(s))if(this.isEndOfTypeParameters(s)){let o=this.acquireTypeWithParameters(n);n.push(o)}else if(this.isBeginningOfTypeParameters(s))n.push(s);else throw new Error(`Unexpected token (punctuation): ${s}`);else n.push(s);if(n.length!==1)throw new Error(`Unexpected stack length at end of parsing: ${n.length}`);if(t.PUNCTUATION.includes(n[0]))throw new Error("Unexpected root element.");let i=n[0];if(i instanceof tl.TypeFormula)return i;if(typeof i=="string")return new tl.TypeFormula(i,[]);throw new Error(`Unexpected item on stack: ${i}`)}tokenizeExpression(e){let r=[],n="";for(let i of e)this.isPunctuation(i)?(n&&(r.push(n.trim()),n=""),r.push(i)):n+=i;return n&&r.push(n.trim()),r}acquireTypeWithParameters(e){let r=this.acquireTypeParameters(e),n=e.pop();if(n==="ManagedDecimal"||n==="ManagedDecimalSigned"){let s=r[0].name;return new tl.TypeFormula(n,[],s)}return new tl.TypeFormula(n,r.reverse())}acquireTypeParameters(e){let r=[];for(;;){let n=e.pop();if(n===void 0)throw new Error("Badly specified type parameters");if(this.isBeginningOfTypeParameters(n))break;if(n instanceof tl.TypeFormula)r.push(n);else if(typeof n=="string")r.push(new tl.TypeFormula(n,[]));else throw new Error(`Unexpected type parameter object in stack: ${n}`)}return r}isPunctuation(e){return t.PUNCTUATION.includes(e)}isEndOfTypeParameters(e){return e===t.END_TYPE_PARAMETERS}isBeginningOfTypeParameters(e){return e===t.BEGIN_TYPE_PARAMETERS}};yg.TypeFormulaParser=Ts;Ts.BEGIN_TYPE_PARAMETERS="<";Ts.END_TYPE_PARAMETERS=">";Ts.COMMA=",";Ts.PUNCTUATION=[Ts.COMMA,Ts.BEGIN_TYPE_PARAMETERS,Ts.END_TYPE_PARAMETERS]});var NN=L(vg=>{"use strict";h();Object.defineProperty(vg,"__esModule",{value:!0});vg.getJavascriptPrototypesInHierarchy=void 0;function LJ(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}vg.getJavascriptPrototypesInHierarchy=LJ});var pr=L(Or=>{"use strict";h();Object.defineProperty(Or,"__esModule",{value:!0});Or.NullType=Or.TypePlaceholder=Or.isTyped=Or.PrimitiveValue=Or.TypedValue=Or.CustomType=Or.PrimitiveType=Or.TypeCardinality=Or.Type=void 0;var rE=NN(),ON=fi(),ca=class t{constructor(e,r=[],n=Jd.fixed(1),i){ON.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n,this.metadata=i}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return rE.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){return this.isGenericType()||this.hasMetadata()?this.getFullNameForGeneric():`multiversx:types:${this.getName()}`}getFullNameForGeneric(){let e=this.getTypeParameters().length>0,r=e?`${this.getTypeParameters().map(i=>i.getFullyQualifiedName()).join(", ")}`:"",n=`multiversx:types:${this.getName()}`;return e&&(n=`${n}<${r}>`),this.metadata!==void 0&&(n=`${n}*${this.metadata}*`),n}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}getMetadata(){return this.metadata}isGenericType(){return this.typeParameters.length>0}hasMetadata(){return!!this.metadata}getFirstTypeParameter(){return ON.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return rE.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Or.Type=ca;ca.ClassName="Type";var Jd=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};Or.TypeCardinality=Jd;Jd.MaxCardinality=4096;var bg=class t extends ca{constructor(e){super(e)}getClassName(){return t.ClassName}};Or.PrimitiveType=bg;bg.ClassName="PrimitiveType";var wg=class t extends ca{getClassName(){return t.ClassName}};Or.CustomType=wg;wg.ClassName="CustomType";var Xd=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return rE.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Or.TypedValue=Xd;Xd.ClassName="TypedValue";var Ag=class t extends Xd{constructor(e){super(e)}getClassName(){return t.ClassName}};Or.PrimitiveValue=Ag;Ag.ClassName="PrimitiveValue";function FJ(t){return t.belongsToTypesystem!==void 0}Or.isTyped=FJ;var Eg=class t extends ca{constructor(){super("...")}getClassName(){return t.ClassName}};Or.TypePlaceholder=Eg;Eg.ClassName="TypePlaceholder";var Sg=class t extends ca{constructor(){super("?")}getClassName(){return t.ClassName}};Or.NullType=Sg;Sg.ClassName="NullType"});var Zd=L(_g=>{"use strict";h();Object.defineProperty(_g,"__esModule",{value:!0});_g.TypeExpressionParser=void 0;var qJ=xN(),UJ=Ve(),kJ=pr(),nE=class{constructor(){this.backingTypeFormulaParser=new qJ.TypeFormulaParser}parse(e){try{return this.doParse(e)}catch(r){throw new UJ.ErrTypingSystem(`Failed to parse type expression: ${e}. Error: ${r}`)}}doParse(e){let r=this.backingTypeFormulaParser.parseExpression(e);return this.typeFormulaToType(r)}typeFormulaToType(e){let r=e.typeParameters.map(n=>this.typeFormulaToType(n));return new kJ.Type(e.name,r,void 0,e.metadata)}};_g.TypeExpressionParser=nE});var sE=L(ua=>{"use strict";h();Object.defineProperty(ua,"__esModule",{value:!0});ua.EndpointParameterDefinition=ua.EndpointModifiers=ua.EndpointDefinition=void 0;var VJ=Zd(),PN="?",HJ="N / A",iE=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?PN:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>eh.fromJSON(s)),n=e.outputs.map(s=>eh.fromJSON(s)),i=new Tg(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};ua.EndpointDefinition=iE;var Tg=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};ua.EndpointModifiers=Tg;var eh=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new VJ.TypeExpressionParser().parse(e.type);return new t(e.name||PN,e.description||HJ,r)}};ua.EndpointParameterDefinition=eh});var rl=L(On=>{"use strict";h();var GJ=On&&On.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zJ=On&&On.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jJ=On&&On.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GJ(e,t,r);return zJ(e,t),e};Object.defineProperty(On,"__esModule",{value:!0});On.Fields=On.Field=On.FieldDefinition=void 0;var oE=jJ(Ve()),QJ=Zd(),aE=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new QJ.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};On.FieldDefinition=aE;var cE=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new oE.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new oE.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};On.Field=cE;var uE=class{static checkTyping(e,r){if(e.length!=r.length)throw new oE.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";h();Object.defineProperty(la,"__esModule",{value:!0});la.EnumValue=la.EnumVariantDefinition=la.EnumType=void 0;var KJ=Ve(),lE=fi(),Ig=rl(),MN=pr(),RN=256,Cg=class t extends MN.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let n=t.assignMissingDiscriminants(e.variants||[]).map(i=>xg.fromJSON(i));return new t(e.name,n)}static assignMissingDiscriminants(e){return e.every(n=>n.discriminant==null)?e.map((n,i)=>({...n,discriminant:i})):e}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return lE.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return lE.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};la.EnumType=Cg;Cg.ClassName="EnumType";var xg=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],lE.guardTrue(rIg.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Ig.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};la.EnumVariantDefinition=xg;var Ng=class t extends MN.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Ig.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Ig.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new KJ.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};la.EnumValue=Ng;Ng.ClassName="EnumValue"});var BN=L(nl=>{"use strict";h();Object.defineProperty(nl,"__esModule",{value:!0});nl.EventTopicDefinition=nl.EventDefinition=void 0;var WJ=Zd(),DN="?",fE=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?DN:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>Og.fromJSON(n));return new t(e.identifier,r)}};nl.EventDefinition=fE;var Og=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new WJ.TypeExpressionParser().parse(e.type);return new t({name:e.name||DN,type:r,indexed:e.indexed})}};nl.EventTopicDefinition=Og});var sl=L(il=>{"use strict";h();Object.defineProperty(il,"__esModule",{value:!0});il.Struct=il.StructType=void 0;var $J=Ve(),Pg=rl(),LN=pr(),Rg=class t extends LN.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Pg.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Pg.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};il.StructType=Rg;Rg.ClassName="StructType";var Mg=class t extends LN.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Pg.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new $J.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return Pg.Fields.equals(r,n)}};il.Struct=Mg;Mg.ClassName="Struct"});var al=L(ol=>{"use strict";h();Object.defineProperty(ol,"__esModule",{value:!0});ol.AddressValue=ol.AddressType=void 0;var YJ=Nt(),FN=pr(),rh=class t extends FN.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};ol.AddressType=rh;rh.ClassName="AddressType";var Dg=class t extends FN.PrimitiveValue{constructor(e){super(new rh),this.value=YJ.Address.newFromBech32(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ol.AddressValue=Dg;Dg.ClassName="AddressValue"});var Lg=L(cl=>{"use strict";h();Object.defineProperty(cl,"__esModule",{value:!0});cl.OptionalValue=cl.OptionalType=void 0;var JJ=fi(),nh=pr(),ih=class t extends nh.Type{constructor(e){super("Optional",[e],nh.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(nh.NullType.ClassName);return r||n}};cl.OptionalType=ih;ih.ClassName="OptionalType";var Bg=class t extends nh.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new ih(new nh.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return JJ.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};cl.OptionalValue=Bg;Bg.ClassName="OptionalValue"});var oh=L(ul=>{"use strict";h();Object.defineProperty(ul,"__esModule",{value:!0});ul.BooleanValue=ul.BooleanType=void 0;var qN=pr(),sh=class t extends qN.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};ul.BooleanType=sh;sh.ClassName="BooleanType";var Fg=class t extends qN.PrimitiveValue{constructor(e){super(new sh),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ul.BooleanValue=Fg;Fg.ClassName="BooleanValue"});var fa=L(ll=>{"use strict";h();Object.defineProperty(ll,"__esModule",{value:!0});ll.BytesValue=ll.BytesType=void 0;var UN=pr(),ah=class t extends UN.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};ll.BytesType=ah;ah.ClassName="BytesType";var qg=class t extends UN.PrimitiveValue{constructor(e){super(new ah),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=b.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=b.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};ll.BytesValue=qg;qg.ClassName="BytesValue"});var ch=L(fl=>{"use strict";h();Object.defineProperty(fl,"__esModule",{value:!0});fl.CodeMetadataValue=fl.CodeMetadataType=void 0;var kN=pr(),Ug=class extends kN.PrimitiveType{constructor(){super("CodeMetadata")}};fl.CodeMetadataType=Ug;var dE=class extends kN.PrimitiveValue{constructor(e){super(new Ug),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};fl.CodeMetadataValue=dE});var Vg=L(dl=>{"use strict";h();Object.defineProperty(dl,"__esModule",{value:!0});dl.CompositeValue=dl.CompositeType=void 0;var XJ=fi(),hE=pr(),uh=class t extends hE.Type{constructor(...e){super("Composite",e,hE.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};dl.CompositeType=uh;uh.ClassName="CompositeType";var kg=class t extends hE.TypedValue{constructor(e,r){super(e),XJ.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new uh(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.CollectionOfTypedValues=void 0;var pE=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";h();Object.defineProperty(Is,"__esModule",{value:!0});Is.List=Is.OptionValue=Is.ListType=Is.OptionType=void 0;var ZJ=fi(),eX=gE(),Mc=pr(),Rc=class t extends Mc.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Mc.NullType.ClassName);return r||n}};Is.OptionType=Rc;Rc.ClassName="OptionType";var lh=class t extends Mc.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};Is.ListType=lh;lh.ClassName="ListType";var Gg=class t extends Mc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Rc(new Mc.NullType);return new t(e)}static newMissingTyped(e){return new t(new Rc(e))}static newProvided(e){let r=new Rc(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return ZJ.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){return this.value?.equals(e.value)||!1}};Is.OptionValue=Gg;Gg.ClassName="OptionValue";var zg=class t extends Mc.TypedValue{constructor(e,r){super(e),this.backingCollection=new eX.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Mc.TypePlaceholder,[]);let r=e[0].getType(),n=new lh(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Is.List=zg;zg.ClassName="List"});var Kg=L(hl=>{"use strict";h();Object.defineProperty(hl,"__esModule",{value:!0});hl.ArrayVec=hl.ArrayVecType=void 0;var VN=fi(),tX=gE(),HN=pr(),jg=class t extends HN.Type{constructor(e,r){super("Array",[r]),VN.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};hl.ArrayVecType=jg;jg.ClassName="ArrayVecType";var Qg=class t extends HN.TypedValue{constructor(e,r){super(e),VN.guardLength(r,e.length),this.backingCollection=new tX.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};hl.ArrayVec=Qg;Qg.ClassName="ArrayVec"});var hh=L(pl=>{"use strict";h();Object.defineProperty(pl,"__esModule",{value:!0});pl.H256Value=pl.H256Type=void 0;var GN=pr(),dh=class t extends GN.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};pl.H256Type=dh;dh.ClassName="H256Type";var Wg=class t extends GN.PrimitiveValue{constructor(e){super(new dh),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};pl.H256Value=Wg;Wg.ClassName="H256Value"});var Yg=L(da=>{"use strict";h();var rX=da&&da.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(da,"__esModule",{value:!0});da.ManagedDecimalValue=da.ManagedDecimalType=void 0;var zN=rX((qt(),qe(jt))),jN=pr(),ph=class t extends jN.Type{constructor(e){super("ManagedDecimal",void 0,void 0,e)}getClassName(){return t.ClassName}getMetadata(){return this.metadata}isVariable(){return this.metadata=="usize"}};da.ManagedDecimalType=ph;ph.ClassName="ManagedDecimalType";var $g=class t extends jN.TypedValue{constructor(e,r,n=!1){super(new ph(n?"usize":r)),this.value=new zN.default(e),this.scale=r,this.variable=n}getClassName(){return t.ClassName}getScale(){return this.scale}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}equals(e){return this.getPrecision()!=e.getPrecision()?!1:new zN.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}};da.ManagedDecimalValue=$g;$g.ClassName="ManagedDecimalValue"});var Xg=L(ha=>{"use strict";h();var nX=ha&&ha.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ha,"__esModule",{value:!0});ha.ManagedDecimalSignedValue=ha.ManagedDecimalSignedType=void 0;var QN=nX((qt(),qe(jt))),KN=pr(),gh=class t extends KN.Type{constructor(e){super("ManagedDecimalSigned",void 0,void 0,e)}getClassName(){return t.ClassName}getMetadata(){return this.metadata}isVariable(){return this.metadata=="usize"}};ha.ManagedDecimalSignedType=gh;gh.ClassName="ManagedDecimalSignedType";var Jg=class t extends KN.TypedValue{constructor(e,r,n=!1){super(new gh(n?"usize":r)),this.value=new QN.default(e),this.scale=r,this.variable=n}getClassName(){return t.ClassName}getPrecision(){return this.value.toFixed(this.scale).replace(".","").length}getScale(){return this.scale}equals(e){return this.getPrecision()!=e.getPrecision()?!1:new QN.default(this.value).eq(e.value)}valueOf(){return this.value}toString(){return this.value.toFixed(this.scale)}isVariable(){return this.variable}};ha.ManagedDecimalSignedValue=Jg;Jg.ClassName="ManagedDecimalSignedValue"});var em=L(gl=>{"use strict";h();Object.defineProperty(gl,"__esModule",{value:!0});gl.NothingValue=gl.NothingType=void 0;var WN=pr(),mh=class t extends WN.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};gl.NothingType=mh;mh.ClassName="NothingType";var Zg=class t extends WN.PrimitiveValue{constructor(){super(new mh)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};gl.NothingValue=Zg;Zg.ClassName="NothingValue"});var Ch=L(Ee=>{"use strict";h();var iX=Ee&&Ee.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sX=Ee&&Ee.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oX=Ee&&Ee.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iX(e,t,r);return sX(e,t),e},aX=Ee&&Ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.BigIntValue=Ee.BigUIntValue=Ee.I64Value=Ee.U64Value=Ee.I32Value=Ee.U32Value=Ee.I16Value=Ee.U16Value=Ee.I8Value=Ee.U8Value=Ee.NumericalValue=Ee.BigIntType=Ee.BigUIntType=Ee.I64Type=Ee.U64Type=Ee.I32Type=Ee.U32Type=Ee.I16Type=Ee.U16Type=Ee.I8Type=Ee.U8Type=Ee.NumericalType=void 0;var cX=aX((qt(),qe(jt))),$N=oX(Ve()),YN=pr(),Pn=class t extends YN.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ee.NumericalType=Pn;Pn.ClassName="NumericalType";var yh=class t extends Pn{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ee.U8Type=yh;yh.ClassName="U8Type";var vh=class t extends Pn{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ee.I8Type=vh;vh.ClassName="I8Type";var bh=class t extends Pn{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ee.U16Type=bh;bh.ClassName="U16Type";var wh=class t extends Pn{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ee.I16Type=wh;wh.ClassName="I16Type";var Ah=class t extends Pn{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ee.U32Type=Ah;Ah.ClassName="U32Type";var Eh=class t extends Pn{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ee.I32Type=Eh;Eh.ClassName="I32Type";var Sh=class t extends Pn{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ee.U64Type=Sh;Sh.ClassName="U64Type";var _h=class t extends Pn{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ee.I64Type=_h;_h.ClassName="I64Type";var Th=class t extends Pn{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ee.BigUIntType=Th;Th.ClassName="BigUIntType";var Ih=class t extends Pn{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ee.BigIntType=Ih;Ih.ClassName="BigIntType";var Rn=class t extends YN.PrimitiveValue{constructor(e,r){if(super(e),typeof r=="bigint"&&(r=r.toString()),this.value=new cX.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new $N.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new $N.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ee.NumericalValue=Rn;Rn.ClassName="NumericalValue";var tm=class t extends Rn{constructor(e){super(new yh,e)}getClassName(){return t.ClassName}};Ee.U8Value=tm;tm.ClassName="U8Value";var rm=class t extends Rn{constructor(e){super(new vh,e)}getClassName(){return t.ClassName}};Ee.I8Value=rm;rm.ClassName="I8Value";var nm=class t extends Rn{constructor(e){super(new bh,e)}getClassName(){return t.ClassName}};Ee.U16Value=nm;nm.ClassName="U16Value";var im=class t extends Rn{constructor(e){super(new wh,e)}getClassName(){return t.ClassName}};Ee.I16Value=im;im.ClassName="I16Value";var sm=class t extends Rn{constructor(e){super(new Ah,e)}getClassName(){return t.ClassName}};Ee.U32Value=sm;sm.ClassName="U32Value";var om=class t extends Rn{constructor(e){super(new Eh,e)}getClassName(){return t.ClassName}};Ee.I32Value=om;om.ClassName="I32Value";var am=class t extends Rn{constructor(e){super(new Sh,e)}getClassName(){return t.ClassName}};Ee.U64Value=am;am.ClassName="U64Value";var cm=class t extends Rn{constructor(e){super(new _h,e)}getClassName(){return t.ClassName}};Ee.I64Value=cm;cm.ClassName="I64Value";var um=class t extends Rn{constructor(e){super(new Th,e)}getClassName(){return t.ClassName}};Ee.BigUIntValue=um;um.ClassName="BigUIntValue";var lm=class t extends Rn{constructor(e){super(new Ih,e)}getClassName(){return t.ClassName}};Ee.BigIntValue=lm;lm.ClassName="BigIntValue"});var dm=L(ml=>{"use strict";h();Object.defineProperty(ml,"__esModule",{value:!0});ml.StringValue=ml.StringType=void 0;var JN=pr(),xh=class t extends JN.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};ml.StringType=xh;xh.ClassName="StringType";var fm=class t extends JN.PrimitiveValue{constructor(e){super(new xh),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=b.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};ml.StringValue=fm;fm.ClassName="StringValue"});var vl=L(yl=>{"use strict";h();Object.defineProperty(yl,"__esModule",{value:!0});yl.TokenIdentifierValue=yl.TokenIdentifierType=void 0;var XN=pr(),uX="EGLD",Nh=class t extends XN.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};yl.TokenIdentifierType=Nh;Nh.ClassName="TokenIdentifierType";var hm=class t extends XN.PrimitiveValue{constructor(e){super(new Nh),this.value=e}static egld(){return new t(uX)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};yl.TokenIdentifierValue=hm;hm.ClassName="TokenIdentifierValue"});var gm=L(di=>{"use strict";h();var lX=di&&di.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fX=di&&di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dX=di&&di.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lX(e,t,r);return fX(e,t),e};Object.defineProperty(di,"__esModule",{value:!0});di.Tuple=di.TupleType=void 0;var hX=dX(Ve()),ZN=rl(),eO=sl(),Oh=class t extends eO.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new ZN.FieldDefinition(tO(i),"anonymous tuple field",n))}};di.TupleType=Oh;Oh.ClassName="TupleType";function tO(t){return`field${t}`}var pm=class t extends eO.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new hX.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Oh(...r),i=e.map((s,o)=>new ZN.Field(s,tO(o)));return new t(n,i)}};di.Tuple=pm;pm.ClassName="Tuple"});var vm=L(pa=>{"use strict";h();Object.defineProperty(pa,"__esModule",{value:!0});pa.VariadicValue=pa.CountedVariadicType=pa.VariadicType=void 0;var bl=pr(),Dc=class t extends bl.Type{constructor(e,r=!1){super("Variadic",[e],bl.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};pa.VariadicType=Dc;Dc.ClassName="VariadicType";var mm=class extends bl.Type{constructor(e){super("Variadic",[e],bl.TypeCardinality.variable())}getClassName(){return Dc.ClassName}};pa.CountedVariadicType=mm;mm.ClassName="VariadicType";var ym=class t extends bl.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Dc(new bl.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Dc(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";h();var pX=xs&&xs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gX=xs&&xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mX=xs&&xs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pX(e,t,r);return gX(e,t),e};Object.defineProperty(xs,"__esModule",{value:!0});xs.TypeMapper=void 0;var rO=mX(Ve()),yX=al(),mE=Lg(),vX=oh(),bX=fa(),wX=ch(),bm=Vg(),yE=th(),AX=rl(),nO=fh(),Cs=Kg(),EX=hh(),SX=Yg(),_X=Xg(),iO=em(),hi=Ch(),TX=dm(),sO=sl(),oO=vl(),ga=gm(),wm=vm(),vE=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new nO.OptionType(r[0])],["List",(...r)=>new nO.ListType(r[0])],["VarArgs",(...r)=>new wm.VariadicType(r[0])],["MultiResultVec",(...r)=>new wm.VariadicType(r[0])],["variadic",(...r)=>new wm.VariadicType(r[0])],["counted-variadic",(...r)=>new wm.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new mE.OptionalType(r[0])],["optional",(...r)=>new mE.OptionalType(r[0])],["OptionalResult",(...r)=>new mE.OptionalType(r[0])],["multi",(...r)=>new bm.CompositeType(...r)],["MultiArg",(...r)=>new bm.CompositeType(...r)],["MultiResult",(...r)=>new bm.CompositeType(...r)],["multi",(...r)=>new bm.CompositeType(...r)],["tuple",(...r)=>new ga.TupleType(...r)],["tuple2",(...r)=>new ga.TupleType(...r)],["tuple3",(...r)=>new ga.TupleType(...r)],["tuple4",(...r)=>new ga.TupleType(...r)],["tuple5",(...r)=>new ga.TupleType(...r)],["tuple6",(...r)=>new ga.TupleType(...r)],["tuple7",(...r)=>new ga.TupleType(...r)],["tuple8",(...r)=>new ga.TupleType(...r)],["array2",(...r)=>new Cs.ArrayVecType(2,r[0])],["array8",(...r)=>new Cs.ArrayVecType(8,r[0])],["array16",(...r)=>new Cs.ArrayVecType(16,r[0])],["array20",(...r)=>new Cs.ArrayVecType(20,r[0])],["array32",(...r)=>new Cs.ArrayVecType(32,r[0])],["array46",(...r)=>new Cs.ArrayVecType(46,r[0])],["array48",(...r)=>new Cs.ArrayVecType(48,r[0])],["array64",(...r)=>new Cs.ArrayVecType(64,r[0])],["array128",(...r)=>new Cs.ArrayVecType(128,r[0])],["array256",(...r)=>new Cs.ArrayVecType(256,r[0])],["ManagedDecimal",(...r)=>new SX.ManagedDecimalType(r)],["ManagedDecimalSigned",(...r)=>new _X.ManagedDecimalSignedType(r)]]),this.closedTypesMap=new Map([["u8",new hi.U8Type],["u16",new hi.U16Type],["u32",new hi.U32Type],["u64",new hi.U64Type],["U64",new hi.U64Type],["BigUint",new hi.BigUIntType],["i8",new hi.I8Type],["i16",new hi.I16Type],["i32",new hi.I32Type],["i64",new hi.I64Type],["Bigint",new hi.BigIntType],["BigInt",new hi.BigIntType],["bool",new vX.BooleanType],["bytes",new bX.BytesType],["Address",new yX.AddressType],["H256",new EX.H256Type],["utf-8 string",new TX.StringType],["TokenIdentifier",new oO.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new oO.TokenIdentifierType],["CodeMetadata",new wX.CodeMetadataType],["nothing",new iO.NothingType],["AsyncCall",new iO.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)r.getName()==="ManagedDecimal"||r.getName()==="ManagedDecimalSigned"?this.learnedTypesMap.set(`${r.getName()}_${r.getMetadata()}`,r):this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new rO.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=e.hasMetadata(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let s=this.closedTypesMap.get(e.getName());return s||(e.hasExactClass(yE.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(sO.StructType.ClassName)?this.mapStructType(e):r||n?this.mapGenericType(e):null)}learnType(e){if(e.getName()==="ManagedDecimal"||e.getName()==="ManagedDecimalSigned"){let r=`${e.getName()}_${e.getMetadata()}`;this.learnedTypesMap.delete(r),this.learnedTypesMap.set(r,e)}else{let r=e.getName();this.learnedTypesMap.delete(r),this.learnedTypesMap.set(r,e)}}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new sO.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new yE.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new yE.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new AX.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new rO.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return e.hasMetadata()?i(e.getMetadata()):i(...n)}};xs.TypeMapper=vE});var lO=L(Ns=>{"use strict";h();var IX=Ns&&Ns.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CX=Ns&&Ns.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xX=Ns&&Ns.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IX(e,t,r);return CX(e,t),e};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.AbiRegistry=void 0;var aO=xX(Ve()),Ph=fi(),wl=sE(),cO=th(),AE=BN(),uO=sl(),NX=bE(),OX="?",EE=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.upgradeConstructorDefinition=e.upgradeConstructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||OX,n=e.constructor||{},i=e.upgradeConstructor||{},s=e.endpoints||[],o=e.types||{},c=e.events||[],a=wl.EndpointDefinition.fromJSON({name:"constructor",...n}),u=wl.EndpointDefinition.fromJSON({name:"upgradeConstructor",...i}),f=s.map(R=>wl.EndpointDefinition.fromJSON(R)),p=[];for(let R in o){let D=o[R];if(D.type=="struct")p.push(uO.StructType.fromJSON({name:R,fields:D.fields}));else if(D.type=="enum"||D.type=="explicit-enum")p.push(cO.EnumType.fromJSON({name:R,variants:D.variants}));else throw new aO.ErrTypingSystem(`Cannot handle custom type: ${R}`)}let S=c.map(R=>AE.EventDefinition.fromJSON(R));return new t({name:r,constructorDefinition:a,upgradeConstructorDefinition:u,endpoints:f,customTypes:p,events:S}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return Ph.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(uO.StructType.ClassName));return Ph.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(cO.EnumType.ClassName));return Ph.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Ph.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return Ph.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new NX.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new aO.ErrTypingSystem("Did not re-map all custom types");let n=wE(this.constructorDefinition,e),i=this.upgradeConstructorDefinition?wE(this.upgradeConstructorDefinition,e):void 0,s=[];for(let a of this.endpoints)s.push(wE(a,e));let o=this.events.map(a=>PX(a,e));return new t({name:this.name,constructorDefinition:n,upgradeConstructorDefinition:i,endpoints:s,customTypes:r,events:o})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(c=>c.getName()==e.getName())>=0)return;for(let c of e.getNamesOfDependencies()){let a=r.find(u=>u.getName()==c);a&&this.mapCustomTypeDepthFirst(a,r,n,i)}let o=n.mapType(e);i.push(o)}};Ns.AbiRegistry=EE;function wE(t,e){let r=t.input.map(i=>new wl.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new wl.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new wl.EndpointDefinition(t.name,r,n,t.modifiers)}function PX(t,e){let r=t.inputs.map(n=>new AE.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new AE.EventDefinition(t.identifier,r)}});var dO=L(Al=>{"use strict";h();Object.defineProperty(Al,"__esModule",{value:!0});Al.createListOfTokenIdentifiers=Al.createListOfAddresses=void 0;var RX=al(),fO=fh(),MX=vl();function DX(t){let e=t.map(n=>new RX.AddressValue(n));return fO.List.fromItems(e)}Al.createListOfAddresses=DX;function BX(t){let e=t.map(n=>new MX.TokenIdentifierValue(n));return fO.List.fromItems(e)}Al.createListOfTokenIdentifiers=BX});var NO=L(ln=>{"use strict";h();var LX=ln&&ln.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FX=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qX=ln&&ln.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LX(e,t,r);return FX(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.onPrimitiveTypeSelect=ln.onPrimitiveValueSelect=ln.onTypedValueSelect=ln.onTypeSelect=void 0;var Em=qX(Ve()),hO=al(),pO=oh(),gO=fa(),mO=ch(),yO=th(),Am=fh(),vO=hh(),bO=Ch(),wO=em(),AO=sl(),EO=vl(),SO=gm(),_O=pr(),TO=Kg(),IO=dm(),CO=Yg(),xO=Xg();function UX(t,e){if(t.hasExactClass(Am.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Am.ListType.ClassName))return e.onList();if(t.hasExactClass(TO.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(_O.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(AO.StructType.ClassName))return e.onStruct();if(t.hasExactClass(SO.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(yO.EnumType.ClassName))return e.onEnum();if(t.hasExactClass(CO.ManagedDecimalType.ClassName))return e.onManagedDecimal();if(t.hasExactClass(xO.ManagedDecimalSignedType.ClassName))return e.onManagedDecimalSigned();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`type isn't known: ${t}`)}ln.onTypeSelect=UX;function kX(t,e){if(t.hasClassOrSuperclass(_O.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Am.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Am.List.ClassName))return e.onList();if(t.hasExactClass(TO.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(AO.Struct.ClassName))return e.onStruct();if(t.hasExactClass(SO.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(yO.EnumValue.ClassName))return e.onEnum();if(t.hasExactClass(CO.ManagedDecimalValue.ClassName))return e.onManagedDecimal();if(t.hasExactClass(xO.ManagedDecimalSignedValue.ClassName))return e.onManagedDecimalSigned();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`value isn't typed: ${t}`)}ln.onTypedValueSelect=kX;function VX(t,e){if(t.hasExactClass(pO.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(bO.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(hO.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(gO.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(IO.StringValue.ClassName))return e.onString();if(t.hasExactClass(vO.H256Value.ClassName))return e.onH256();if(t.hasExactClass(EO.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(mO.CodeMetadataValue.ClassName))return e.onCodeMetadata();if(t.hasExactClass(wO.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}ln.onPrimitiveValueSelect=VX;function HX(t,e){if(t.hasExactClass(pO.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(bO.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(hO.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(gO.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(IO.StringType.ClassName))return e.onString();if(t.hasExactClass(vO.H256Type.ClassName))return e.onH256();if(t.hasExactClass(EO.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(mO.CodeMetadataType.ClassName))return e.onCodeMetadata();if(t.hasExactClass(wO.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new Em.ErrTypingSystem(`type isn't a known primitive: ${t}`)}ln.onPrimitiveTypeSelect=HX});var dr=L(st=>{"use strict";h();var GX=st&&st.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jt=st&&st.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GX(e,t,r)};Object.defineProperty(st,"__esModule",{value:!0});Jt(lO(),st);Jt(al(),st);Jt(Lg(),st);Jt(oh(),st);Jt(fa(),st);Jt(ch(),st);Jt(Vg(),st);Jt(sE(),st);Jt(th(),st);Jt(dO(),st);Jt(rl(),st);Jt(fh(),st);Jt(Kg(),st);Jt(hh(),st);Jt(NO(),st);Jt(em(),st);Jt(Ch(),st);Jt(dm(),st);Jt(sl(),st);Jt(vl(),st);Jt(gm(),st);Jt(Zd(),st);Jt(bE(),st);Jt(pr(),st);Jt(vm(),st);Jt(Yg(),st);Jt(Xg(),st)});var PO=L(Os=>{"use strict";h();var zX=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jX=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QX=Os&&Os.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zX(e,t,r);return jX(e,t),e};Object.defineProperty(Os,"__esModule",{value:!0});Os.OptionValueBinaryCodec=void 0;var OO=QX(Ve()),Sm=dr(),SE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Sm.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new OO.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[Sm.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Sm.OptionValue(r);if(e[0]!=1)throw new OO.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new Sm.OptionValue(r,n)}encodeNested(e){return e.isSet()?b.Buffer.concat([b.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):b.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?b.Buffer.concat([b.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):b.Buffer.from([])}};Os.OptionValueBinaryCodec=SE});var RO=L(_m=>{"use strict";h();Object.defineProperty(_m,"__esModule",{value:!0});_m.AddressBinaryCodec=void 0;var KX=Nt(),WX=dr(),_E=class{decodeNested(e){let r=e.slice(0,32),n=new KX.Address(r);return[new WX.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};_m.AddressBinaryCodec=_E});var DO=L(Ps=>{"use strict";h();var $X=Ps&&Ps.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YX=Ps&&Ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JX=Ps&&Ps.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$X(e,t,r);return YX(e,t),e};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.BooleanBinaryCodec=void 0;var XX=JX(Ve()),MO=dr(),Rh=class t{decodeNested(e){let r=e.readUInt8(0);return[new MO.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new XX.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new MO.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?b.Buffer.from([t.TRUE]):b.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?b.Buffer.from([t.TRUE]):b.Buffer.from([])}};Ps.BooleanBinaryCodec=Rh;Rh.TRUE=1;Rh.FALSE=0});var El=L(Tm=>{"use strict";h();Object.defineProperty(Tm,"__esModule",{value:!0});Tm.SizeOfU32=void 0;Tm.SizeOfU32=4});var LO=L(Sl=>{"use strict";h();var ZX=Sl&&Sl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.NumericalBinaryCodec=void 0;var Mh=ZX((qt(),qe(jt))),TE=dr(),BO=El(),Er=na(),IE=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=BO.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),c=i+n;return[o,c]}decodeTopLevel(e,r){let n=Er.cloneBuffer(e);if(e.length==0)return new TE.NumericalValue(r,new Mh.default(0));if(!r.withSign||Er.isMsbZero(n)){let u=Er.bufferToBigInt(n);return new TE.NumericalValue(r,u)}Er.flipBufferBitsInPlace(n);let a=Er.bufferToBigInt(n).multipliedBy(new Mh.default(-1)).minus(new Mh.default(1));return new TE.NumericalValue(r,a)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=b.Buffer.alloc(BO.SizeOfU32);return n.writeUInt32BE(r.length),b.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return b.Buffer.alloc(r,0);if(!e.withSign){let o=Er.bigIntToBuffer(e.value),c=b.Buffer.alloc(r-o.length,0);return b.Buffer.concat([c,o])}if(e.value.isPositive()){let o=Er.bigIntToBuffer(e.value);Er.isMsbOne(o)&&(o=Er.prependByteToBuffer(o,0));let c=b.Buffer.alloc(r-o.length,0);return b.Buffer.concat([c,o])}let n=e.value.plus(new Mh.default(1)),i=Er.bigIntToBuffer(n);Er.flipBufferBitsInPlace(i),Er.isMsbZero(i)&&(i=Er.prependByteToBuffer(i,255));let s=b.Buffer.alloc(r-i.length,255);return b.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?b.Buffer.alloc(0):r?this.encodePrimitive(e):Er.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=Er.bigIntToBuffer(e.value);return Er.isMsbOne(i)&&(i=Er.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Mh.default(1)),n=Er.bigIntToBuffer(r);return Er.flipBufferBitsInPlace(n),Er.isMsbZero(n)&&(n=Er.prependByteToBuffer(n,255)),n}};Sl.NumericalBinaryCodec=IE});var FO=L(Im=>{"use strict";h();Object.defineProperty(Im,"__esModule",{value:!0});Im.H256BinaryCodec=void 0;var eZ=hh(),CE=class{decodeNested(e){let r=e.slice(0,32);return[new eZ.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Im.H256BinaryCodec=CE});var Nm=L(xm=>{"use strict";h();Object.defineProperty(xm,"__esModule",{value:!0});xm.BytesBinaryCodec=void 0;var qO=fa(),Cm=El(),xE=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(Cm.SizeOfU32,Cm.SizeOfU32+r);return[new qO.BytesValue(n),Cm.SizeOfU32+r]}decodeTopLevel(e){return new qO.BytesValue(e)}encodeNested(e){let r=b.Buffer.alloc(Cm.SizeOfU32);return r.writeUInt32BE(e.getLength()),b.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};xm.BytesBinaryCodec=xE});var kO=L(Om=>{"use strict";h();Object.defineProperty(Om,"__esModule",{value:!0});Om.TokenIdentifierCodec=void 0;var tZ=fa(),UO=vl(),rZ=Nm(),NE=class{constructor(){this.bytesCodec=new rZ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new UO.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new UO.TokenIdentifierValue(r.toString())}encodeNested(e){let r=tZ.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return b.Buffer.from(e.valueOf())}};Om.TokenIdentifierCodec=NE});var Rm=L(Pm=>{"use strict";h();Object.defineProperty(Pm,"__esModule",{value:!0});Pm.CodeMetadata=void 0;var _l=class t{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}static fromBytes(e){return t.fromBuffer(b.Buffer.from(e))}static fromBuffer(e){if(e.length{"use strict";h();Object.defineProperty(Mm,"__esModule",{value:!0});Mm.CodeMetadataCodec=void 0;var VO=Rm(),HO=ch(),OE=class{decodeNested(e){let r=VO.CodeMetadata.fromBuffer(e);return[new HO.CodeMetadataValue(r),length]}decodeTopLevel(e){let r=VO.CodeMetadata.fromBuffer(e);return new HO.CodeMetadataValue(r)}encodeNested(e){return e.valueOf().toBuffer()}encodeTopLevel(e){return e.valueOf().toBuffer()}};Mm.CodeMetadataCodec=OE});var jO=L(Dm=>{"use strict";h();Object.defineProperty(Dm,"__esModule",{value:!0});Dm.NothingCodec=void 0;var zO=dr(),PE=class{decodeNested(){return[new zO.NothingValue,0]}decodeTopLevel(){return new zO.NothingValue}encodeNested(){return b.Buffer.from([])}encodeTopLevel(){return b.Buffer.from([])}};Dm.NothingCodec=PE});var KO=L(Bm=>{"use strict";h();Object.defineProperty(Bm,"__esModule",{value:!0});Bm.StringBinaryCodec=void 0;var QO=dr(),nZ=fa(),iZ=Nm(),RE=class{constructor(){this.bytesBinaryCodec=new iZ.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new QO.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new QO.StringValue(e.toString())}encodeNested(e){let r=nZ.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return b.Buffer.from(e.valueOf())}};Bm.StringBinaryCodec=RE});var WO=L(Fm=>{"use strict";h();Object.defineProperty(Fm,"__esModule",{value:!0});Fm.PrimitiveBinaryCodec=void 0;var Lm=dr(),sZ=RO(),oZ=DO(),aZ=LO(),cZ=FO(),uZ=Nm(),lZ=kO(),fZ=GO(),dZ=jO(),hZ=KO(),ME=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new oZ.BooleanBinaryCodec,this.numericalCodec=new aZ.NumericalBinaryCodec,this.addressCodec=new sZ.AddressBinaryCodec,this.h256Codec=new cZ.H256BinaryCodec,this.bytesCodec=new uZ.BytesBinaryCodec,this.stringCodec=new hZ.StringBinaryCodec,this.tokenIdentifierCodec=new lZ.TokenIdentifierCodec,this.codeMetadataCodec=new fZ.CodeMetadataCodec,this.nothingCodec=new dZ.NothingCodec}decodeNested(e,r){return Lm.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return Lm.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onCodeMetadata:()=>this.codeMetadataCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return Lm.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),onCodeMetadata:()=>this.codeMetadataCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return Lm.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),onCodeMetadata:()=>this.codeMetadataCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};Fm.PrimitiveBinaryCodec=ME});var JO=L(qm=>{"use strict";h();Object.defineProperty(qm,"__esModule",{value:!0});qm.ListBinaryCodec=void 0;var $O=dr(),YO=El(),DE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,c=YO.SizeOfU32;e=o.slice(c);for(let a=0;a0;){let[c,a]=this.binaryCodec.decodeNested(e,n);i.push(c),o+=a,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new $O.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=b.Buffer.alloc(YO.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return b.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return b.Buffer.concat(r)}};qm.ListBinaryCodec=DE});var LE=L(Um=>{"use strict";h();Object.defineProperty(Um,"__esModule",{value:!0});Um.FieldsBinaryCodec=void 0;var pZ=dr(),BE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,c]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(c),i+=c;let a=new pZ.Field(o,s.name);n.push(a)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return b.Buffer.concat(r)}};Um.FieldsBinaryCodec=BE});var qE=L(km=>{"use strict";h();Object.defineProperty(km,"__esModule",{value:!0});km.StructBinaryCodec=void 0;var gZ=dr(),mZ=LE(),FE=class{constructor(e){this.fieldsCodec=new mZ.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new gZ.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};km.StructBinaryCodec=FE});var XO=L(Hm=>{"use strict";h();Object.defineProperty(Hm,"__esModule",{value:!0});Hm.EnumBinaryCodec=void 0;var Vm=dr(),yZ=LE(),UE=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new yZ.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[c,a]=this.fieldsCodec.decodeNested(e,o);return[new Vm.EnumValue(r,s,c),i+a]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Vm.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Vm.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return b.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Vm.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return b.Buffer.concat([o,i])}};Hm.EnumBinaryCodec=UE});var ZO=L(Gm=>{"use strict";h();Object.defineProperty(Gm,"__esModule",{value:!0});Gm.TupleBinaryCodec=void 0;var vZ=qE(),kE=class{constructor(e){this.structCodec=new vZ.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Gm.TupleBinaryCodec=kE});var eP=L(zm=>{"use strict";h();Object.defineProperty(zm,"__esModule",{value:!0});zm.ArrayVecBinaryCodec=void 0;var bZ=dr(),VE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let c=0;c{"use strict";h();var wZ=Il&&Il.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Il,"__esModule",{value:!0});Il.ManagedDecimalCodec=void 0;var AZ=wZ((qt(),qe(jt))),Tl=dr(),EZ=na(),SZ=El(),HE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=e.readUInt32BE(0),i=e.slice(0,n);return[this.decodeTopLevel(i,r),n]}decodeTopLevel(e,r){if(e.length===0)return new Tl.ManagedDecimalValue(new AZ.default(0),0);if(r.isVariable()){let o=e.length-SZ.SizeOfU32,[c]=this.binaryCodec.decodeNested(e.slice(0,o),new Tl.BigUIntType),a=e.readUInt32BE(o);return new Tl.ManagedDecimalValue(c.valueOf().shiftedBy(-a),a)}let n=EZ.bufferToBigInt(e),i=r.getMetadata(),s=i!=="usize"?parseInt(i.toString()):0;return new Tl.ManagedDecimalValue(n.shiftedBy(-s),s)}encodeNested(e){let r=[],n=new Tl.BigUIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(r.push(b.Buffer.from(this.binaryCodec.encodeNested(n))),r.push(b.Buffer.from(this.binaryCodec.encodeNested(new Tl.U32Value(e.getScale()))))):r.push(this.binaryCodec.encodeTopLevel(n)),b.Buffer.concat(r)}encodeTopLevel(e){return this.encodeNested(e)}};Il.ManagedDecimalCodec=HE});var rP=L(xl=>{"use strict";h();var _Z=xl&&xl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xl,"__esModule",{value:!0});xl.ManagedDecimalSignedCodec=void 0;var TZ=_Z((qt(),qe(jt))),Cl=dr(),IZ=na(),CZ=El(),GE=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=e.readUInt32BE(0),i=e.slice(0,n);return[this.decodeTopLevel(i,r),n]}decodeTopLevel(e,r){if(e.length===0)return new Cl.ManagedDecimalSignedValue(new TZ.default(0),0);if(r.isVariable()){let o=e.length-CZ.SizeOfU32,[c]=this.binaryCodec.decodeNested(e.slice(0,o),new Cl.BigIntType),a=e.readUInt32BE(o);return new Cl.ManagedDecimalSignedValue(c.valueOf().shiftedBy(-a),a)}let n=IZ.bufferToBigInt(e),i=r.getMetadata(),s=i!=="usize"?parseInt(i.toString()):0;return new Cl.ManagedDecimalSignedValue(n.shiftedBy(-s),s)}encodeNested(e){let r=[],n=new Cl.BigIntValue(e.valueOf().shiftedBy(e.getScale()));return e.isVariable()?(r.push(b.Buffer.from(this.binaryCodec.encodeNested(n))),r.push(b.Buffer.from(this.binaryCodec.encodeNested(new Cl.U32Value(e.getScale()))))):r.push(b.Buffer.from(this.binaryCodec.encodeTopLevel(n))),b.Buffer.concat(r)}encodeTopLevel(e){return this.encodeNested(e)}};xl.ManagedDecimalSignedCodec=GE});var jE=L(pi=>{"use strict";h();var xZ=pi&&pi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NZ=pi&&pi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OZ=pi&&pi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xZ(e,t,r);return NZ(e,t),e};Object.defineProperty(pi,"__esModule",{value:!0});pi.BinaryCodecConstraints=pi.BinaryCodec=void 0;var nP=OZ(Ve()),jm=dr(),iP=fi(),PZ=PO(),RZ=WO(),MZ=JO(),DZ=qE(),BZ=XO(),LZ=ZO(),FZ=eP(),qZ=tP(),UZ=rP(),zE=class{constructor(e=null){this.constraints=e||new Qm,this.optionCodec=new PZ.OptionValueBinaryCodec(this),this.listCodec=new MZ.ListBinaryCodec(this),this.arrayCodec=new FZ.ArrayVecBinaryCodec(this),this.primitiveCodec=new RZ.PrimitiveBinaryCodec(this),this.structCodec=new DZ.StructBinaryCodec(this),this.tupleCodec=new LZ.TupleBinaryCodec(this),this.enumCodec=new BZ.EnumBinaryCodec(this),this.managedDecimalCodec=new qZ.ManagedDecimalCodec(this),this.managedDecimalSignedCodec=new UZ.ManagedDecimalSignedCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),jm.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r),onManagedDecimal:()=>this.managedDecimalCodec.decodeTopLevel(e,r),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=jm.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r),onManagedDecimal:()=>this.managedDecimalCodec.decodeNested(e,r),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return iP.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),jm.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),onManagedDecimal:()=>this.managedDecimalCodec.encodeNested(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeNested(e)})}encodeTopLevel(e){return iP.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),jm.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),onManagedDecimal:()=>this.managedDecimalCodec.encodeTopLevel(e),onManagedDecimalSigned:()=>this.managedDecimalSignedCodec.encodeTopLevel(e)})}};pi.BinaryCodec=zE;var Qm=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new nP.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new nP.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};pi.BinaryCodecConstraints=Qm});var sP=L(gi=>{"use strict";h();var kZ=gi&&gi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gi,"__esModule",{value:!0});gi.decodeBigNumber=gi.decodeString=gi.decodeBool=gi.decodeUnsignedNumber=void 0;var VZ=kZ((qt(),qe(jt))),Km=dr(),HZ=jE(),Wm=new HZ.BinaryCodec;function GZ(t){let e=Wm.decodeTopLevel(t,new Km.BigUIntType);return Number(e.valueOf())}gi.decodeUnsignedNumber=GZ;function zZ(t){return!!Wm.decodeTopLevel(t,new Km.BooleanType).valueOf()}gi.decodeBool=zZ;function jZ(t){let e=Wm.decodeTopLevel(t,new Km.BytesType);return String(e.valueOf())}gi.decodeString=jZ;function QZ(t){let e=Wm.decodeTopLevel(t,new Km.BigUIntType);return new VZ.default(e.valueOf())}gi.decodeBigNumber=QZ});var QE=L(ma=>{"use strict";h();var KZ=ma&&ma.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oP=ma&&ma.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KZ(e,t,r)};Object.defineProperty(ma,"__esModule",{value:!0});oP(jE(),ma);oP(sP(),ma)});var Nl=L($m=>{"use strict";h();Object.defineProperty($m,"__esModule",{value:!0});$m.ArgSerializer=void 0;var aP=xr(),WZ=QE(),cP=dr(),KE=Lg(),WE=Vg(),$E=vm(),$Z={codec:new WZ.BinaryCodec},YE=class{constructor(e){e={...$Z,...e},this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(aP.ARGUMENTS_SEPARATOR).map(r=>b.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let p=0;p=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(aP.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(KE.OptionalValue.ClassName)){let a=o;a.isSet()&&i(a.getTypedValue());return}if(o.hasExactClass($E.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(WE.CompositeValue.ClassName)){let a=o;for(let u of a.getItems())i(u);return}let c=r.codec.encodeTopLevel(o);n.push(c)}function s(o){if(o.getType().isCounted){let a=new cP.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(a))}for(let a of o.getItems())i(a)}return n}};$m.ArgSerializer=YE});var JE=L((n6e,uP)=>{h();Co.notEqual=JZ;Co.notOk=XZ;Co.equal=YZ;Co.ok=Co;uP.exports=Co;function YZ(t,e,r){Co(t==e,r)}function JZ(t,e,r){Co(t!=e,r)}function XZ(t,e){Co(!t,e)}function Co(t,e){if(!t)throw new Error(e||"AssertionError")}});var fP=L((s6e,lP)=>{h();lP.exports=XE;XE.supported=typeof WebAssembly<"u";function XE(t){if(!XE.supported)return null;var e=t&&t.imports,r=ZZ("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(a){i.exports.memory.grow(Math.ceil(Math.abs(a-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(a){if(i.exports)return a();if(n){n.then(a.bind(null,null)).catch(a);return}try{if(t&&t.async)throw new Error("async");c({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(c)}o(a)}function c(a){i.exports=a.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function ZZ(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(eee)):new(wo()).Buffer(t,"base64")}function eee(t){return t.charCodeAt(0)}});var vP=L((u6e,Ms)=>{h();var Rs=JE(),tr=fP()(),xo=64,Ym=[];Ms.exports=mi;var dP=Ms.exports.BYTES_MIN=16,hP=Ms.exports.BYTES_MAX=64,a6e=Ms.exports.BYTES=32,pP=Ms.exports.KEYBYTES_MIN=16,gP=Ms.exports.KEYBYTES_MAX=64,c6e=Ms.exports.KEYBYTES=32,mP=Ms.exports.SALTBYTES=16,yP=Ms.exports.PERSONALBYTES=16;function mi(t,e,r,n,i){if(!(this instanceof mi))return new mi(t,e,r,n,i);if(!(tr&&tr.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(Rs(t>=dP,"digestLength must be at least "+dP+", was given "+t),Rs(t<=hP,"digestLength must be at most "+hP+", was given "+t),e!=null&&Rs(e.length>=pP,"key must be at least "+pP+", was given "+e.length),e!=null&&Rs(e.length<=gP,"key must be at least "+gP+", was given "+e.length),r!=null&&Rs(r.length===mP,"salt must be exactly "+mP+", was given "+r.length),n!=null&&Rs(n.length===yP,"personal must be exactly "+yP+", was given "+n.length)),Ym.length||(Ym.push(xo),xo+=216),this.digestLength=t,this.finalized=!1,this.pointer=Ym.pop(),tr.memory.fill(0,0,64),tr.memory[0]=this.digestLength,tr.memory[1]=e?e.length:0,tr.memory[2]=1,tr.memory[3]=1,r&&tr.memory.set(r,32),n&&tr.memory.set(n,48),this.pointer+216>tr.memory.length&&tr.realloc(this.pointer+216),tr.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),tr.memory.fill(0,xo,xo+e.length),tr.memory[this.pointer+200]=128)}mi.prototype.update=function(t){return Rs(this.finalized===!1,"Hash instance finalized"),Rs(t,"input must be TypedArray or Buffer"),xo+t.length>tr.memory.length&&tr.realloc(xo+t.length),tr.memory.set(t,xo),tr.exports.blake2b_update(this.pointer,xo,xo+t.length),this};mi.prototype.digest=function(t){if(Rs(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Ym.push(this.pointer),tr.exports.blake2b_final(this.pointer),!t||t==="binary")return tr.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return ree(tr.memory,this.pointer+128,this.digestLength);Rs(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{h();var ba=JE(),Bh=vP();function Jm(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function bP(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function IP(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function ya(t,e,r,n,i,s){var o=Dh[i],c=Dh[i+1],a=Dh[s],u=Dh[s+1];Jm(ze,t,e),bP(ze,t,o,c);var f=ze[n]^ze[t],p=ze[n+1]^ze[t+1];ze[n]=p,ze[n+1]=f,Jm(ze,r,n),f=ze[e]^ze[r],p=ze[e+1]^ze[r+1],ze[e]=f>>>24^p<<8,ze[e+1]=p>>>24^f<<8,Jm(ze,t,e),bP(ze,t,a,u),f=ze[n]^ze[t],p=ze[n+1]^ze[t+1],ze[n]=f>>>16^p<<16,ze[n+1]=p>>>16^f<<16,Jm(ze,r,n),f=ze[e]^ze[r],p=ze[e+1]^ze[r+1],ze[e]=p>>>31^f<<1,ze[e+1]=f>>>31^p<<1}var CP=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),iee=[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],fn=new Uint8Array(iee.map(function(t){return t*2})),ze=new Uint32Array(32),Dh=new Uint32Array(32);function xP(t,e){var r=0;for(r=0;r<16;r++)ze[r]=t.h[r],ze[r+16]=CP[r];for(ze[24]=ze[24]^t.t,ze[25]=ze[25]^t.t/4294967296,e&&(ze[28]=~ze[28],ze[29]=~ze[29]),r=0;r<32;r++)Dh[r]=IP(t.b,4*r);for(r=0;r<12;r++)ya(0,8,16,24,fn[r*16+0],fn[r*16+1]),ya(2,10,18,26,fn[r*16+2],fn[r*16+3]),ya(4,12,20,28,fn[r*16+4],fn[r*16+5]),ya(6,14,22,30,fn[r*16+6],fn[r*16+7]),ya(0,10,20,30,fn[r*16+8],fn[r*16+9]),ya(2,12,22,24,fn[r*16+10],fn[r*16+11]),ya(4,14,16,26,fn[r*16+12],fn[r*16+13]),ya(6,8,18,28,fn[r*16+14],fn[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^ze[r]^ze[r+16]}var va=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 Ol(t,e,r,n){va.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,va[0]=t,e&&(va[1]=e.length),va[2]=1,va[3]=1,r&&va.set(r,32),n&&va.set(n,48);for(var i=0;i<16;i++)this.h[i]=CP[i]^IP(va,i*4);e&&(NP(this,e),this.c=128)}Ol.prototype.update=function(t){return ba(t!=null,"input must be Uint8Array or Buffer"),NP(this,t),this};Ol.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return ba(e.length>=this.outlen,"out must have at least outlen bytes of space"),see(this,e),t==="hex"?oee(e):e};Ol.prototype.final=Ol.prototype.digest;Ol.ready=function(t){Bh.ready(function(){t()})};function NP(t,e){for(var r=0;r>2]>>8*(r&3);return e}function oee(t){for(var e="",r=0;r=wP,"outlen must be at least "+wP+", was given "+e),ba(e<=AP,"outlen must be at most "+AP+", was given "+e),r!=null&&ba(r.length>=EP,"key must be at least "+EP+", was given "+r.length),r!=null&&ba(r.length<=SP,"key must be at most "+SP+", was given "+r.length),n!=null&&ba(n.length===_P,"salt must be exactly "+_P+", was given "+n.length),i!=null&&ba(i.length===TP,"personal must be exactly "+TP+", was given "+i.length)),new OP(e,r,n,i)};Mn.exports.ready=function(t){Bh.ready(function(){t()})};Mn.exports.WASM_SUPPORTED=Bh.SUPPORTED;Mn.exports.WASM_LOADED=!1;var wP=Mn.exports.BYTES_MIN=16,AP=Mn.exports.BYTES_MAX=64,f6e=Mn.exports.BYTES=32,EP=Mn.exports.KEYBYTES_MIN=16,SP=Mn.exports.KEYBYTES_MAX=64,d6e=Mn.exports.KEYBYTES=32,_P=Mn.exports.SALTBYTES=16,TP=Mn.exports.PERSONALBYTES=16;Bh.ready(function(t){t||(Mn.exports.WASM_LOADED=!0,OP=Bh)})});var PP=L(Xm=>{"use strict";h();Object.defineProperty(Xm,"__esModule",{value:!0});Xm.Code=void 0;var cee=ZE(),uee=32,eS=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}static fromHex(e){return new t(e)}toString(){return this.hex}valueOf(){return b.Buffer.from(this.hex,"hex")}computeHash(){let e=cee(uee).update(this.valueOf()).digest();return b.Buffer.from(e)}};Xm.Code=eS});var rS=L(Ds=>{"use strict";h();var lee=Ds&&Ds.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fee=Ds&&Ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dee=Ds&&Ds.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lee(e,t,r);return fee(e,t),e};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.ContractFunction=void 0;var hee=dee(Ve()),tS=class t{constructor(e){if(this.name=e,e==null)throw new hee.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};Ds.ContractFunction=tS});var iS=L(Zm=>{"use strict";h();Object.defineProperty(Zm,"__esModule",{value:!0});Zm.Compatibility=void 0;var pee=Nt(),nS=class{static guardAddressIsSetAndNonZero(e,r,n){!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==pee.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`)}};Zm.Compatibility=nS});var No=L(e1=>{"use strict";h();Object.defineProperty(e1,"__esModule",{value:!0});e1.TransactionPayload=void 0;var sS=class t{constructor(e){this.data=b.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=b.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>b.Buffer.from(e,"hex"))}length(){return b.Buffer.from(this.data).length}};e1.TransactionPayload=sS});var Pl=L(t1=>{"use strict";h();Object.defineProperty(t1,"__esModule",{value:!0});t1.TransactionBuilder=void 0;var gee=xr(),mee=Dn(),yee=No(),oS=class{constructor(e){this.config=e.config,this.sender=e.sender,this.receiver=e.receiver,this.dataParts=e.dataParts,this.providedGasLimit=e.gasLimit,this.addDataMovementGas=e.addDataMovementGas,this.amount=e.amount}computeGasLimit(e){return this.addDataMovementGas?this.config.minGasLimit+this.config.gasLimitPerByte*BigInt(e.length())+this.providedGasLimit:this.providedGasLimit}buildTransactionPayload(){let e=this.dataParts.join(gee.ARGUMENTS_SEPARATOR);return new yee.TransactionPayload(e)}build(){let e=this.buildTransactionPayload(),r=this.computeGasLimit(e);return new mee.Transaction({sender:this.sender.bech32(),receiver:this.receiver.bech32(),gasLimit:r,value:this.amount||0n,data:e.valueOf(),chainID:this.config.chainID})}};t1.TransactionBuilder=oS});var RP=L(r1=>{"use strict";h();Object.defineProperty(r1,"__esModule",{value:!0});r1.DelegationTransactionsFactory=void 0;var vee=Nt(),bee=xr(),wee=Ve(),Wn=yi(),Bn=Pl(),aS=class{constructor(e){this.config=e.config,this.argSerializer=new Wn.ArgSerializer,this.delegationManagerAddress=vee.Address.fromHex(bee.DELEGATION_MANAGER_SC_ADDRESS_HEX,this.config.addressHrp)}createTransactionForNewDelegationContract(e){let r=["createNewDelegationContract",...this.argSerializer.valuesToStrings([new Wn.BigUIntValue(e.totalDelegationCap),new Wn.BigUIntValue(e.serviceFee)])],n=this.config.gasLimitCreateDelegationContract+this.config.additionalGasLimitForDelegationOperations;return new Bn.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.delegationManagerAddress,dataParts:r,gasLimit:n,addDataMovementGas:!0,amount:e.amount}).build()}createTransactionForAddingNodes(e){if(e.publicKeys.length!==e.signedMessages.length)throw new wee.Err("The number of public keys should match the number of signed messages");let r=e.signedMessages.map(o=>new Wn.BytesValue(b.Buffer.from(o))),n=this.argSerializer.valuesToStrings(r),i=e.publicKeys.length,s=["addNodes"];for(let o=0;o{h();var MP=(qt(),qe(jt)),DP=BP.exports;(function(){"use strict";function t(u){return u<10?"0"+u:u}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,i,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o;function c(u){return r.lastIndex=0,r.test(u)?'"'+u.replace(r,function(f){var p=s[f];return typeof p=="string"?p:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+u+'"'}function a(u,f){var p,S,I,N,R=n,D,U=f[u],k=U!=null&&(U instanceof MP||MP.isBigNumber(U));switch(U&&typeof U=="object"&&typeof U.toJSON=="function"&&(U=U.toJSON(u)),typeof o=="function"&&(U=o.call(f,u,U)),typeof U){case"string":return k?U:c(U);case"number":return isFinite(U)?String(U):"null";case"boolean":case"null":case"bigint":return String(U);case"object":if(!U)return"null";if(n+=i,D=[],Object.prototype.toString.apply(U)==="[object Array]"){for(N=U.length,p=0;p{h();var Xp=null,JK=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,XK=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,ZK=function(t){"use strict";var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(t!=null){if(t.strict===!0&&(e.strict=!0),t.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=t.alwaysParseAsBig===!0?t.alwaysParseAsBig:!1,e.useNativeBigInt=t.useNativeBigInt===!0?t.useNativeBigInt:!1,typeof t.constructorAction<"u")if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve")e.constructorAction=t.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`);if(typeof t.protoAction<"u")if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve")e.protoAction=t.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}var r,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` -`,r:"\r",t:" "},s,o=function(N){throw{name:"SyntaxError",message:N,at:r,text:s}},u=function(N){return N&&N!==n&&o("Expected '"+N+"' instead of '"+n+"'"),n=s.charAt(r),r+=1,n},a=function(){var N,P="";for(n==="-"&&(P="-",u("-"));n>="0"&&n<="9";)P+=n,u();if(n===".")for(P+=".";u()&&n>="0"&&n<="9";)P+=n;if(n==="e"||n==="E")for(P+=n,u(),(n==="-"||n==="+")&&(P+=n,u());n>="0"&&n<="9";)P+=n,u();if(N=+P,!isFinite(N))o("Bad number");else return Xp==null&&(Xp=(nr(),xe(hr))),P.length>15?e.storeAsString?P:e.useNativeBigInt?BigInt(P):new Xp(P):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(N):new Xp(N):N},c=function(){var N,P,V="",U;if(n==='"')for(var Q=r;u();){if(n==='"')return r-1>Q&&(V+=s.substring(Q,r-1)),u(),V;if(n==="\\"){if(r-1>Q&&(V+=s.substring(Q,r-1)),u(),n==="u"){for(U=0,P=0;P<4&&(N=parseInt(u(),16),!!isFinite(N));P+=1)U=U*16+N;V+=String.fromCharCode(U)}else if(typeof i[n]=="string")V+=i[n];else break;Q=r}}o("Bad string")},f=function(){for(;n&&n<=" ";)u()},d=function(){switch(n){case"t":return u("t"),u("r"),u("u"),u("e"),!0;case"f":return u("f"),u("a"),u("l"),u("s"),u("e"),!1;case"n":return u("n"),u("u"),u("l"),u("l"),null}o("Unexpected '"+n+"'")},w,A=function(){var N=[];if(n==="["){if(u("["),f(),n==="]")return u("]"),N;for(;n;){if(N.push(w()),f(),n==="]")return u("]"),N;u(","),f()}}o("Bad array")},_=function(){var N,P=Object.create(null);if(n==="{"){if(u("{"),f(),n==="}")return u("}"),P;for(;n;){if(N=c(),f(),u(":"),e.strict===!0&&Object.hasOwnProperty.call(P,N)&&o('Duplicate key "'+N+'"'),JK.test(N)===!0?e.protoAction==="error"?o("Object contains forbidden prototype property"):e.protoAction==="ignore"?w():P[N]=w():XK.test(N)===!0?e.constructorAction==="error"?o("Object contains forbidden constructor property"):e.constructorAction==="ignore"?w():P[N]=w():P[N]=w(),f(),n==="}")return u("}"),P;u(","),f()}}o("Bad object")};return w=function(){switch(f(),n){case"{":return _();case"[":return A();case'"':return c();case"-":return a();default:return n>="0"&&n<="9"?a():d()}},function(N,P){var V;return s=N+"",r=0,n=" ",V=w(),f(),n&&o("Syntax error"),typeof P=="function"?function U(Q,L){var k,H,q=Q[L];return q&&typeof q=="object"&&Object.keys(q).forEach(function(v){H=U(q,v),H!==void 0?q[v]=H:delete q[v]}),P.call(Q,L,q)}({"":V},""):V}};CO.exports=ZK});var mE=D((b1e,Zp)=>{h();var xO=TO().stringify,OO=NO();Zp.exports=function(t){return{parse:OO(t),stringify:xO}};Zp.exports.parse=OO();Zp.exports.stringify=xO});var PO=D(gc=>{"use strict";h();var eW=gc&&gc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gc,"__esModule",{value:!0});gc.RelayedTransactionsFactory=void 0;var tW=eW((nr(),xe(hr))),e0=ke(),t0=Ie(),zf=Vn(),DO=en(),rW=mE(),yE=class{constructor(e){this.config=e.config}createRelayedV1Transaction(e){if(!e.innerTransaction.gasLimit)throw new t0.ErrInvalidInnerTransaction("The gas limit is not set for the inner transaction");if(!e.innerTransaction.signature.length)throw new t0.ErrInvalidInnerTransaction("The inner transaction is not signed");let r=this.prepareInnerTransactionForRelayedV1(e.innerTransaction),n=`relayedTx@${p.Buffer.from(r).toString("hex")}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=this.config.minGasLimit+i+e.innerTransaction.gasLimit;return new DO.Transaction({chainID:this.config.chainID,sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,gasLimit:s,data:p.Buffer.from(n)})}createRelayedV2Transaction(e){if(e.innerTransaction.gasLimit)throw new t0.ErrInvalidInnerTransaction("The gas limit should not be set for the inner transaction");if(!e.innerTransaction.signature.length)throw new t0.ErrInvalidInnerTransaction("The inner transaction is not signed");let{argumentsString:r}=new zf.ArgSerializer().valuesToString([new zf.AddressValue(e0.Address.fromBech32(e.innerTransaction.receiver)),new zf.U64Value(new tW.default(e.innerTransaction.nonce.toString())),new zf.BytesValue(p.Buffer.from(e.innerTransaction.data)),new zf.BytesValue(p.Buffer.from(e.innerTransaction.signature))]),n=`relayedTxV2@${r}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=e.innerTransactionGasLimit+this.config.minGasLimit+i;return new DO.Transaction({sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,value:0n,gasLimit:s,chainID:this.config.chainID,data:p.Buffer.from(n),version:e.innerTransaction.version,options:e.innerTransaction.options})}prepareInnerTransactionForRelayedV1(e){let r={nonce:e.nonce,sender:e0.Address.fromBech32(e.sender).pubkey().toString("base64"),receiver:e0.Address.fromBech32(e.receiver).pubkey().toString("base64"),value:e.value,gasPrice:e.gasPrice,gasLimit:e.gasLimit,data:p.Buffer.from(e.data).toString("base64"),signature:p.Buffer.from(e.signature).toString("base64"),chainID:p.Buffer.from(e.chainID).toString("base64"),version:e.version,options:e.options.valueOf()==0?void 0:e.options,guardian:e.guardian?e0.Address.fromBech32(e.guardian).pubkey().toString("base64"):void 0,guardianSignature:e.guardianSignature.length?p.Buffer.from(e.guardianSignature).toString("base64"):void 0,sndUserName:e.senderUsername?p.Buffer.from(e.senderUsername).toString("base64"):void 0,rcvUserName:e.receiverUsername?p.Buffer.from(e.receiverUsername).toString("base64"):void 0};return rW.stringify(r)}};gc.RelayedTransactionsFactory=yE});var RO=D(r0=>{"use strict";h();Object.defineProperty(r0,"__esModule",{value:!0});r0.ArgumentErrorContext=void 0;var nW=Ie(),wE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new nW.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) -Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};r0.ArgumentErrorContext=wE});var n0=D(Fa=>{"use strict";h();var iW=Fa&&Fa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.NativeSerializer=void 0;var sW=iW((nr(),xe(hr))),oW=ke(),vE=Ie(),aW=Du(),uW=RO(),we=$t(),cW;(function(t){function e(L,k){L=L||[],r(L,k),n(k)&&(L=i(L,k));let H=k.input,q=[];for(let v=0;v0&&k[0].type.getCardinality().isComposite()&&(q=1/0,v=!0);for(let C of k){if(C.type.getCardinality().isSingular())break;H-=1}return{min:H,max:q,variadic:v}}t.getArgumentsCardinality=s;function o(L,k,H){if(L&&we.isTyped(L))return L;if(k instanceof we.OptionType)return u(L,k,H);if(k instanceof we.OptionalType)return a(L,k,H);if(k instanceof we.VariadicType)return c(L,k,H);if(k instanceof we.CompositeType)return d(L,k,H);if(k instanceof we.TupleType)return w(L,k,H);if(k instanceof we.StructType)return A(L,k,H);if(k instanceof we.ListType)return f(L,k,H);if(k instanceof we.PrimitiveType)return _(L,k,H);if(k instanceof we.EnumType)return N(L,k,H);H.throwError(`convertToTypedValue: unhandled type ${k}`)}function u(L,k,H){if(L==null)return we.OptionValue.newMissing();let q=o(L,k.getFirstTypeParameter(),H);return we.OptionValue.newProvided(q)}function a(L,k,H){if(L==null)return new we.OptionalValue(k);let q=o(L,k.getFirstTypeParameter(),H);return new we.OptionalValue(k,q)}function c(L,k,H){if(k.isCounted)throw new vE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');L==null&&(L=[]),L.map===void 0&&H.convertError(L,"Variadic");let q=L.map(function(v){return o(v,k.getFirstTypeParameter(),H)});return new we.VariadicValue(k,q)}function f(L,k,H){L.map===void 0&&H.convertError(L,"List");let q=L.map(function(v){return o(v,k.getFirstTypeParameter(),H)});return new we.List(k,q)}function d(L,k,H){let q=[],v=k.getTypeParameters();H.guardSameLength(L,v);for(let C=0;C{"use strict";h();Object.defineProperty(i0,"__esModule",{value:!0});i0.TokenTransfersDataBuilder=void 0;var lW=lc(),wi=$t(),fW=Ia(),AE=class{constructor(){this.tokenComputer=new fW.TokenComputer,this.argsSerializer=new lW.ArgSerializer}buildDataPartsForESDTTransfer(e){return["ESDTTransfer",...this.argsSerializer.valuesToStrings([new wi.TokenIdentifierValue(e.token.identifier),new wi.BigUIntValue(e.amount)])]}buildDataPartsForSingleESDTNFTTransfer(e,r){let n=e.token,i=this.tokenComputer.extractIdentifierFromExtendedIdentifier(n.identifier);return["ESDTNFTTransfer",...this.argsSerializer.valuesToStrings([new wi.TokenIdentifierValue(i),new wi.BigUIntValue(n.nonce),new wi.BigUIntValue(e.amount),new wi.AddressValue(r)])]}buildDataPartsForMultiESDTNFTTransfer(e,r){let n=[new wi.AddressValue(e),new wi.U32Value(r.length)];for(let s of r){let o=this.tokenComputer.extractIdentifierFromExtendedIdentifier(s.token.identifier);n.push(new wi.TokenIdentifierValue(o),new wi.BigUIntValue(s.token.nonce),new wi.BigUIntValue(s.amount))}return["MultiESDTNFTTransfer",...this.argsSerializer.valuesToStrings(n)]}};i0.TokenTransfersDataBuilder=AE});var SE=D(a0=>{"use strict";h();Object.defineProperty(a0,"__esModule",{value:!0});a0.SmartContractTransactionsFactory=void 0;var BO=ke(),MO=yr(),LO=Ie(),hW=so(),s0=Vn(),dW=n0(),gW=$t(),pW=Ia(),o0=Du(),mW=EE(),Qf=dc(),bE=class{constructor(e){this.config=e.config,this.abi=e.abi,this.tokenComputer=new pW.TokenComputer,this.dataArgsBuilder=new mW.TokenTransfersDataBuilder,this.contractDeployAddress=BO.Address.fromHex(MO.CONTRACT_DEPLOY_ADDRESS_HEX,this.config.addressHrp)}createTransactionForDeploy(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,u=e.arguments||[],a=new s0.CodeMetadata(n,i,s,o),c=[o0.byteArrayToHex(e.bytecode),o0.byteArrayToHex(MO.VM_TYPE_WASM_VM),a.toString()],f=this.abi?.constructorDefinition,d=this.argsToDataParts(u,f);return c.push(...d),new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.contractDeployAddress,dataParts:c,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}createTransactionForExecute(e){let r=e.arguments||[],n=e.tokenTransfers||[],i=e.nativeTransferAmount??0n,s=n.length;if(i&&s)throw new LO.ErrBadUsage("Can't send both native tokens and custom tokens(ESDT/NFT)");let o=e.contract,u=[];if(s===1){let f=n[0];this.tokenComputer.isFungible(f.token)?u=this.dataArgsBuilder.buildDataPartsForESDTTransfer(f):(u=this.dataArgsBuilder.buildDataPartsForSingleESDTNFTTransfer(f,o),o=e.sender)}else s>1&&(u=this.dataArgsBuilder.buildDataPartsForMultiESDTNFTTransfer(o,n),o=e.sender);u.push(u.length?o0.utf8ToHex(e.function):e.function);let a=this.abi?.getEndpoint(e.function),c=this.argsToDataParts(r,a);return u.push(...c),new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:o,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:i}).build()}createTransactionForUpgrade(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,u=e.arguments||[],a=new s0.CodeMetadata(n,i,s,o),c=["upgradeContract",o0.byteArrayToHex(e.bytecode),a.toString()],f=this.getEndpointForUpgrade(),d=this.argsToDataParts(u,f);return c.push(...d),new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:c,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}getEndpointForUpgrade(){if(this.abi){if(this.abi.upgradeConstructorDefinition)return this.abi.upgradeConstructorDefinition;try{return this.abi.getEndpoint("upgrade")}catch{return hW.Logger.warn("In the ABI, cannot find the 'upgrade' endpoint definition. Will use the constructor definition (fallback)."),this.abi.constructorDefinition}}}createTransactionForClaimingDeveloperRewards(e){let r=["ClaimDeveloperRewards"];return new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitClaimDeveloperRewards,addDataMovementGas:!1}).build()}createTransactionForChangingOwnerAddress(e){let r=["ChangeOwnerAddress",BO.Address.fromBech32(e.newOwner.bech32()).toHex()];return new Qf.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitChangeOwnerAddress,addDataMovementGas:!1}).build()}argsToDataParts(e,r){if(r){let n=dW.NativeSerializer.nativeToTypedValues(e,r);return new s0.ArgSerializer().valuesToStrings(n)}if(this.areArgsOfTypedValue(e))return new s0.ArgSerializer().valuesToStrings(e);throw new LO.Err("Can't convert args to TypedValues")}areArgsOfTypedValue(e){return e.every(r=>gW.isTyped(r))}};a0.SmartContractTransactionsFactory=bE});var FO=D(u0=>{"use strict";h();Object.defineProperty(u0,"__esModule",{value:!0});u0.TokenManagementTransactionsFactory=void 0;var yW=ke(),wW=yr(),vW=so(),Z=Vn(),Jt=dc(),IE=class{constructor(e){this.config=e.config,this.argSerializer=new Z.ArgSerializer,this.trueAsString="true",this.falseAsString="false",this.esdtContractAddress=yW.Address.fromHex(wW.ESDT_CONTRACT_ADDRESS_HEX,this.config.addressHrp)}createTransactionForIssuingFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.BigUIntValue(e.initialSupply),new Z.BigUIntValue(e.numDecimals),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issue",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canTransferNFTCreateRole"),new Z.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueSemiFungible",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canTransferNFTCreateRole"),new Z.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueNonFungible",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.BigUIntValue(e.numDecimals),new Z.StringValue("canFreeze"),new Z.StringValue(this.boolToString(e.canFreeze)),new Z.StringValue("canWipe"),new Z.StringValue(this.boolToString(e.canWipe)),new Z.StringValue("canPause"),new Z.StringValue(this.boolToString(e.canPause)),new Z.StringValue("canTransferNFTCreateRole"),new Z.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new Z.StringValue("canChangeOwner"),new Z.StringValue(this.boolToString(e.canChangeOwner)),new Z.StringValue("canUpgrade"),new Z.StringValue(this.boolToString(e.canUpgrade)),new Z.StringValue("canAddSpecialRoles"),new Z.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["registerMetaESDT",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringAndSettingRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenName),new Z.StringValue(e.tokenTicker),new Z.StringValue(e.tokenType),new Z.BigUIntValue(e.numDecimals)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForSettingBurnRoleGlobally(e){let r=["setBurnRoleGlobally",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForUnsettingBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnFungibleToken(e){let r=[new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)];e.addRoleLocalMint&&r.push(new Z.StringValue("ESDTRoleLocalMint")),e.addRoleLocalBurn&&r.push(new Z.StringValue("ESDTRoleLocalBurn")),e.addRoleESDTTransferRole&&r.push(new Z.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnSemiFungibleToken(e){let r=[new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new Z.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new Z.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTAddQuantity&&r.push(new Z.StringValue("ESDTRoleNFTAddQuantity")),e.addRoleESDTTransferRole&&r.push(new Z.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnMetaESDT(e){return this.createTransactionForSettingSpecialRoleOnSemiFungibleToken(e)}createTransactionForSettingSpecialRoleOnNonFungibleToken(e){let r=[new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new Z.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new Z.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTUpdateAttributes&&r.push(new Z.StringValue("ESDTRoleNFTUpdateAttributes")),e.addRoleNFTAddURI&&r.push(new Z.StringValue("ESDTRoleNFTAddURI")),e.addRoleESDTTransferRole&&r.push(new Z.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForCreatingNFT(e){let r=["ESDTNFTCreate",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.initialQuantity),new Z.StringValue(e.name),new Z.BigUIntValue(e.royalties),new Z.StringValue(e.hash),new Z.BytesValue(p.Buffer.from(e.attributes)),...e.uris.map(s=>new Z.StringValue(s))])],n=e.name+e.hash+e.attributes+e.uris.join(""),i=this.config.gasLimitStorePerByte+BigInt(n.length);return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftCreate+i,addDataMovementGas:!0}).build()}createTransactionForPausing(e){let r=["pause",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForUnpausing(e){let r=["unPause",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForFreezing(e){let r=["freeze",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForUnfreezing(e){let r=["UnFreeze",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForWiping(e){let r=["wipe",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.AddressValue(e.user)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitWiping,addDataMovementGas:!0}).build()}createTransactionForLocalMint(e){let r=["ESDTLocalMint",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.supplyToMint)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalMint,addDataMovementGas:!0}).build()}createTransactionForLocalBurning(e){let r=["ESDTLocalBurn",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.supplyToBurn)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalBurn,addDataMovementGas:!0}).build()}createTransactionForUpdatingAttributes(e){let r=["ESDTNFTUpdateAttributes",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.tokenNonce),new Z.BytesValue(p.Buffer.from(e.attributes))])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftUpdateAttributes,addDataMovementGas:!0}).build()}createTransactionForAddingQuantity(e){let r=["ESDTNFTAddQuantity",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.tokenNonce),new Z.BigUIntValue(e.quantityToAdd)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftAddQuantity,addDataMovementGas:!0}).build()}createTransactionForBurningQuantity(e){let r=["ESDTNFTBurn",...this.argSerializer.valuesToStrings([new Z.StringValue(e.tokenIdentifier),new Z.BigUIntValue(e.tokenNonce),new Z.BigUIntValue(e.quantityToBurn)])];return new Jt.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftBurn,addDataMovementGas:!0}).build()}notifyAboutUnsettingBurnRoleGlobally(){vW.Logger.info(` +`+R+"}":"{"+D.join(",")+"}",n=R,I}}typeof DP.stringify!="function"&&(DP.stringify=function(u,f,p){var S;if(n="",i="",typeof p=="number")for(S=0;S{h();var n1=null,Aee=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,Eee=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/,See=function(t){"use strict";var e={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(t!=null){if(t.strict===!0&&(e.strict=!0),t.storeAsString===!0&&(e.storeAsString=!0),e.alwaysParseAsBig=t.alwaysParseAsBig===!0?t.alwaysParseAsBig:!1,e.useNativeBigInt=t.useNativeBigInt===!0?t.useNativeBigInt:!1,typeof t.constructorAction<"u")if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve")e.constructorAction=t.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`);if(typeof t.protoAction<"u")if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve")e.protoAction=t.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}var r,n,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` +`,r:"\r",t:" "},s,o=function(R){throw{name:"SyntaxError",message:R,at:r,text:s}},c=function(R){return R&&R!==n&&o("Expected '"+R+"' instead of '"+n+"'"),n=s.charAt(r),r+=1,n},a=function(){var R,D="";for(n==="-"&&(D="-",c("-"));n>="0"&&n<="9";)D+=n,c();if(n===".")for(D+=".";c()&&n>="0"&&n<="9";)D+=n;if(n==="e"||n==="E")for(D+=n,c(),(n==="-"||n==="+")&&(D+=n,c());n>="0"&&n<="9";)D+=n,c();if(R=+D,!isFinite(R))o("Bad number");else return n1==null&&(n1=(qt(),qe(jt))),D.length>15?e.storeAsString?D:e.useNativeBigInt?BigInt(D):new n1(D):e.alwaysParseAsBig?e.useNativeBigInt?BigInt(R):new n1(R):R},u=function(){var R,D,U="",k;if(n==='"')for(var z=r;c();){if(n==='"')return r-1>z&&(U+=s.substring(z,r-1)),c(),U;if(n==="\\"){if(r-1>z&&(U+=s.substring(z,r-1)),c(),n==="u"){for(k=0,D=0;D<4&&(R=parseInt(c(),16),!!isFinite(R));D+=1)k=k*16+R;U+=String.fromCharCode(k)}else if(typeof i[n]=="string")U+=i[n];else break;z=r}}o("Bad string")},f=function(){for(;n&&n<=" ";)c()},p=function(){switch(n){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}o("Unexpected '"+n+"'")},S,I=function(){var R=[];if(n==="["){if(c("["),f(),n==="]")return c("]"),R;for(;n;){if(R.push(S()),f(),n==="]")return c("]"),R;c(","),f()}}o("Bad array")},N=function(){var R,D=Object.create(null);if(n==="{"){if(c("{"),f(),n==="}")return c("}"),D;for(;n;){if(R=u(),f(),c(":"),e.strict===!0&&Object.hasOwnProperty.call(D,R)&&o('Duplicate key "'+R+'"'),Aee.test(R)===!0?e.protoAction==="error"?o("Object contains forbidden prototype property"):e.protoAction==="ignore"?S():D[R]=S():Eee.test(R)===!0?e.constructorAction==="error"?o("Object contains forbidden constructor property"):e.constructorAction==="ignore"?S():D[R]=S():D[R]=S(),f(),n==="}")return c("}"),D;c(","),f()}}o("Bad object")};return S=function(){switch(f(),n){case"{":return N();case"[":return I();case'"':return u();case"-":return a();default:return n>="0"&&n<="9"?a():p()}},function(R,D){var U;return s=R+"",r=0,n=" ",U=S(),f(),n&&o("Syntax error"),typeof D=="function"?function k(z,H){var F,V,q=z[H];return q&&typeof q=="object"&&Object.keys(q).forEach(function(C){V=k(q,C),V!==void 0?q[C]=V:delete q[C]}),D.call(z,H,q)}({"":U},""):U}};FP.exports=See});var s1=L((P6e,i1)=>{h();var UP=LP().stringify,kP=qP();i1.exports=function(t){return{parse:kP(t),stringify:UP}};i1.exports.parse=kP();i1.exports.stringify=UP});var VP=L(Rl=>{"use strict";h();var _ee=Rl&&Rl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rl,"__esModule",{value:!0});Rl.RelayedTransactionsFactory=void 0;var Tee=_ee((qt(),qe(jt))),o1=Nt(),Bc=Ve(),Lh=yi(),cS=Dn(),Iee=s1(),uS=class{constructor(e){this.config=e.config}createRelayedV1Transaction(e){if(!e.innerTransaction.gasLimit)throw new Bc.ErrInvalidInnerTransaction("The gas limit is not set for the inner transaction");if(!e.innerTransaction.signature.length)throw new Bc.ErrInvalidInnerTransaction("The inner transaction is not signed");let r=this.prepareInnerTransactionForRelayedV1(e.innerTransaction),n=`relayedTx@${b.Buffer.from(r).toString("hex")}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=this.config.minGasLimit+i+e.innerTransaction.gasLimit;return new cS.Transaction({chainID:this.config.chainID,sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,gasLimit:s,data:b.Buffer.from(n)})}createRelayedV2Transaction(e){if(e.innerTransaction.gasLimit)throw new Bc.ErrInvalidInnerTransaction("The gas limit should not be set for the inner transaction");if(!e.innerTransaction.signature.length)throw new Bc.ErrInvalidInnerTransaction("The inner transaction is not signed");let{argumentsString:r}=new Lh.ArgSerializer().valuesToString([new Lh.AddressValue(o1.Address.fromBech32(e.innerTransaction.receiver)),new Lh.U64Value(new Tee.default(e.innerTransaction.nonce.toString())),new Lh.BytesValue(b.Buffer.from(e.innerTransaction.data)),new Lh.BytesValue(b.Buffer.from(e.innerTransaction.signature))]),n=`relayedTxV2@${r}`,i=this.config.gasLimitPerByte*BigInt(n.length),s=e.innerTransactionGasLimit+this.config.minGasLimit+i;return new cS.Transaction({sender:e.relayerAddress.bech32(),receiver:e.innerTransaction.sender,value:0n,gasLimit:s,chainID:this.config.chainID,data:b.Buffer.from(n),version:e.innerTransaction.version,options:e.innerTransaction.options})}createRelayedV3Transaction(e){if(!e.innerTransactions.length)throw new Bc.ErrInvalidInnerTransaction("No inner transctions provided");let r=0n;for(let s of e.innerTransactions){if(!s.signature.length)throw new Bc.ErrInvalidInnerTransaction("Inner transaction is not signed");if(s.relayer!==e.relayerAddress.bech32())throw new Bc.ErrInvalidInnerTransaction("The inner transaction has an incorrect relayer address");r+=s.gasLimit}let i=this.config.minGasLimit*BigInt(e.innerTransactions.length)+r;return new cS.Transaction({sender:e.relayerAddress.bech32(),receiver:e.relayerAddress.bech32(),chainID:this.config.chainID,gasLimit:i,innerTransactions:e.innerTransactions})}prepareInnerTransactionForRelayedV1(e){let r={nonce:e.nonce,sender:o1.Address.newFromBech32(e.sender).getPublicKey().toString("base64"),receiver:o1.Address.newFromBech32(e.receiver).getPublicKey().toString("base64"),value:e.value,gasPrice:e.gasPrice,gasLimit:e.gasLimit,data:b.Buffer.from(e.data).toString("base64"),signature:b.Buffer.from(e.signature).toString("base64"),chainID:b.Buffer.from(e.chainID).toString("base64"),version:e.version,options:e.options.valueOf()==0?void 0:e.options,guardian:e.guardian?o1.Address.newFromBech32(e.guardian).getPublicKey().toString("base64"):void 0,guardianSignature:e.guardianSignature.length?b.Buffer.from(e.guardianSignature).toString("base64"):void 0,sndUserName:e.senderUsername?b.Buffer.from(e.senderUsername).toString("base64"):void 0,rcvUserName:e.receiverUsername?b.Buffer.from(e.receiverUsername).toString("base64"):void 0};return Iee.stringify(r)}};Rl.RelayedTransactionsFactory=uS});var HP=L(a1=>{"use strict";h();Object.defineProperty(a1,"__esModule",{value:!0});a1.ArgumentErrorContext=void 0;var Cee=Ve(),lS=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new Cee.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) +Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};a1.ArgumentErrorContext=lS});var c1=L(Lc=>{"use strict";h();var xee=Lc&&Lc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lc,"__esModule",{value:!0});Lc.NativeSerializer=void 0;var Nee=xee((qt(),qe(jt))),Oee=Nt(),fS=Ve(),Pee=zu(),Ree=HP(),ve=dr(),Mee;(function(t){function e(F,V){F=F||[],r(F,V),n(V)&&(F=i(F,V));let q=V.input,C=[];for(let B=0;B0&&V[0].type.getCardinality().isComposite()&&(C=1/0,B=!0);for(let x of V){if(x.type.getCardinality().isSingular())break;q-=1}return{min:q,max:C,variadic:B}}t.getArgumentsCardinality=s;function o(F,V,q){if(F&&ve.isTyped(F))return F;if(V instanceof ve.OptionType)return c(F,V,q);if(V instanceof ve.OptionalType)return a(F,V,q);if(V instanceof ve.VariadicType)return u(F,V,q);if(V instanceof ve.CompositeType)return p(F,V,q);if(V instanceof ve.TupleType)return S(F,V,q);if(V instanceof ve.StructType)return I(F,V,q);if(V instanceof ve.ListType)return f(F,V,q);if(V instanceof ve.PrimitiveType)return N(F,V,q);if(V instanceof ve.EnumType)return R(F,V,q);if(V instanceof ve.ManagedDecimalType)return D(F,V,q);q.throwError(`convertToTypedValue: unhandled type ${V}`)}function c(F,V,q){if(F==null)return ve.OptionValue.newMissing();let C=o(F,V.getFirstTypeParameter(),q);return ve.OptionValue.newProvided(C)}function a(F,V,q){if(F==null)return new ve.OptionalValue(V);let C=o(F,V.getFirstTypeParameter(),q);return new ve.OptionalValue(V,C)}function u(F,V,q){if(V.isCounted)throw new fS.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');F==null&&(F=[]),F.map===void 0&&q.convertError(F,"Variadic");let C=F.map(function(B){return o(B,V.getFirstTypeParameter(),q)});return new ve.VariadicValue(V,C)}function f(F,V,q){F.map===void 0&&q.convertError(F,"List");let C=F.map(function(B){return o(B,V.getFirstTypeParameter(),q)});return new ve.List(V,C)}function p(F,V,q){let C=[],B=V.getTypeParameters();q.guardSameLength(F,B);for(let x=0;x{"use strict";h();Object.defineProperty(u1,"__esModule",{value:!0});u1.TokenTransfersDataBuilder=void 0;var Dee=Nl(),Yi=dr(),Bee=Sc(),dS=class{constructor(){this.tokenComputer=new Bee.TokenComputer,this.argsSerializer=new Dee.ArgSerializer}buildDataPartsForESDTTransfer(e){return["ESDTTransfer",...this.argsSerializer.valuesToStrings([new Yi.TokenIdentifierValue(e.token.identifier),new Yi.BigUIntValue(e.amount)])]}buildDataPartsForSingleESDTNFTTransfer(e,r){let n=e.token,i=this.tokenComputer.extractIdentifierFromExtendedIdentifier(n.identifier);return["ESDTNFTTransfer",...this.argsSerializer.valuesToStrings([new Yi.TokenIdentifierValue(i),new Yi.BigUIntValue(n.nonce),new Yi.BigUIntValue(e.amount),new Yi.AddressValue(r)])]}buildDataPartsForMultiESDTNFTTransfer(e,r){let n=[new Yi.AddressValue(e),new Yi.U32Value(r.length)];for(let s of r){let o=this.tokenComputer.extractIdentifierFromExtendedIdentifier(s.token.identifier);n.push(new Yi.TokenIdentifierValue(o),new Yi.BigUIntValue(s.token.nonce),new Yi.BigUIntValue(s.amount))}return["MultiESDTNFTTransfer",...this.argsSerializer.valuesToStrings(n)]}};u1.TokenTransfersDataBuilder=dS});var gS=L(d1=>{"use strict";h();Object.defineProperty(d1,"__esModule",{value:!0});d1.SmartContractTransactionsFactory=void 0;var GP=Nt(),zP=xr(),Lee=Ve(),Fee=ra(),l1=yi(),qee=c1(),Uee=dr(),jP=Sc(),f1=zu(),kee=hS(),Fh=Pl(),pS=class{constructor(e){this.config=e.config,this.abi=e.abi,this.tokenComputer=new jP.TokenComputer,this.dataArgsBuilder=new kee.TokenTransfersDataBuilder,this.contractDeployAddress=GP.Address.fromHex(zP.CONTRACT_DEPLOY_ADDRESS_HEX,this.config.addressHrp)}createTransactionForDeploy(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,c=e.arguments||[],a=new l1.CodeMetadata(n,i,s,o),u=[f1.byteArrayToHex(e.bytecode),f1.byteArrayToHex(zP.VM_TYPE_WASM_VM),a.toString()],f=this.abi?.constructorDefinition,p=this.argsToDataParts(c,f);return u.push(...p),new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.contractDeployAddress,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}createTransactionForExecute(e){let r=e.arguments||[],n=e.tokenTransfers?[...e.tokenTransfers]:[],i=e.nativeTransferAmount??0n,s=n.length;i&&s&&(n.push(jP.TokenTransfer.newFromEgldAmount(i)),i=0n,s++);let o=e.contract,c=[];if(s===1){let f=n[0];this.tokenComputer.isFungible(f.token)?c=this.dataArgsBuilder.buildDataPartsForESDTTransfer(f):(c=this.dataArgsBuilder.buildDataPartsForSingleESDTNFTTransfer(f,o),o=e.sender)}else s>1&&(c=this.dataArgsBuilder.buildDataPartsForMultiESDTNFTTransfer(o,n),o=e.sender);c.push(c.length?f1.utf8ToHex(e.function):e.function);let a=this.abi?.getEndpoint(e.function),u=this.argsToDataParts(r,a);return c.push(...u),new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:o,dataParts:c,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:i}).build()}createTransactionForUpgrade(e){let r=e.nativeTransferAmount??0n,n=e.isUpgradeable??!0,i=e.isReadable??!0,s=e.isPayable??!1,o=e.isPayableBySmartContract??!0,c=e.arguments||[],a=new l1.CodeMetadata(n,i,s,o),u=["upgradeContract",f1.byteArrayToHex(e.bytecode),a.toString()],f=this.getEndpointForUpgrade(),p=this.argsToDataParts(c,f);return u.push(...p),new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:u,gasLimit:e.gasLimit,addDataMovementGas:!1,amount:r}).build()}getEndpointForUpgrade(){if(this.abi){if(this.abi.upgradeConstructorDefinition)return this.abi.upgradeConstructorDefinition;try{return this.abi.getEndpoint("upgrade")}catch{return Fee.Logger.warn("In the ABI, cannot find the 'upgrade' endpoint definition. Will use the constructor definition (fallback)."),this.abi.constructorDefinition}}}createTransactionForClaimingDeveloperRewards(e){let r=["ClaimDeveloperRewards"];return new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitClaimDeveloperRewards,addDataMovementGas:!1}).build()}createTransactionForChangingOwnerAddress(e){let r=["ChangeOwnerAddress",GP.Address.fromBech32(e.newOwner.bech32()).toHex()];return new Fh.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.contract,dataParts:r,gasLimit:this.config.gasLimitChangeOwnerAddress,addDataMovementGas:!1}).build()}argsToDataParts(e,r){if(r){let n=qee.NativeSerializer.nativeToTypedValues(e,r);return new l1.ArgSerializer().valuesToStrings(n)}if(this.areArgsOfTypedValue(e))return new l1.ArgSerializer().valuesToStrings(e);throw new Lee.Err("Can't convert args to TypedValues")}areArgsOfTypedValue(e){return e.every(r=>Uee.isTyped(r))}};d1.SmartContractTransactionsFactory=pS});var QP=L(h1=>{"use strict";h();Object.defineProperty(h1,"__esModule",{value:!0});h1.TokenManagementTransactionsFactory=void 0;var Vee=Nt(),Hee=xr(),Gee=Ve(),zee=ra(),J=yi(),Ut=Pl(),mS=class{constructor(e){this.config=e.config,this.argSerializer=new J.ArgSerializer,this.trueAsString="true",this.falseAsString="false",this.esdtContractAddress=Vee.Address.fromHex(Hee.ESDT_CONTRACT_ADDRESS_HEX,this.config.addressHrp)}createTransactionForIssuingFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.BigUIntValue(e.initialSupply),new J.BigUIntValue(e.numDecimals),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issue",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canTransferNFTCreateRole"),new J.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueSemiFungible",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForIssuingNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canTransferNFTCreateRole"),new J.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["issueNonFungible",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=[new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.BigUIntValue(e.numDecimals),new J.StringValue("canFreeze"),new J.StringValue(this.boolToString(e.canFreeze)),new J.StringValue("canWipe"),new J.StringValue(this.boolToString(e.canWipe)),new J.StringValue("canPause"),new J.StringValue(this.boolToString(e.canPause)),new J.StringValue("canTransferNFTCreateRole"),new J.StringValue(this.boolToString(e.canTransferNFTCreateRole)),new J.StringValue("canChangeOwner"),new J.StringValue(this.boolToString(e.canChangeOwner)),new J.StringValue("canUpgrade"),new J.StringValue(this.boolToString(e.canUpgrade)),new J.StringValue("canAddSpecialRoles"),new J.StringValue(this.boolToString(e.canAddSpecialRoles))],n=["registerMetaESDT",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringAndSettingRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue(e.tokenType),new J.BigUIntValue(e.numDecimals)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitIssue,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForSettingBurnRoleGlobally(e){let r=["setBurnRoleGlobally",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForUnsettingBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitToggleBurnRoleGlobally,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnFungibleToken(e){let r=[new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)];e.addRoleLocalMint&&r.push(new J.StringValue("ESDTRoleLocalMint")),e.addRoleLocalBurn&&r.push(new J.StringValue("ESDTRoleLocalBurn")),e.addRoleESDTTransferRole&&r.push(new J.StringValue("ESDTTransferRole"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnSemiFungibleToken(e){let r=[new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new J.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new J.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTAddQuantity&&r.push(new J.StringValue("ESDTRoleNFTAddQuantity")),e.addRoleESDTTransferRole&&r.push(new J.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&r.push(new J.StringValue("ESDTRoleModifyCreator"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForSettingSpecialRoleOnMetaESDT(e){return this.createTransactionForSettingSpecialRoleOnSemiFungibleToken(e)}createTransactionForSettingSpecialRoleOnNonFungibleToken(e){let r=[new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)];e.addRoleNFTCreate&&r.push(new J.StringValue("ESDTRoleNFTCreate")),e.addRoleNFTBurn&&r.push(new J.StringValue("ESDTRoleNFTBurn")),e.addRoleNFTUpdateAttributes&&r.push(new J.StringValue("ESDTRoleNFTUpdateAttributes")),e.addRoleNFTAddURI&&r.push(new J.StringValue("ESDTRoleNFTAddURI")),e.addRoleESDTTransferRole&&r.push(new J.StringValue("ESDTTransferRole")),e.addRoleESDTModifyCreator&&r.push(new J.StringValue("ESDTRoleModifyCreator")),e.addRoleNFTRecreate&&r.push(new J.StringValue("ESDTRoleNFTRecreate")),e.addRoleESDTSetNewURI&&r.push(new J.StringValue("ESDTRoleSetNewURI")),e.addRoleESDTModifyRoyalties&&r.push(new J.StringValue("ESDTRoleModifyRoyalties"));let n=["setSpecialRole",...this.argSerializer.valuesToStrings(r)];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:n,gasLimit:this.config.gasLimitSetSpecialRole,addDataMovementGas:!0}).build()}createTransactionForCreatingNFT(e){let r=["ESDTNFTCreate",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.initialQuantity),new J.StringValue(e.name),new J.BigUIntValue(e.royalties),new J.StringValue(e.hash),new J.BytesValue(b.Buffer.from(e.attributes)),...e.uris.map(s=>new J.StringValue(s))])],n=e.name+e.hash+e.attributes+e.uris.join(""),i=this.config.gasLimitStorePerByte+BigInt(n.length);return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftCreate+i,addDataMovementGas:!0}).build()}createTransactionForPausing(e){let r=["pause",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForUnpausing(e){let r=["unPause",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitPausing,addDataMovementGas:!0}).build()}createTransactionForFreezing(e){let r=["freeze",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForUnfreezing(e){let r=["UnFreeze",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitFreezing,addDataMovementGas:!0}).build()}createTransactionForWiping(e){let r=["wipe",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.AddressValue(e.user)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitWiping,addDataMovementGas:!0}).build()}createTransactionForLocalMint(e){let r=["ESDTLocalMint",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.supplyToMint)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalMint,addDataMovementGas:!0}).build()}createTransactionForLocalBurning(e){let r=["ESDTLocalBurn",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.supplyToBurn)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtLocalBurn,addDataMovementGas:!0}).build()}createTransactionForUpdatingAttributes(e){let r=["ESDTNFTUpdateAttributes",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BytesValue(b.Buffer.from(e.attributes))])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftUpdateAttributes,addDataMovementGas:!0}).build()}createTransactionForAddingQuantity(e){let r=["ESDTNFTAddQuantity",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BigUIntValue(e.quantityToAdd)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftAddQuantity,addDataMovementGas:!0}).build()}createTransactionForBurningQuantity(e){let r=["ESDTNFTBurn",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BigUIntValue(e.quantityToBurn)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtNftBurn,addDataMovementGas:!0}).build()}createTransactionForModifyingRoyalties(e){let r=["ESDTModifyRoyalties",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),new J.BigUIntValue(e.newRoyalties)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtModifyRoyalties,addDataMovementGas:!0}).build()}createTransactionForSettingNewUris(e){if(!e.newUris.length)throw new Gee.ErrBadUsage("No URIs provided");let r=["ESDTSetNewURIs",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),...e.newUris.map(n=>new J.StringValue(n))])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitSetNewUris,addDataMovementGas:!0}).build()}createTransactionForModifyingCreator(e){let r=["ESDTModifyCreator",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtModifyCreator,addDataMovementGas:!0}).build()}createTransactionForUpdatingMetadata(e){let r=["ESDTMetaDataUpdate",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),...e.newTokenName?[new J.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new J.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new J.StringValue(e.newHash)]:[],...e.newAttributes?[new J.BytesValue(b.Buffer.from(e.newAttributes))]:[],...e.newUris?e.newUris.map(n=>new J.StringValue(n)):[]])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitEsdtMetadataUpdate,addDataMovementGas:!0}).build()}createTransactionForMetadataRecreate(e){let r=["ESDTMetaDataRecreate",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier),new J.BigUIntValue(e.tokenNonce),...e.newTokenName?[new J.StringValue(e.newTokenName)]:[],...e.newRoyalties?[new J.BigUIntValue(e.newRoyalties)]:[],...e.newHash?[new J.StringValue(e.newHash)]:[],...e.newAttributes?[new J.BytesValue(b.Buffer.from(e.newAttributes))]:[],...e.newUris?e.newUris.map(n=>new J.StringValue(n)):[]])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitNftMetadataRecreate,addDataMovementGas:!0}).build()}createTransactionForChangingTokenToDynamic(e){let r=["changeToDynamic",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitNftChangeToDynamic,addDataMovementGas:!0}).build()}createTransactionForUpdatingTokenId(e){let r=["updateTokenID",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenIdentifier)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitUpdateTokenId,addDataMovementGas:!0}).build()}createTransactionForRegisteringDynamicToken(e){let r=["registerDynamic",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue(e.tokenType)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}createTransactionForRegisteringDynamicAndSettingRoles(e){let r=["registerAndSetAllRolesDynamic",...this.argSerializer.valuesToStrings([new J.StringValue(e.tokenName),new J.StringValue(e.tokenTicker),new J.StringValue(e.tokenType)])];return new Ut.TransactionBuilder({config:this.config,sender:e.sender,receiver:this.esdtContractAddress,dataParts:r,gasLimit:this.config.gasLimitRegisterDynamic,addDataMovementGas:!0,amount:this.config.issueCost}).build()}notifyAboutUnsettingBurnRoleGlobally(){zee.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}boolToString(e){return e?this.trueAsString:this.falseAsString}};u0.TokenManagementTransactionsFactory=IE});var TE=D(c0=>{"use strict";h();Object.defineProperty(c0,"__esModule",{value:!0});c0.TransactionsFactoryConfig=void 0;var AW=Wd(),_E=class{constructor(e){this.chainID=e.chainID,this.addressHrp=AW.LibraryConfig.DefaultAddressHrp,this.minGasLimit=50000n,this.gasLimitPerByte=1500n,this.gasLimitIssue=60000000n,this.gasLimitToggleBurnRoleGlobally=60000000n,this.gasLimitEsdtLocalMint=300000n,this.gasLimitEsdtLocalBurn=300000n,this.gasLimitSetSpecialRole=60000000n,this.gasLimitPausing=60000000n,this.gasLimitFreezing=60000000n,this.gasLimitWiping=60000000n,this.gasLimitEsdtNftCreate=3000000n,this.gasLimitEsdtNftUpdateAttributes=1000000n,this.gasLimitEsdtNftAddQuantity=1000000n,this.gasLimitEsdtNftBurn=1000000n,this.gasLimitStorePerByte=10000n,this.issueCost=50000000000000000n,this.gasLimitStake=5000000n,this.gasLimitUnstake=5000000n,this.gasLimitUnbond=5000000n,this.gasLimitCreateDelegationContract=50000000n,this.gasLimitDelegationOperations=1000000n,this.additionalGasLimitPerValidatorNode=6000000n,this.additionalGasLimitForDelegationOperations=10000000n,this.gasLimitSaveKeyValue=100000n,this.gasLimitPersistPerByte=1000n,this.gasLimitSetGuardian=250000n,this.gasLimitGuardAccount=250000n,this.gasLimitUnguardAccount=250000n,this.gasLimitESDTTransfer=200000n,this.gasLimitESDTNFTTransfer=200000n,this.gasLimitMultiESDTNFTTransfer=200000n,this.gasLimitClaimDeveloperRewards=6000000n,this.gasLimitChangeOwnerAddress=6000000n}};c0.TransactionsFactoryConfig=_E});var VO=D(l0=>{"use strict";h();Object.defineProperty(l0,"__esModule",{value:!0});l0.TransferTransactionsFactory=void 0;var Eo=Ie(),rn=Vn(),EW=Ia(),Kf=en(),CE=Bs(),bW=EE(),UO=dc(),SW=1e5,qO=8e5,NE=class{constructor(e){this.isGasEstimator(e)?this.gasEstimator=e:(this.config=e.config,this.tokenComputer=new EW.TokenComputer,this.tokenTransfersDataBuilder=new bW.TokenTransfersDataBuilder)}isGasEstimator(e){return typeof e=="object"&&typeof e.forEGLDTransfer=="function"&&typeof e.forESDTTransfer=="function"&&typeof e.forESDTNFTTransfer=="function"&&typeof e.forMultiESDTNFTTransfer=="function"}isGasEstimatorDefined(){return this.gasEstimator!==void 0}ensureMembersAreDefined(){if(this.config===void 0)throw new Eo.Err("'config' is not defined");if(this.tokenTransfersDataBuilder===void 0)throw new Eo.Err("`dataArgsBuilder is not defined`");if(this.tokenComputer===void 0)throw new Eo.Err("`tokenComputer is not defined`")}createTransactionForNativeTokenTransfer(e){this.ensureMembersAreDefined();let r=e.data||new Uint8Array;return new Kf.Transaction({sender:e.sender.bech32(),receiver:e.receiver.bech32(),chainID:this.config.chainID,gasLimit:this.computeGasForMoveBalance(this.config,r),data:r,value:e.nativeAmount})}createTransactionForESDTTokenTransfer(e){this.ensureMembersAreDefined();let r=e.tokenTransfers.length;if(r===0)throw new Eo.ErrBadUsage("No token transfer has been provided");if(r===1)return this.createSingleESDTTransferTransaction(e);let n=this.tokenTransfersDataBuilder.buildDataPartsForMultiESDTNFTTransfer(e.receiver,e.tokenTransfers),i=this.config.gasLimitMultiESDTNFTTransfer*BigInt(r)+BigInt(qO);return new UO.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:n,gasLimit:i,addDataMovementGas:!0}).build()}createEGLDTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create an EGLD transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForNativeTokenTransfer` method.");let r=e.data?.length()||0,n=this.gasEstimator.forEGLDTransfer(r);return new Kf.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||n,data:e.data,chainID:e.chainID})}createESDTTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create an ESDT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new rn.ArgSerializer().valuesToString([rn.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new rn.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new CE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Kf.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create an ESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new rn.ArgSerializer().valuesToString([rn.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new rn.U64Value(e.tokenTransfer.nonce),new rn.BigUIntValue(e.tokenTransfer.valueOf()),new rn.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new CE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Kf.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Eo.Err("You are calling a legacy function to create a MultiESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let r=[new rn.AddressValue(e.destination),new rn.U16Value(e.tokenTransfers.length)];for(let a of e.tokenTransfers)r.push(rn.BytesValue.fromUTF8(a.tokenIdentifier),new rn.U64Value(a.nonce),new rn.BigUIntValue(a.valueOf()));let{argumentsString:n}=new rn.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new CE.TransactionPayload(i),o=s.length()||0,u=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Kf.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||u,data:s,chainID:e.chainID})}createSingleESDTTransferTransaction(e){this.ensureMembersAreDefined();let r=[],n=e.tokenTransfers[0],i=0n,s=e.receiver;return this.tokenComputer.isFungible(n.token)?(r=this.tokenTransfersDataBuilder.buildDataPartsForESDTTransfer(n),i=this.config.gasLimitESDTTransfer+BigInt(SW)):(r=this.tokenTransfersDataBuilder.buildDataPartsForSingleESDTNFTTransfer(n,s),i=this.config.gasLimitESDTNFTTransfer+BigInt(qO),s=e.sender),new UO.TransactionBuilder({config:this.config,sender:e.sender,receiver:s,dataParts:r,gasLimit:i,addDataMovementGas:!0}).build()}computeGasForMoveBalance(e,r){return e.minGasLimit+e.gasLimitPerByte*BigInt(r.length)}};l0.TransferTransactionsFactory=NE});var kO=D(h0=>{"use strict";h();Object.defineProperty(h0,"__esModule",{value:!0});h0.AccountTransactionsFactory=void 0;var IW=ke(),f0=dc(),xE=class{constructor(e){this.config=e.config}createTransactionForSavingKeyValue(e){let r="SaveKeyValue",n=this.computeDataPartsForSavingKeyValue(e.keyValuePairs),i=[r,...n],s=this.computeExtraGasForSavingKeyValue(e.keyValuePairs);return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:i,gasLimit:s,addDataMovementGas:!0}).build()}computeExtraGasForSavingKeyValue(e){let r=0n;return e.forEach((n,i)=>{r+=this.config.gasLimitPersistPerByte*BigInt(i.length+n.length)+this.config.gasLimitStorePerByte*BigInt(n.length)}),r+this.config.gasLimitSaveKeyValue}computeDataPartsForSavingKeyValue(e){let r=[];return e.forEach((n,i)=>{r.push(p.Buffer.from(i).toString("hex"),p.Buffer.from(n).toString("hex"))}),r}createTransactionForSettingGuardian(e){let r=["SetGuardian",IW.Address.fromBech32(e.guardianAddress.bech32()).toHex(),p.Buffer.from(e.serviceID).toString("hex")];return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitSetGuardian,addDataMovementGas:!0}).build()}createTransactionForGuardingAccount(e){let r=["GuardAccount"];return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitGuardAccount,addDataMovementGas:!0}).build()}createTransactionForUnguardingAccount(e){let r=["UnGuardAccount"];return new f0.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitUnguardAccount,addDataMovementGas:!0}).build()}};h0.AccountTransactionsFactory=xE});var d0=D(dn=>{"use strict";h();var _W=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ua=dn&&dn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_W(e,t,r)};Object.defineProperty(dn,"__esModule",{value:!0});Ua(bO(),dn);Ua(PO(),dn);Ua(SE(),dn);Ua(FO(),dn);Ua(TE(),dn);Ua(VO(),dn);Ua(kO(),dn)});var PE=D(kn=>{"use strict";h();var TW=kn&&kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CW=kn&&kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NW=kn&&kn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TW(e,t,r);return CW(e,t),e},xW=kn&&kn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kn,"__esModule",{value:!0});kn.InteractionChecker=void 0;var OE=NW(Ie()),OW=xW((nr(),xe(hr))),DE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new OW.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new OE.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new OE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let u=0;u{"use strict";h();Object.defineProperty(g0,"__esModule",{value:!0});g0.Query=void 0;var DW=ke(),PW=lc(),RE=class{constructor(e){this.caller=e.caller||DW.Address.empty(),this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new PW.ArgSerializer().valuesToStrings(this.args)}};g0.Query=RE});var LE=D(p0=>{"use strict";h();Object.defineProperty(p0,"__esModule",{value:!0});p0.Interaction=void 0;var HO=ke(),RW=hE(),BW=yr(),BE=Ia(),GO=d0(),MW=PE(),LW=Wf(),ME=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=HO.Address.empty(),this.sender=HO.Address.empty(),this.version=BW.TRANSACTION_VERSION_DEFAULT,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=[]}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){RW.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=new GO.TransactionsFactoryConfig({chainID:this.chainID.valueOf()}),n=new GO.SmartContractTransactionsFactory({config:e}).createTransactionForExecute({sender:this.sender,contract:this.contract.getAddress(),function:this.function.valueOf(),gasLimit:BigInt(this.gasLimit.valueOf()),arguments:this.args,nativeTransferAmount:BigInt(this.value.toString()),tokenTransfers:this.tokenTransfers});return n.chainID=this.chainID.valueOf(),n.nonce=BigInt(this.nonce.valueOf()),n.version=this.version,this.gasPrice&&(n.gasPrice=BigInt(this.gasPrice.valueOf())),n}buildQuery(){return new LW.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.tokenTransfers=[e].map(r=>new BE.TokenTransfer(r)),this}withSingleESDTNFTTransfer(e){return this.tokenTransfers=[e].map(r=>new BE.TokenTransfer(r)),this}withMultiESDTNFTTransfer(e){return this.tokenTransfers=e.map(r=>new BE.TokenTransfer(r)),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withVersion(e){return this.version=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new MW.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};p0.Interaction=ME});var FE=D(jO=>{"use strict";h();Object.defineProperty(jO,"__esModule",{value:!0})});var WO=D(mc=>{"use strict";h();Object.defineProperty(mc,"__esModule",{value:!0});mc.bech32m=mc.bech32=void 0;var m0="qpzry9x8gf2tvdw0s3jn54khce6mua7l",QO={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function zO(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=pc(e)^n>>5}e=pc(e);for(let r=0;r=r;)s-=r,u.push(i>>s&o);if(n)s>0&&u.push(i<=e)return"Excess padding";if(i<a)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=zO(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");c=pc(c)^w,f+=m0.charAt(w)}for(let d=0;d<6;++d)c=pc(c);c^=e;for(let d=0;d<6;++d){let w=c>>(5-d)*5&31;f+=m0.charAt(w)}return f}function n(o,u){if(u=u||90,o.length<8)return o+" too short";if(o.length>u)return"Exceeds length limit";let a=o.toLowerCase(),c=o.toUpperCase();if(o!==a&&o!==c)return"Mixed-case string "+o;o=a;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),w=o.slice(f+1);if(w.length<6)return"Data too short";let A=zO(d);if(typeof A=="string")return A;let _=[];for(let N=0;N=w.length)&&_.push(V)}return A!==e?"Invalid checksum for "+o:{prefix:d,words:_}}function i(o,u){let a=n(o,u);if(typeof a=="object")return a}function s(o,u){let a=n(o,u);if(typeof a=="object")return a;throw new Error(a)}return{decodeUnsafe:i,decode:s,encode:r,toWords:FW,fromWordsUnsafe:UW,fromWords:qW}}mc.bech32=KO("bech32");mc.bech32m=KO("bech32m")});var YO=D(Hn=>{"use strict";h();Object.defineProperty(Hn,"__esModule",{value:!0});Hn.TokenTransferProperties=Hn.TransactionMetadataTransfer=Hn.TransactionMetadata=Hn.TransactionToDecode=Hn.TransactionDecoder=void 0;var $O=WO(),qE=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new qa;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new y0;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new qa;s.transfers||(s.transfers=[]);let o=2;for(let u=0;uo&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),u=new qa;return u.sender=e.sender,u.receiver=o,u.value=s,r.length>4&&(u.functionName=this.hexToString(r[4]),u.functionArgs=r.slice(5)),u.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],u}base64Encode(e){return p.Buffer.from(e).toString("base64")}base64Decode(e){return p.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new qa;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=p.Buffer.from(e,"hex"),n=$O.bech32.toWords(r);return $O.bech32.encode("erd",n)}isAddressValid(e){return p.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return p.Buffer.from(e,"base64").toString("hex")}hexToString(e){return p.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};Hn.TransactionDecoder=qE;var y0=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Hn.TransactionToDecode=y0;var qa=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Hn.TransactionMetadata=qa;var VE=class{constructor(){this.value=BigInt(0)}};Hn.TransactionMetadataTransfer=VE;var kE=class{};Hn.TokenTransferProperties=kE});var HE=D(w0=>{"use strict";h();Object.defineProperty(w0,"__esModule",{value:!0});w0.ReturnCode=void 0;var yt=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};w0.ReturnCode=yt;yt.None=new yt("");yt.Ok=new yt("ok");yt.FunctionNotFound=new yt("function not found");yt.FunctionWrongSignature=new yt("wrong signature for function");yt.ContractNotFound=new yt("contract not found");yt.UserError=new yt("user error");yt.OutOfGas=new yt("out of gas");yt.AccountCollision=new yt("account collision");yt.OutOfFunds=new yt("out of funds");yt.CallStackOverFlow=new yt("call stack overflow");yt.ContractInvalid=new yt("contract invalid");yt.ExecutionFailed=new yt("execution failed");yt.Unknown=new yt("unknown")});var ZO=D(v0=>{"use strict";h();Object.defineProperty(v0,"__esModule",{value:!0});v0.ResultsParser=void 0;var VW=YO(),JO=ke(),XO=Ie(),bo=so(),kW=lc(),yc=HE(),wc;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(wc||(wc={}));var GE;(function(t){t.TooMuchGas="@too much gas provided for processing"})(GE||(GE={}));var HW={argsSerializer:new kW.ArgSerializer},jE=class{constructor(e){e={...HW,...e},this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new yc.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new yc.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e);return this.parseOutcomeFromUntypedBundle(n,r)}parseOutcomeFromUntypedBundle(e,r){let n=this.argsSerializer.buffersToValues(e.values,r.output);return{returnCode:e.returnCode,returnMessage:e.returnMessage,values:n,firstValue:n[0],secondValue:n[1],thirdValue:n[2],lastValue:n[n.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return bo.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return bo.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return bo.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return bo.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return bo.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return bo.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return bo.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return bo.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new XO.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new VW.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:yc.ReturnCode.None,returnMessage:yc.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:yc.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(wc.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),o=r.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(wc.OnWriteLog,u=>u.findFirstOrNoneTopic(a=>a.toString().startsWith(GE.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),o=r.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new JO.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(wc.OnWriteLog,a=>a.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),u=s.toString();return{returnCode:s,returnMessage:u,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new JO.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(wc.OnWriteLog,o=>{let u=o.address.bech32()==e.sender.bech32(),a=o.topics[0]?.hex()==n.hex();return u&&a});if(s){let{returnCode:o,returnDataParts:u}=this.sliceDataFieldInParts(s.data),a=o.toString();return{returnCode:o,returnMessage:a,values:u}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||p.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new XO.ErrCannotParseContractResults("no return code");return{returnCode:yc.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){let n=e.topics.map(o=>p.Buffer.from(o.valueOf())).slice(1),i=e.dataPayload?.valueOf()||p.Buffer.from([]),s=e.additionalData?.map(o=>p.Buffer.from(o.valueOf()))||[];return s.length===0&&i.length&&s.push(p.Buffer.from(i)),this.doParseEvent({topics:n,dataItems:s,eventDefinition:r})}doParseEvent(e){let r={},n=e.eventDefinition.inputs.filter(u=>u.indexed),i=this.argsSerializer.buffersToValues(e.topics,n);for(let u=0;u!u.indexed),o=this.argsSerializer.buffersToValues(e.dataItems,s);for(let u=0;u{"use strict";h();Object.defineProperty(E0,"__esModule",{value:!0});E0.SmartContract=void 0;var A0=ke(),zE=hE(),QE=yr(),GW=Ie(),KE=SE(),WE=TE(),jW=Bn(),eD=uE(),tD=lE(),rD=LE(),zW=n0(),QW=Wf(),$E=class{constructor(e={}){this.address=A0.Address.empty(),this.methodsExplicit={},this.methods={},this.address=e.address||A0.Address.empty(),this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new tD.ContractFunction(i);return new rD.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new tD.ContractFunction(i),u=zW.NativeSerializer.nativeToTypedValues(s||[],n);return new rD.Interaction(e,o,u||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return jW.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:u,chainID:a}){zE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()");let c=new WE.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new KE.SmartContractTransactionsFactory({config:c,abi:this.abi}),d=p.Buffer.from(r.toString(),"hex"),w=this.getMetadataPropertiesAsObject(n),A=f.createTransactionForDeploy({sender:e,bytecode:d,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:w.upgradeable,isReadable:w.readable,isPayable:w.payable,isPayableBySmartContract:w.payableBySc});return A.setChainID(a),A.setValue(s??0),A.setGasPrice(u??QE.TRANSACTION_MIN_GAS_PRICE),A}getMetadataPropertiesAsObject(e){let r;return e?r=eD.CodeMetadata.fromBytes(p.Buffer.from(e.toString(),"hex")):r=new eD.CodeMetadata,r.toJSON()}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:u,chainID:a}){zE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress();let c=new WE.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new KE.SmartContractTransactionsFactory({config:c,abi:this.abi}),d=Uint8Array.from(p.Buffer.from(r.toString(),"hex")),w=this.getMetadataPropertiesAsObject(n),A=f.createTransactionForUpgrade({sender:e,contract:this.getAddress(),bytecode:d,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:w.upgradeable,isReadable:w.readable,isPayable:w.payable,isPayableBySmartContract:w.payableBySc});return A.setChainID(a),A.setValue(s??0),A.setGasPrice(u??QE.TRANSACTION_MIN_GAS_PRICE),A}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:u,caller:a}){zE.Compatibility.guardAddressIsSetAndNonZero(a,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress();let c=new WE.TransactionsFactoryConfig({chainID:u.valueOf()}),f=new KE.SmartContractTransactionsFactory({config:c,abi:this.abi});r=r||[],n=n||0;let d=f.createTransactionForExecute({sender:a,contract:s||this.getAddress(),function:e.toString(),gasLimit:BigInt(i.valueOf()),arguments:r});return d.setChainID(u),d.setValue(n),d.setGasPrice(o??QE.TRANSACTION_MIN_GAS_PRICE),d}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new QW.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new GW.ErrContractHasNoAddress}static computeAddress(e,r){let n=A0.Address.fromBech32(e.bech32());return new A0.AddressComputer().computeContractAddress(n,BigInt(r.valueOf()))}};E0.SmartContract=$E});var iD=D(So=>{"use strict";h();Object.defineProperty(So,"__esModule",{value:!0});So.ContractCallPayloadBuilder=So.ContractUpgradePayloadBuilder=So.ContractDeployPayloadBuilder=void 0;var KW=yr(),ZE=Bs(),eb=Bn(),WW=lc(),YE=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(){eb.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${KW.WasmVirtualMachine}@${r}`;return n=tb(n,this.arguments),new ZE.TransactionPayload(n)}};So.ContractDeployPayloadBuilder=YE;var JE=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(){eb.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=tb(n,this.arguments),new ZE.TransactionPayload(n)}};So.ContractUpgradePayloadBuilder=JE;var XE=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(){eb.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=tb(e,this.arguments),new ZE.TransactionPayload(e)}};So.ContractCallPayloadBuilder=XE;function tb(t,e){let{argumentsString:r,count:n}=new WW.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Vn=D(Xt=>{"use strict";h();var $W=Xt&&Xt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kr=Xt&&Xt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$W(e,t,r)};Object.defineProperty(Xt,"__esModule",{value:!0});kr(lc(),Xt);kr(EO(),Xt);kr(ZA(),Xt);kr(uE(),Xt);kr(lE(),Xt);kr(LE(),Xt);kr(PE(),Xt);kr(FE(),Xt);kr(n0(),Xt);kr(Wf(),Xt);kr(ZO(),Xt);kr(HE(),Xt);kr(nD(),Xt);kr(iD(),Xt);kr($t(),Xt)});var vc=D(ar=>{"use strict";h();Object.defineProperty(ar,"__esModule",{value:!0});ar.gatherAllEvents=ar.findEventsByFirstTopic=ar.findEventsByIdentifier=ar.findEventsByPredicate=ar.SmartContractCallOutcome=ar.TransactionOutcome=ar.SmartContractResult=ar.TransactionLogs=ar.TransactionEvent=void 0;var rb=class{constructor(e){this.address="",this.identifier="",this.topics=[],this.dataItems=[],Object.assign(this,e)}};ar.TransactionEvent=rb;var $f=class{constructor(e){this.address="",this.events=[],Object.assign(this,e)}};ar.TransactionLogs=$f;var nb=class{constructor(e){this.sender="",this.receiver="",this.data=new Uint8Array,this.logs=new $f({}),Object.assign(this,e)}};ar.SmartContractResult=nb;var ib=class{constructor(e){this.directSmartContractCallOutcome=new b0({}),this.smartContractResults=[],this.logs=new $f({}),Object.assign(this,e)}};ar.TransactionOutcome=ib;var b0=class{constructor(e){this.function="",this.returnDataParts=[],this.returnMessage="",this.returnCode="",Object.assign(this,e)}};ar.SmartContractCallOutcome=b0;function sb(t,e){return sD(t).filter(e)}ar.findEventsByPredicate=sb;function YW(t,e){return sb(t,r=>r.identifier==e)}ar.findEventsByIdentifier=YW;function JW(t,e){return sb(t,r=>r.topics[0]?.toString()==e)}ar.findEventsByFirstTopic=JW;function sD(t){let e=[];e.push(...t.logs.events);for(let r of t.smartContractResults)e.push(...r.logs.events);return e}ar.gatherAllEvents=sD});var ab=D(S0=>{"use strict";h();Object.defineProperty(S0,"__esModule",{value:!0});S0.TransactionsConverter=void 0;var XW=Vn(),ZW=en(),Ac=vc(),ob=class{transactionToPlainObject(e){return{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:this.toBase64OrUndefined(e.senderUsername),receiverUsername:this.toBase64OrUndefined(e.receiverUsername),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:this.toBase64OrUndefined(e.data),chainID:e.chainID.valueOf(),version:e.version,options:e.options==0?void 0:e.options,guardian:e.guardian?e.guardian:void 0,signature:this.toHexOrUndefined(e.signature),guardianSignature:this.toHexOrUndefined(e.guardianSignature)}}toBase64OrUndefined(e){return e&&e.length?p.Buffer.from(e).toString("base64"):void 0}toHexOrUndefined(e){return e&&e.length?p.Buffer.from(e).toString("hex"):void 0}plainObjectToTransaction(e){return new ZW.Transaction({nonce:BigInt(e.nonce),value:BigInt(e.value||""),receiver:e.receiver,receiverUsername:this.bufferFromBase64(e.receiverUsername).toString(),sender:e.sender,senderUsername:this.bufferFromBase64(e.senderUsername).toString(),guardian:e.guardian,gasPrice:BigInt(e.gasPrice),gasLimit:BigInt(e.gasLimit),data:this.bufferFromBase64(e.data),chainID:String(e.chainID),version:Number(e.version),options:Number(e.options),signature:this.bufferFromHex(e.signature),guardianSignature:this.bufferFromHex(e.guardianSignature)})}bufferFromBase64(e){return p.Buffer.from(e||"","base64")}bufferFromHex(e){return p.Buffer.from(e||"","hex")}transactionOnNetworkToOutcome(e){let n=new XW.ResultsParser().parseUntypedOutcome(e),i=new Ac.SmartContractCallOutcome({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.values}),s=e.contractResults.items.map(u=>this.smartContractResultOnNetworkToSmartContractResult(u)),o=new Ac.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(u=>this.eventOnNetworkToEvent(u))});return new Ac.TransactionOutcome({logs:o,smartContractResults:s,directSmartContractCallOutcome:i})}smartContractResultOnNetworkToSmartContractResult(e){return new Ac.SmartContractResult({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:p.Buffer.from(e.data),logs:new Ac.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(r=>this.eventOnNetworkToEvent(r))})})}eventOnNetworkToEvent(e){let r=e.dataPayload?.valueOf()||p.Buffer.from(e.data||""),n=e.additionalData?.map(i=>p.Buffer.from(i.valueOf()))||[];return n.length===0&&r.length&&n.push(p.Buffer.from(r)),new Ac.TransactionEvent({address:e.address.bech32(),identifier:e.identifier,topics:e.topics.map(i=>p.Buffer.from(i.hex(),"hex")),dataItems:n})}};S0.TransactionsConverter=ob});var oD=D(Xi=>{"use strict";h();var e$=Xi&&Xi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t$=Xi&&Xi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r$=Xi&&Xi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e$(e,t,r);return t$(e,t),e};Object.defineProperty(Xi,"__esModule",{value:!0});Xi.Hash=void 0;var n$=r$(Ie()),ub=class t{constructor(e){if(!e)this.hash=p.Buffer.from([]);else if(e instanceof p.Buffer)this.hash=e;else if(typeof e=="string")this.hash=p.Buffer.from(e,"hex");else throw new n$.ErrBadType("hash","buffer | string",e)}static empty(){return new t(p.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};Xi.Hash=ub});var Yf=D(Gn=>{"use strict";h();var i$=Gn&&Gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s$=Gn&&Gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o$=Gn&&Gn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i$(e,t,r);return s$(e,t),e};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.interpretSignatureAsBuffer=Gn.Signature=void 0;var aD=o$(Ie()),uD=64,cb=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof p.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new aD.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return p.Buffer.from(e,"hex").length==uD}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=uD)throw new aD.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Gn.Signature=cb;function a$(t){if(ArrayBuffer.isView(t))return p.Buffer.from(t);if(t.hex!=null)return p.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Gn.interpretSignatureAsBuffer=a$});var lD=D((Awe,cD)=>{"use strict";h();cD.exports=u$;function u$(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";h();var I0=dD;I0.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Ec=new Array(64),hD=new Array(123);for(vi=0;vi<64;)hD[Ec[vi]=vi<26?vi+65:vi<52?vi+71:vi<62?vi-4:vi-59|43]=vi++;var vi;I0.encode=function(e,r,n){for(var i=null,s=[],o=0,u=0,a;r>2],a=(c&3)<<4,u=1;break;case 1:s[o++]=Ec[a|c>>4],a=(c&15)<<2,u=2;break;case 2:s[o++]=Ec[a|c>>6],s[o++]=Ec[c&63],u=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return u&&(s[o++]=Ec[a],s[o++]=61,u===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var fD="invalid encoding";I0.decode=function(e,r,n){for(var i=n,s=0,o,u=0;u1)break;if((a=hD[a])===void 0)throw Error(fD);switch(s){case 0:o=a,s=1;break;case 1:r[n++]=o<<2|(a&48)>>4,o=a,s=2;break;case 2:r[n++]=(o&15)<<4|(a&60)>>2,o=a,s=3;break;case 3:r[n++]=(o&3)<<6|a,s=0;break}}if(s===1)throw Error(fD);return n-i};I0.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var mD=D((Iwe,pD)=>{"use strict";h();pD.exports=_0;function _0(){this._listeners={}}_0.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};_0.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";h();bD.exports=yD(yD);function yD(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(a,c,f){e[0]=a,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(a,c,f){e[0]=a,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(a,c){return r[0]=a[c],r[1]=a[c+1],r[2]=a[c+2],r[3]=a[c+3],e[0]}function u(a,c){return r[3]=a[c],r[2]=a[c+1],r[1]=a[c+2],r[0]=a[c+3],e[0]}t.readFloatLE=n?o:u,t.readFloatBE=n?u:o}():function(){function e(n,i,s,o){var u=i<0?1:0;if(u&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((u<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((u<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var a=Math.floor(Math.log(i)/Math.LN2),c=Math.round(i*Math.pow(2,-a)*8388608)&8388607;n((u<<31|a+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,wD),t.writeFloatBE=e.bind(null,vD);function r(n,i,s){var o=n(i,s),u=(o>>31)*2+1,a=o>>>23&255,c=o&8388607;return a===255?c?NaN:u*(1/0):a===0?u*1401298464324817e-60*c:u*Math.pow(2,a-150)*(c+8388608)}t.readFloatLE=r.bind(null,AD),t.readFloatBE=r.bind(null,ED)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(a,c,f){e[0]=a,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(a,c,f){e[0]=a,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(a,c){return r[0]=a[c],r[1]=a[c+1],r[2]=a[c+2],r[3]=a[c+3],r[4]=a[c+4],r[5]=a[c+5],r[6]=a[c+6],r[7]=a[c+7],e[0]}function u(a,c){return r[7]=a[c],r[6]=a[c+1],r[5]=a[c+2],r[4]=a[c+3],r[3]=a[c+4],r[2]=a[c+5],r[1]=a[c+6],r[0]=a[c+7],e[0]}t.readDoubleLE=n?o:u,t.readDoubleBE=n?u:o}():function(){function e(n,i,s,o,u,a){var c=o<0?1:0;if(c&&(o=-o),o===0)n(0,u,a+i),n(1/o>0?0:2147483648,u,a+s);else if(isNaN(o))n(0,u,a+i),n(2146959360,u,a+s);else if(o>17976931348623157e292)n(0,u,a+i),n((c<<31|2146435072)>>>0,u,a+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,u,a+i),n((c<<31|f/4294967296)>>>0,u,a+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,u,a+i),n((c<<31|d+1023<<20|f*1048576&1048575)>>>0,u,a+s)}}}t.writeDoubleLE=e.bind(null,wD,0,4),t.writeDoubleBE=e.bind(null,vD,4,0);function r(n,i,s,o,u){var a=n(o,u+i),c=n(o,u+s),f=(c>>31)*2+1,d=c>>>20&2047,w=4294967296*(c&1048575)+a;return d===2047?w?NaN:f*(1/0):d===0?f*5e-324*w:f*Math.pow(2,d-1075)*(w+4503599627370496)}t.readDoubleLE=r.bind(null,AD,0,4),t.readDoubleBE=r.bind(null,ED,4,0)}(),t}function wD(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function vD(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function AD(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function ED(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var ID=D((exports,module)=>{"use strict";h();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var TD=D(_D=>{"use strict";h();var lb=_D;lb.length=function(e){for(var r=0,n=0,i=0;i191&&a<224?o[u++]=(a&31)<<6|e[r++]&63:a>239&&a<365?(a=((a&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[u++]=55296+(a>>10),o[u++]=56320+(a&1023)):o[u++]=(a&15)<<12|(e[r++]&63)<<6|e[r++]&63,u>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),u=0);return s?(u&&s.push(String.fromCharCode.apply(String,o.slice(0,u))),s.join("")):String.fromCharCode.apply(String,o.slice(0,u))};lb.write=function(e,r,n){for(var i=n,s,o,u=0;u>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(u+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++u,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var ND=D((Dwe,CD)=>{"use strict";h();CD.exports=c$;function c$(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(a){if(a<1||a>i)return t(a);o+a>n&&(s=t(n),o=0);var c=e.call(s,o,o+=a);return o&7&&(o=(o|7)+1),c}}});var OD=D((Rwe,xD)=>{"use strict";h();xD.exports=wr;var Jf=_o();function wr(t,e){this.lo=t>>>0,this.hi=e>>>0}var Va=wr.zero=new wr(0,0);Va.toNumber=function(){return 0};Va.zzEncode=Va.zzDecode=function(){return this};Va.length=function(){return 1};var l$=wr.zeroHash="\0\0\0\0\0\0\0\0";wr.fromNumber=function(e){if(e===0)return Va;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new wr(n,i)};wr.from=function(e){if(typeof e=="number")return wr.fromNumber(e);if(Jf.isString(e))if(Jf.Long)e=Jf.Long.fromString(e);else return wr.fromNumber(parseInt(e,10));return e.low||e.high?new wr(e.low>>>0,e.high>>>0):Va};wr.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};wr.prototype.toLong=function(e){return Jf.Long?new Jf.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Io=String.prototype.charCodeAt;wr.fromHash=function(e){return e===l$?Va:new wr((Io.call(e,0)|Io.call(e,1)<<8|Io.call(e,2)<<16|Io.call(e,3)<<24)>>>0,(Io.call(e,4)|Io.call(e,5)<<8|Io.call(e,6)<<16|Io.call(e,7)<<24)>>>0)};wr.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)};wr.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};wr.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};wr.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var _o=D(fb=>{"use strict";h();var ve=fb;ve.asPromise=lD();ve.base64=gD();ve.EventEmitter=mD();ve.float=SD();ve.inquire=ID();ve.utf8=TD();ve.pool=ND();ve.LongBits=OD();ve.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);ve.global=ve.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||fb;ve.emptyArray=Object.freeze?Object.freeze([]):[];ve.emptyObject=Object.freeze?Object.freeze({}):{};ve.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};ve.isString=function(e){return typeof e=="string"||e instanceof String};ve.isObject=function(e){return e&&typeof e=="object"};ve.isset=ve.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};ve.Buffer=function(){try{var t=ve.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();ve._Buffer_from=null;ve._Buffer_allocUnsafe=null;ve.newBuffer=function(e){return typeof e=="number"?ve.Buffer?ve._Buffer_allocUnsafe(e):new ve.Array(e):ve.Buffer?ve._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};ve.Array=typeof Uint8Array<"u"?Uint8Array:Array;ve.Long=ve.global.dcodeIO&&ve.global.dcodeIO.Long||ve.global.Long||ve.inquire("long");ve.key2Re=/^true|false|0|1$/;ve.key32Re=/^-?(?:0|[1-9][0-9]*)$/;ve.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;ve.longToHash=function(e){return e?ve.LongBits.from(e).toHash():ve.LongBits.zeroHash};ve.longFromHash=function(e,r){var n=ve.LongBits.fromHash(e);return ve.Long?ve.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function DD(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};ve.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";h();LD.exports=Ue;var jn=_o(),hb,T0=jn.LongBits,RD=jn.base64,BD=jn.utf8;function Xf(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function gb(){}function f$(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Ue(){this.len=0,this.head=new Xf(gb,0,0),this.tail=this.head,this.states=null}var MD=function(){return jn.Buffer?function(){return(Ue.create=function(){return new hb})()}:function(){return new Ue}};Ue.create=MD();Ue.alloc=function(e){return new jn.Array(e)};jn.Array!==Array&&(Ue.alloc=jn.pool(Ue.alloc,jn.Array.prototype.subarray));Ue.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Xf(e,r,n),this.len+=r,this};function pb(t,e,r){e[r]=t&255}function h$(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function mb(t,e){this.len=t,this.next=void 0,this.val=e}mb.prototype=Object.create(Xf.prototype);mb.prototype.fn=h$;Ue.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new mb((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Ue.prototype.int32=function(e){return e<0?this._push(yb,10,T0.fromNumber(e)):this.uint32(e)};Ue.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function yb(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Ue.prototype.uint64=function(e){var r=T0.from(e);return this._push(yb,r.length(),r)};Ue.prototype.int64=Ue.prototype.uint64;Ue.prototype.sint64=function(e){var r=T0.from(e).zzEncode();return this._push(yb,r.length(),r)};Ue.prototype.bool=function(e){return this._push(pb,1,e?1:0)};function db(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Ue.prototype.fixed32=function(e){return this._push(db,4,e>>>0)};Ue.prototype.sfixed32=Ue.prototype.fixed32;Ue.prototype.fixed64=function(e){var r=T0.from(e);return this._push(db,4,r.lo)._push(db,4,r.hi)};Ue.prototype.sfixed64=Ue.prototype.fixed64;Ue.prototype.float=function(e){return this._push(jn.float.writeFloatLE,4,e)};Ue.prototype.double=function(e){return this._push(jn.float.writeDoubleLE,8,e)};var d$=jn.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(pb,1,0);if(jn.isString(e)){var n=Ue.alloc(r=RD.length(e));RD.decode(e,n,0),e=n}return this.uint32(r)._push(d$,r,e)};Ue.prototype.string=function(e){var r=BD.length(e);return r?this.uint32(r)._push(BD.write,r,e):this._push(pb,1,0)};Ue.prototype.fork=function(){return this.states=new f$(this),this.head=this.tail=new Xf(gb,0,0),this.len=0,this};Ue.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 Xf(gb,0,0),this.len=0),this};Ue.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Ue.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Ue._configure=function(t){hb=t,Ue.create=MD(),hb._configure()}});var qD=D((qwe,UD)=>{"use strict";h();UD.exports=Zi;var FD=wb();(Zi.prototype=Object.create(FD.prototype)).constructor=Zi;var To=_o();function Zi(){FD.call(this)}Zi._configure=function(){Zi.alloc=To._Buffer_allocUnsafe,Zi.writeBytesBuffer=To.Buffer&&To.Buffer.prototype instanceof Uint8Array&&To.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(Zi.writeBytesBuffer,r,e),this};function g$(t,e,r){t.length<40?To.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Zi.prototype.string=function(e){var r=To.Buffer.byteLength(e);return this.uint32(r),r&&this._push(g$,r,e),this};Zi._configure()});var Eb=D((kwe,jD)=>{"use strict";h();jD.exports=Zt;var Ai=_o(),Ab,HD=Ai.LongBits,p$=Ai.utf8;function Ei(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Zt(t){this.buf=t,this.pos=0,this.len=t.length}var VD=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Zt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Zt(e);throw Error("illegal buffer")},GD=function(){return Ai.Buffer?function(r){return(Zt.create=function(i){return Ai.Buffer.isBuffer(i)?new Ab(i):VD(i)})(r)}:VD};Zt.create=GD();Zt.prototype._slice=Ai.Array.prototype.subarray||Ai.Array.prototype.slice;Zt.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,Ei(this,10);return e}}();Zt.prototype.int32=function(){return this.uint32()|0};Zt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function vb(){var t=new HD(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ei(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Ei(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Zt.prototype.bool=function(){return this.uint32()!==0};function C0(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Zt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ei(this,4);return C0(this.buf,this.pos+=4)};Zt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ei(this,4);return C0(this.buf,this.pos+=4)|0};function kD(){if(this.pos+8>this.len)throw Ei(this,8);return new HD(C0(this.buf,this.pos+=4),C0(this.buf,this.pos+=4))}Zt.prototype.float=function(){if(this.pos+4>this.len)throw Ei(this,4);var e=Ai.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Zt.prototype.double=function(){if(this.pos+8>this.len)throw Ei(this,4);var e=Ai.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Zt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Ei(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=Ai.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};Zt.prototype.string=function(){var e=this.bytes();return p$.read(e,0,e.length)};Zt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ei(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ei(this);while(this.buf[this.pos++]&128);return this};Zt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Zt._configure=function(t){Ab=t,Zt.create=GD(),Ab._configure();var e=Ai.Long?"toLong":"toNumber";Ai.merge(Zt.prototype,{int64:function(){return vb.call(this)[e](!1)},uint64:function(){return vb.call(this)[e](!0)},sint64:function(){return vb.call(this).zzDecode()[e](!1)},fixed64:function(){return kD.call(this)[e](!0)},sfixed64:function(){return kD.call(this)[e](!1)}})}});var WD=D((Gwe,KD)=>{"use strict";h();KD.exports=ka;var QD=Eb();(ka.prototype=Object.create(QD.prototype)).constructor=ka;var zD=_o();function ka(t){QD.call(this,t)}ka._configure=function(){zD.Buffer&&(ka.prototype._slice=zD.Buffer.prototype.slice)};ka.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))};ka._configure()});var YD=D((zwe,$D)=>{"use strict";h();$D.exports=Zf;var bb=_o();(Zf.prototype=Object.create(bb.EventEmitter.prototype)).constructor=Zf;function Zf(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");bb.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Zf.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return bb.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,c){if(a)return o.emit("error",a,e),s(a);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(u){o.emit("error",u,e),setTimeout(function(){s(u)},0);return}};Zf.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var XD=D(JD=>{"use strict";h();var m$=JD;m$.Service=YD()});var eP=D(($we,ZD)=>{"use strict";h();ZD.exports={}});var nP=D(rP=>{"use strict";h();var nn=rP;nn.build="minimal";nn.Writer=wb();nn.BufferWriter=qD();nn.Reader=Eb();nn.BufferReader=WD();nn.util=_o();nn.rpc=XD();nn.roots=eP();nn.configure=tP;function tP(){nn.util._configure(),nn.Writer._configure(nn.BufferWriter),nn.Reader._configure(nn.BufferReader)}tP()});var sP=D((Zwe,iP)=>{"use strict";h();iP.exports=nP()});var aP=D((oP,eh)=>{"use strict";h();(function(t,e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof Pd=="function"&&typeof eh=="object"&&eh&&eh.exports&&(eh.exports=e(sP()))})(oP,function(t){"use strict";var e=t.Reader,r=t.Writer,n=t.util,i=t.roots.default||(t.roots.default={});return i.proto=function(){var s={};return s.Transaction=function(){function o(u){if(u)for(var a=Object.keys(u),c=0;c>>3){case 1:{d.Nonce=a.uint64();break}case 2:{d.Value=a.bytes();break}case 3:{d.RcvAddr=a.bytes();break}case 4:{d.RcvUserName=a.bytes();break}case 5:{d.SndAddr=a.bytes();break}case 6:{d.SndUserName=a.bytes();break}case 7:{d.GasPrice=a.uint64();break}case 8:{d.GasLimit=a.uint64();break}case 9:{d.Data=a.bytes();break}case 10:{d.ChainID=a.bytes();break}case 11:{d.Version=a.uint32();break}case 12:{d.Signature=a.bytes();break}case 13:{d.Options=a.uint32();break}case 14:{d.GuardianAddr=a.bytes();break}case 15:{d.GuardianSignature=a.bytes();break}default:a.skipType(w&7);break}}return d},o.decodeDelimited=function(a){return a instanceof e||(a=new e(a)),this.decode(a,a.uint32())},o.verify=function(a){return typeof a!="object"||a===null?"object expected":a.Nonce!=null&&a.hasOwnProperty("Nonce")&&!n.isInteger(a.Nonce)&&!(a.Nonce&&n.isInteger(a.Nonce.low)&&n.isInteger(a.Nonce.high))?"Nonce: integer|Long expected":a.Value!=null&&a.hasOwnProperty("Value")&&!(a.Value&&typeof a.Value.length=="number"||n.isString(a.Value))?"Value: buffer expected":a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&!(a.RcvAddr&&typeof a.RcvAddr.length=="number"||n.isString(a.RcvAddr))?"RcvAddr: buffer expected":a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&!(a.RcvUserName&&typeof a.RcvUserName.length=="number"||n.isString(a.RcvUserName))?"RcvUserName: buffer expected":a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&!(a.SndAddr&&typeof a.SndAddr.length=="number"||n.isString(a.SndAddr))?"SndAddr: buffer expected":a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&!(a.SndUserName&&typeof a.SndUserName.length=="number"||n.isString(a.SndUserName))?"SndUserName: buffer expected":a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&!n.isInteger(a.GasPrice)&&!(a.GasPrice&&n.isInteger(a.GasPrice.low)&&n.isInteger(a.GasPrice.high))?"GasPrice: integer|Long expected":a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&!n.isInteger(a.GasLimit)&&!(a.GasLimit&&n.isInteger(a.GasLimit.low)&&n.isInteger(a.GasLimit.high))?"GasLimit: integer|Long expected":a.Data!=null&&a.hasOwnProperty("Data")&&!(a.Data&&typeof a.Data.length=="number"||n.isString(a.Data))?"Data: buffer expected":a.ChainID!=null&&a.hasOwnProperty("ChainID")&&!(a.ChainID&&typeof a.ChainID.length=="number"||n.isString(a.ChainID))?"ChainID: buffer expected":a.Version!=null&&a.hasOwnProperty("Version")&&!n.isInteger(a.Version)?"Version: integer expected":a.Signature!=null&&a.hasOwnProperty("Signature")&&!(a.Signature&&typeof a.Signature.length=="number"||n.isString(a.Signature))?"Signature: buffer expected":a.Options!=null&&a.hasOwnProperty("Options")&&!n.isInteger(a.Options)?"Options: integer expected":a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&!(a.GuardianAddr&&typeof a.GuardianAddr.length=="number"||n.isString(a.GuardianAddr))?"GuardianAddr: buffer expected":a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&!(a.GuardianSignature&&typeof a.GuardianSignature.length=="number"||n.isString(a.GuardianSignature))?"GuardianSignature: buffer expected":null},o.fromObject=function(a){if(a instanceof i.proto.Transaction)return a;var c=new i.proto.Transaction;return a.Nonce!=null&&(n.Long?(c.Nonce=n.Long.fromValue(a.Nonce)).unsigned=!0:typeof a.Nonce=="string"?c.Nonce=parseInt(a.Nonce,10):typeof a.Nonce=="number"?c.Nonce=a.Nonce:typeof a.Nonce=="object"&&(c.Nonce=new n.LongBits(a.Nonce.low>>>0,a.Nonce.high>>>0).toNumber(!0))),a.Value!=null&&(typeof a.Value=="string"?n.base64.decode(a.Value,c.Value=n.newBuffer(n.base64.length(a.Value)),0):a.Value.length>=0&&(c.Value=a.Value)),a.RcvAddr!=null&&(typeof a.RcvAddr=="string"?n.base64.decode(a.RcvAddr,c.RcvAddr=n.newBuffer(n.base64.length(a.RcvAddr)),0):a.RcvAddr.length>=0&&(c.RcvAddr=a.RcvAddr)),a.RcvUserName!=null&&(typeof a.RcvUserName=="string"?n.base64.decode(a.RcvUserName,c.RcvUserName=n.newBuffer(n.base64.length(a.RcvUserName)),0):a.RcvUserName.length>=0&&(c.RcvUserName=a.RcvUserName)),a.SndAddr!=null&&(typeof a.SndAddr=="string"?n.base64.decode(a.SndAddr,c.SndAddr=n.newBuffer(n.base64.length(a.SndAddr)),0):a.SndAddr.length>=0&&(c.SndAddr=a.SndAddr)),a.SndUserName!=null&&(typeof a.SndUserName=="string"?n.base64.decode(a.SndUserName,c.SndUserName=n.newBuffer(n.base64.length(a.SndUserName)),0):a.SndUserName.length>=0&&(c.SndUserName=a.SndUserName)),a.GasPrice!=null&&(n.Long?(c.GasPrice=n.Long.fromValue(a.GasPrice)).unsigned=!0:typeof a.GasPrice=="string"?c.GasPrice=parseInt(a.GasPrice,10):typeof a.GasPrice=="number"?c.GasPrice=a.GasPrice:typeof a.GasPrice=="object"&&(c.GasPrice=new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0))),a.GasLimit!=null&&(n.Long?(c.GasLimit=n.Long.fromValue(a.GasLimit)).unsigned=!0:typeof a.GasLimit=="string"?c.GasLimit=parseInt(a.GasLimit,10):typeof a.GasLimit=="number"?c.GasLimit=a.GasLimit:typeof a.GasLimit=="object"&&(c.GasLimit=new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0))),a.Data!=null&&(typeof a.Data=="string"?n.base64.decode(a.Data,c.Data=n.newBuffer(n.base64.length(a.Data)),0):a.Data.length>=0&&(c.Data=a.Data)),a.ChainID!=null&&(typeof a.ChainID=="string"?n.base64.decode(a.ChainID,c.ChainID=n.newBuffer(n.base64.length(a.ChainID)),0):a.ChainID.length>=0&&(c.ChainID=a.ChainID)),a.Version!=null&&(c.Version=a.Version>>>0),a.Signature!=null&&(typeof a.Signature=="string"?n.base64.decode(a.Signature,c.Signature=n.newBuffer(n.base64.length(a.Signature)),0):a.Signature.length>=0&&(c.Signature=a.Signature)),a.Options!=null&&(c.Options=a.Options>>>0),a.GuardianAddr!=null&&(typeof a.GuardianAddr=="string"?n.base64.decode(a.GuardianAddr,c.GuardianAddr=n.newBuffer(n.base64.length(a.GuardianAddr)),0):a.GuardianAddr.length>=0&&(c.GuardianAddr=a.GuardianAddr)),a.GuardianSignature!=null&&(typeof a.GuardianSignature=="string"?n.base64.decode(a.GuardianSignature,c.GuardianSignature=n.newBuffer(n.base64.length(a.GuardianSignature)),0):a.GuardianSignature.length>=0&&(c.GuardianSignature=a.GuardianSignature)),c},o.toObject=function(a,c){c||(c={});var f={};if(c.defaults){if(n.Long){var d=new n.Long(0,0,!0);f.Nonce=c.longs===String?d.toString():c.longs===Number?d.toNumber():d}else f.Nonce=c.longs===String?"0":0;if(c.bytes===String?f.Value="":(f.Value=[],c.bytes!==Array&&(f.Value=n.newBuffer(f.Value))),c.bytes===String?f.RcvAddr="":(f.RcvAddr=[],c.bytes!==Array&&(f.RcvAddr=n.newBuffer(f.RcvAddr))),c.bytes===String?f.RcvUserName="":(f.RcvUserName=[],c.bytes!==Array&&(f.RcvUserName=n.newBuffer(f.RcvUserName))),c.bytes===String?f.SndAddr="":(f.SndAddr=[],c.bytes!==Array&&(f.SndAddr=n.newBuffer(f.SndAddr))),c.bytes===String?f.SndUserName="":(f.SndUserName=[],c.bytes!==Array&&(f.SndUserName=n.newBuffer(f.SndUserName))),n.Long){var d=new n.Long(0,0,!0);f.GasPrice=c.longs===String?d.toString():c.longs===Number?d.toNumber():d}else f.GasPrice=c.longs===String?"0":0;if(n.Long){var d=new n.Long(0,0,!0);f.GasLimit=c.longs===String?d.toString():c.longs===Number?d.toNumber():d}else f.GasLimit=c.longs===String?"0":0;c.bytes===String?f.Data="":(f.Data=[],c.bytes!==Array&&(f.Data=n.newBuffer(f.Data))),c.bytes===String?f.ChainID="":(f.ChainID=[],c.bytes!==Array&&(f.ChainID=n.newBuffer(f.ChainID))),f.Version=0,c.bytes===String?f.Signature="":(f.Signature=[],c.bytes!==Array&&(f.Signature=n.newBuffer(f.Signature))),f.Options=0,c.bytes===String?f.GuardianAddr="":(f.GuardianAddr=[],c.bytes!==Array&&(f.GuardianAddr=n.newBuffer(f.GuardianAddr))),c.bytes===String?f.GuardianSignature="":(f.GuardianSignature=[],c.bytes!==Array&&(f.GuardianSignature=n.newBuffer(f.GuardianSignature)))}return a.Nonce!=null&&a.hasOwnProperty("Nonce")&&(typeof a.Nonce=="number"?f.Nonce=c.longs===String?String(a.Nonce):a.Nonce:f.Nonce=c.longs===String?n.Long.prototype.toString.call(a.Nonce):c.longs===Number?new n.LongBits(a.Nonce.low>>>0,a.Nonce.high>>>0).toNumber(!0):a.Nonce),a.Value!=null&&a.hasOwnProperty("Value")&&(f.Value=c.bytes===String?n.base64.encode(a.Value,0,a.Value.length):c.bytes===Array?Array.prototype.slice.call(a.Value):a.Value),a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&(f.RcvAddr=c.bytes===String?n.base64.encode(a.RcvAddr,0,a.RcvAddr.length):c.bytes===Array?Array.prototype.slice.call(a.RcvAddr):a.RcvAddr),a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&(f.RcvUserName=c.bytes===String?n.base64.encode(a.RcvUserName,0,a.RcvUserName.length):c.bytes===Array?Array.prototype.slice.call(a.RcvUserName):a.RcvUserName),a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&(f.SndAddr=c.bytes===String?n.base64.encode(a.SndAddr,0,a.SndAddr.length):c.bytes===Array?Array.prototype.slice.call(a.SndAddr):a.SndAddr),a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&(f.SndUserName=c.bytes===String?n.base64.encode(a.SndUserName,0,a.SndUserName.length):c.bytes===Array?Array.prototype.slice.call(a.SndUserName):a.SndUserName),a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&(typeof a.GasPrice=="number"?f.GasPrice=c.longs===String?String(a.GasPrice):a.GasPrice:f.GasPrice=c.longs===String?n.Long.prototype.toString.call(a.GasPrice):c.longs===Number?new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0):a.GasPrice),a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&(typeof a.GasLimit=="number"?f.GasLimit=c.longs===String?String(a.GasLimit):a.GasLimit:f.GasLimit=c.longs===String?n.Long.prototype.toString.call(a.GasLimit):c.longs===Number?new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0):a.GasLimit),a.Data!=null&&a.hasOwnProperty("Data")&&(f.Data=c.bytes===String?n.base64.encode(a.Data,0,a.Data.length):c.bytes===Array?Array.prototype.slice.call(a.Data):a.Data),a.ChainID!=null&&a.hasOwnProperty("ChainID")&&(f.ChainID=c.bytes===String?n.base64.encode(a.ChainID,0,a.ChainID.length):c.bytes===Array?Array.prototype.slice.call(a.ChainID):a.ChainID),a.Version!=null&&a.hasOwnProperty("Version")&&(f.Version=a.Version),a.Signature!=null&&a.hasOwnProperty("Signature")&&(f.Signature=c.bytes===String?n.base64.encode(a.Signature,0,a.Signature.length):c.bytes===Array?Array.prototype.slice.call(a.Signature):a.Signature),a.Options!=null&&a.hasOwnProperty("Options")&&(f.Options=a.Options),a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&(f.GuardianAddr=c.bytes===String?n.base64.encode(a.GuardianAddr,0,a.GuardianAddr.length):c.bytes===Array?Array.prototype.slice.call(a.GuardianAddr):a.GuardianAddr),a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&(f.GuardianSignature=c.bytes===String?n.base64.encode(a.GuardianSignature,0,a.GuardianSignature.length):c.bytes===Array?Array.prototype.slice.call(a.GuardianSignature):a.GuardianSignature),f},o.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},o.getTypeUrl=function(a){return a===void 0&&(a="type.googleapis.com"),a+"/proto.Transaction"},o}(),s}(),i})});var uP=D(zn=>{"use strict";h();var y$=zn&&zn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w$=zn&&zn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v$=zn&&zn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y$(e,t,r);return w$(e,t),e},A$=zn&&zn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zn,"__esModule",{value:!0});zn.ProtoSerializer=void 0;var E$=A$((nr(),xe(hr))),Sb=ke(),b$=yr(),S$=v$(Ie()),I$=Pu(),Ib=class{serializeTransaction(e){let r=aP().proto,n=new Sb.Address(e.getReceiver().bech32()).pubkey(),i=new Sb.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:e.getReceiverUsername()?p.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?p.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:p.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==b$.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let a=e.getGuardian();s.GuardianAddr=new Sb.Address(a.bech32()).pubkey(),s.GuardianSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return p.Buffer.from(o)}serializeTransactionValue(e){let r=new E$.default(e.toString());if(r.isZero())return p.Buffer.from([0,0]);let n=I$.bigIntToBuffer(r);return n=p.Buffer.concat([p.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new S$.ErrUnsupportedOperation("deserializeTransaction")}};zn.ProtoSerializer=Ib});var cP=D(Ha=>{"use strict";h();var _$=Ha&&Ha.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T$=Ha&&Ha.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_$(e,t,r)};Object.defineProperty(Ha,"__esModule",{value:!0});T$(uP(),Ha)});var N0=D(Kn=>{"use strict";h();var C$=Kn&&Kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N$=Kn&&Kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x$=Kn&&Kn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C$(e,t,r);return N$(e,t),e},O$=Kn&&Kn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.TransactionComputer=void 0;var lP=O$((nr(),xe(hr))),Qn=yr(),_b=x$(Ie()),D$=cP(),P$=en(),R$=oE(),B$=af(),M$=32,Tb=class{constructor(){}computeTransactionFee(e,r){let n=BigInt(r.MinGasLimit+e.data.length*r.GasPerDataByte);if(n>e.gasLimit)throw new _b.ErrNotEnoughGas(parseInt(e.gasLimit.toString(),10));let i=e.gasPrice,s=n*i;if(n===e.gasLimit)return s;let o=e.gasLimit-n,u=BigInt(new lP.default(i.toString()).multipliedBy(new lP.default(r.GasPriceModifier)).toFixed(0)),a=o*u;return s+a}computeBytesForSigning(e){this.ensureValidTransactionFields(e);let r=this.toPlainObjectForSigning(e),n=JSON.stringify(r);return new Uint8Array(p.Buffer.from(n))}computeBytesForVerifying(e){return this.hasOptionsSetForHashSigning(e)?this.computeHashForSigning(e):this.computeBytesForSigning(e)}computeHashForSigning(e){let r=this.toPlainObjectForSigning(e),n=p.Buffer.from(JSON.stringify(r));return B$("keccak256").update(n).digest()}computeTransactionHash(e){let n=new D$.ProtoSerializer().serializeTransaction(new P$.Transaction(e)),i=R$(M$).update(n).digest("hex");return p.Buffer.from(i,"hex")}hasOptionsSetForGuardedTransaction(e){return(e.options&Qn.TRANSACTION_OPTIONS_TX_GUARDED)==Qn.TRANSACTION_OPTIONS_TX_GUARDED}hasOptionsSetForHashSigning(e){return(e.options&Qn.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Qn.TRANSACTION_OPTIONS_TX_HASH_SIGN}applyGuardian(e,r){e.version= ${Qn.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS}`)}};Kn.TransactionComputer=Tb});var en=D(bc=>{"use strict";h();Object.defineProperty(bc,"__esModule",{value:!0});bc.TransactionHash=bc.Transaction=void 0;var fP=(nr(),xe(hr)),Cb=ke(),Nb=yr(),hP=ab(),L$=oD(),dP=Jl(),gP=Yf(),F$=Bs(),xb=N0(),Ob=class{constructor(e){this.nonce=BigInt(e.nonce?.valueOf()||0n),this.value=e.value?BigInt(new fP.BigNumber(e.value.toString()).toFixed(0)):0n,this.sender=this.addressAsBech32(e.sender),this.receiver=this.addressAsBech32(e.receiver),this.senderUsername=e.senderUsername||"",this.receiverUsername=e.receiverUsername||"",this.gasPrice=BigInt(e.gasPrice?.valueOf()||Nb.TRANSACTION_MIN_GAS_PRICE),this.gasLimit=BigInt(e.gasLimit.valueOf()),this.data=e.data?.valueOf()||new Uint8Array,this.chainID=e.chainID.valueOf(),this.version=Number(e.version?.valueOf()||Nb.TRANSACTION_VERSION_DEFAULT),this.options=Number(e.options?.valueOf()||Nb.TRANSACTION_OPTIONS_DEFAULT),this.guardian=e.guardian?this.addressAsBech32(e.guardian):"",this.signature=e.signature||p.Buffer.from([]),this.guardianSignature=e.guardianSignature||p.Buffer.from([])}addressAsBech32(e){return typeof e=="string"?e:e.bech32()}getNonce(){return Number(this.nonce)}setNonce(e){this.nonce=BigInt(e.valueOf())}getValue(){return this.value}setValue(e){this.value=BigInt(e.toString())}getSender(){return Cb.Address.fromBech32(this.sender)}setSender(e){this.sender=typeof e=="string"?e:e.bech32()}getReceiver(){return Cb.Address.fromBech32(this.receiver)}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return new Cb.Address(this.guardian)}getGasPrice(){return Number(this.gasPrice)}setGasPrice(e){this.gasPrice=BigInt(e.valueOf())}getGasLimit(){return Number(this.gasLimit)}setGasLimit(e){this.gasLimit=BigInt(e.valueOf())}getData(){return new F$.TransactionPayload(p.Buffer.from(this.data))}getChainID(){return this.chainID}setChainID(e){this.chainID=e.valueOf()}getVersion(){return new dP.TransactionVersion(this.version)}setVersion(e){this.version=e.valueOf()}getOptions(){return new dP.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=e.valueOf()}getSignature(){return p.Buffer.from(this.signature)}getGuardianSignature(){return p.Buffer.from(this.guardianSignature)}setGuardian(e){this.guardian=typeof e=="string"?e:e.bech32()}getHash(){return x0.compute(this)}serializeForSigning(){let r=new xb.TransactionComputer().computeBytesForSigning(this);return p.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){return new hP.TransactionsConverter().transactionToPlainObject(this)}static fromPlainObject(e){return new hP.TransactionsConverter().plainObjectToTransaction(e)}applySignature(e){this.signature=gP.interpretSignatureAsBuffer(e)}applyGuardianSignature(e){this.guardianSignature=gP.interpretSignatureAsBuffer(e)}toSendable(){return this.toPlainObject()}computeFee(e){let n=new xb.TransactionComputer().computeTransactionFee(this,e);return new fP.BigNumber(n.toString())}};bc.Transaction=Ob;var x0=class t extends L$.Hash{constructor(e){super(e)}static compute(e){let n=new xb.TransactionComputer().computeTransactionHash(e);return new t(p.Buffer.from(n).toString("hex"))}};bc.TransactionHash=x0});var mP=D(O0=>{"use strict";h();Object.defineProperty(O0,"__esModule",{value:!0});O0.TokenOperationsFactory=void 0;var Db=yr(),U$=so(),pP=Jl(),q$=en(),V$=Bs(),ae=Yd(),Pb=class{constructor(e){this.config=e,this.trueAsHex=ae.utf8ToHex("true"),this.falseAsHex=ae.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.bigIntToHex(e.initialSupply),ae.bigIntToHex(e.numDecimals),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){U$.Logger.info(` +Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}boolToString(e){return e?this.trueAsString:this.falseAsString}};h1.TokenManagementTransactionsFactory=mS});var vS=L(p1=>{"use strict";h();Object.defineProperty(p1,"__esModule",{value:!0});p1.TransactionsFactoryConfig=void 0;var jee=Wp(),yS=class{constructor(e){this.chainID=e.chainID,this.addressHrp=jee.LibraryConfig.DefaultAddressHrp,this.minGasLimit=50000n,this.gasLimitPerByte=1500n,this.gasLimitIssue=60000000n,this.gasLimitToggleBurnRoleGlobally=60000000n,this.gasLimitEsdtLocalMint=300000n,this.gasLimitEsdtLocalBurn=300000n,this.gasLimitSetSpecialRole=60000000n,this.gasLimitPausing=60000000n,this.gasLimitFreezing=60000000n,this.gasLimitWiping=60000000n,this.gasLimitEsdtNftCreate=3000000n,this.gasLimitEsdtNftUpdateAttributes=1000000n,this.gasLimitEsdtNftAddQuantity=1000000n,this.gasLimitEsdtNftBurn=1000000n,this.gasLimitStorePerByte=10000n,this.issueCost=50000000000000000n,this.gasLimitEsdtModifyRoyalties=60000000n,this.gasLimitEsdtModifyCreator=60000000n,this.gasLimitEsdtMetadataUpdate=60000000n,this.gasLimitSetNewUris=60000000n,this.gasLimitNftMetadataRecreate=60000000n,this.gasLimitNftChangeToDynamic=60000000n,this.gasLimitUpdateTokenId=60000000n,this.gasLimitRegisterDynamic=60000000n,this.gasLimitStake=5000000n,this.gasLimitUnstake=5000000n,this.gasLimitUnbond=5000000n,this.gasLimitCreateDelegationContract=50000000n,this.gasLimitDelegationOperations=1000000n,this.additionalGasLimitPerValidatorNode=6000000n,this.additionalGasLimitForDelegationOperations=10000000n,this.gasLimitSaveKeyValue=100000n,this.gasLimitPersistPerByte=1000n,this.gasLimitSetGuardian=250000n,this.gasLimitGuardAccount=250000n,this.gasLimitUnguardAccount=250000n,this.gasLimitESDTTransfer=200000n,this.gasLimitESDTNFTTransfer=200000n,this.gasLimitMultiESDTNFTTransfer=200000n,this.gasLimitClaimDeveloperRewards=6000000n,this.gasLimitChangeOwnerAddress=6000000n}};p1.TransactionsFactoryConfig=yS});var YP=L(g1=>{"use strict";h();Object.defineProperty(g1,"__esModule",{value:!0});g1.TransferTransactionsFactory=void 0;var Fc=Ve(),Ln=yi(),KP=Sc(),qh=Dn(),bS=No(),Qee=hS(),WP=Pl(),Kee=1e5,$P=8e5,wS=class{constructor(e){this.isGasEstimator(e)?this.gasEstimator=e:(this.config=e.config,this.tokenComputer=new KP.TokenComputer,this.tokenTransfersDataBuilder=new Qee.TokenTransfersDataBuilder)}isGasEstimator(e){return typeof e=="object"&&typeof e.forEGLDTransfer=="function"&&typeof e.forESDTTransfer=="function"&&typeof e.forESDTNFTTransfer=="function"&&typeof e.forMultiESDTNFTTransfer=="function"}isGasEstimatorDefined(){return this.gasEstimator!==void 0}ensureConfigIsDefined(){if(this.config===void 0)throw new Fc.Err("'config' is not defined")}createTransactionForNativeTokenTransfer(e){this.ensureConfigIsDefined();let r=e.data||new Uint8Array;return new qh.Transaction({sender:e.sender.bech32(),receiver:e.receiver.bech32(),chainID:this.config.chainID,gasLimit:this.computeGasForMoveBalance(this.config,r),data:r,value:e.nativeAmount})}createTransactionForESDTTokenTransfer(e){this.ensureConfigIsDefined();let r=e.tokenTransfers.length;if(r===0)throw new Fc.ErrBadUsage("No token transfer has been provided");if(r===1)return this.createSingleESDTTransferTransaction(e);let n=this.tokenTransfersDataBuilder.buildDataPartsForMultiESDTNFTTransfer(e.receiver,e.tokenTransfers),i=this.config.gasLimitMultiESDTNFTTransfer*BigInt(r)+BigInt($P);return new WP.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:n,gasLimit:i,addDataMovementGas:!0}).build()}createTransactionForTransfer(e){let r=e.nativeAmount??0n,n=e.tokenTransfers?[...e.tokenTransfers]:[],i=n.length;if(i&&e.data?.length)throw new Fc.ErrBadUsage("Can't set data field when sending esdt tokens");if(r&&i===0||e.data)return this.createTransactionForNativeTokenTransfer({sender:e.sender,receiver:e.receiver,nativeAmount:r,data:e.data});let s=r?KP.TokenTransfer.newFromEgldAmount(r):void 0;return s&&n.push(s),this.createTransactionForESDTTokenTransfer({sender:e.sender,receiver:e.receiver,tokenTransfers:n})}createEGLDTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create an EGLD transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForNativeTokenTransfer` method.");let r=e.data?.length()||0,n=this.gasEstimator.forEGLDTransfer(r);return new qh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||n,data:e.data,chainID:e.chainID})}createESDTTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create an ESDT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new Ln.ArgSerializer().valuesToString([Ln.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Ln.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new bS.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new qh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create an ESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let{argumentsString:r}=new Ln.ArgSerializer().valuesToString([Ln.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Ln.U64Value(e.tokenTransfer.nonce),new Ln.BigUIntValue(e.tokenTransfer.valueOf()),new Ln.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new bS.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new qh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){if(!this.isGasEstimatorDefined())throw new Fc.Err("You are calling a legacy function to create a MultiESDTNFT transfer transaction. If this is your intent, then instantiate the class using a `GasEstimator`. Or, instead, use the new, recommended `createTransactionForESDTTokenTransfer` method.");let r=[new Ln.AddressValue(e.destination),new Ln.U16Value(e.tokenTransfers.length)];for(let a of e.tokenTransfers)r.push(Ln.BytesValue.fromUTF8(a.tokenIdentifier),new Ln.U64Value(a.nonce),new Ln.BigUIntValue(a.valueOf()));let{argumentsString:n}=new Ln.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new bS.TransactionPayload(i),o=s.length()||0,c=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new qh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||c,data:s,chainID:e.chainID})}createSingleESDTTransferTransaction(e){this.ensureConfigIsDefined();let r=[],n=e.tokenTransfers[0],i=0n,s=e.receiver;return this.tokenComputer.isFungible(n.token)?(r=this.tokenTransfersDataBuilder.buildDataPartsForESDTTransfer(n),i=this.config.gasLimitESDTTransfer+BigInt(Kee)):(r=this.tokenTransfersDataBuilder.buildDataPartsForSingleESDTNFTTransfer(n,s),i=this.config.gasLimitESDTNFTTransfer+BigInt($P),s=e.sender),new WP.TransactionBuilder({config:this.config,sender:e.sender,receiver:s,dataParts:r,gasLimit:i,addDataMovementGas:!0}).build()}computeGasForMoveBalance(e,r){return e.minGasLimit+e.gasLimitPerByte*BigInt(r.length)}};g1.TransferTransactionsFactory=wS});var JP=L(y1=>{"use strict";h();Object.defineProperty(y1,"__esModule",{value:!0});y1.AccountTransactionsFactory=void 0;var Wee=Nt(),m1=Pl(),AS=class{constructor(e){this.config=e.config}createTransactionForSavingKeyValue(e){let r="SaveKeyValue",n=this.computeDataPartsForSavingKeyValue(e.keyValuePairs),i=[r,...n],s=this.computeExtraGasForSavingKeyValue(e.keyValuePairs);return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:i,gasLimit:s,addDataMovementGas:!0}).build()}computeExtraGasForSavingKeyValue(e){let r=0n;return e.forEach((n,i)=>{r+=this.config.gasLimitPersistPerByte*BigInt(i.length+n.length)+this.config.gasLimitStorePerByte*BigInt(n.length)}),r+this.config.gasLimitSaveKeyValue}computeDataPartsForSavingKeyValue(e){let r=[];return e.forEach((n,i)=>{r.push(b.Buffer.from(i).toString("hex"),b.Buffer.from(n).toString("hex"))}),r}createTransactionForSettingGuardian(e){let r=["SetGuardian",Wee.Address.fromBech32(e.guardianAddress.bech32()).toHex(),b.Buffer.from(e.serviceID).toString("hex")];return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitSetGuardian,addDataMovementGas:!0}).build()}createTransactionForGuardingAccount(e){let r=["GuardAccount"];return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitGuardAccount,addDataMovementGas:!0}).build()}createTransactionForUnguardingAccount(e){let r=["UnGuardAccount"];return new m1.TransactionBuilder({config:this.config,sender:e.sender,receiver:e.sender,dataParts:r,gasLimit:this.config.gasLimitUnguardAccount,addDataMovementGas:!0}).build()}};y1.AccountTransactionsFactory=AS});var v1=L($n=>{"use strict";h();var $ee=$n&&$n.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qc=$n&&$n.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$ee(e,t,r)};Object.defineProperty($n,"__esModule",{value:!0});qc(RP(),$n);qc(VP(),$n);qc(gS(),$n);qc(QP(),$n);qc(vS(),$n);qc(YP(),$n);qc(JP(),$n)});var _S=L(vi=>{"use strict";h();var Yee=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jee=vi&&vi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xee=vi&&vi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yee(e,t,r);return Jee(e,t),e},Zee=vi&&vi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vi,"__esModule",{value:!0});vi.InteractionChecker=void 0;var ES=Xee(Ve()),ete=Zee((qt(),qe(jt))),SS=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new ete.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new ES.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new ES.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let c=0;c{"use strict";h();Object.defineProperty(b1,"__esModule",{value:!0});b1.Query=void 0;var tte=Nt(),rte=Nl(),TS=class{constructor(e){this.caller=e.caller||tte.Address.empty(),this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new rte.ArgSerializer().valuesToStrings(this.args)}};b1.Query=TS});var xS=L(w1=>{"use strict";h();Object.defineProperty(w1,"__esModule",{value:!0});w1.Interaction=void 0;var XP=Nt(),nte=iS(),ite=xr(),IS=Sc(),ZP=v1(),ste=_S(),ote=Uh(),CS=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=XP.Address.empty(),this.sender=XP.Address.empty(),this.version=ite.TRANSACTION_VERSION_DEFAULT,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=[]}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){nte.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=new ZP.TransactionsFactoryConfig({chainID:this.chainID.valueOf()}),n=new ZP.SmartContractTransactionsFactory({config:e}).createTransactionForExecute({sender:this.sender,contract:this.contract.getAddress(),function:this.function.valueOf(),gasLimit:BigInt(this.gasLimit.valueOf()),arguments:this.args,nativeTransferAmount:BigInt(this.value.toString()),tokenTransfers:this.tokenTransfers});return n.chainID=this.chainID.valueOf(),n.nonce=BigInt(this.nonce.valueOf()),n.version=this.version,this.gasPrice&&(n.gasPrice=BigInt(this.gasPrice.valueOf())),n}buildQuery(){return new ote.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.tokenTransfers=[e].map(r=>new IS.TokenTransfer(r)),this}withSingleESDTNFTTransfer(e){return this.tokenTransfers=[e].map(r=>new IS.TokenTransfer(r)),this}withMultiESDTNFTTransfer(e){return this.tokenTransfers=e.map(r=>new IS.TokenTransfer(r)),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withVersion(e){return this.version=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new ste.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};w1.Interaction=CS});var NS=L(eR=>{"use strict";h();Object.defineProperty(eR,"__esModule",{value:!0})});var iR=L(Dl=>{"use strict";h();Object.defineProperty(Dl,"__esModule",{value:!0});Dl.bech32m=Dl.bech32=void 0;var A1="qpzry9x8gf2tvdw0s3jn54khce6mua7l",rR={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function tR(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Ml(e)^n>>5}e=Ml(e);for(let r=0;r=r;)s-=r,c.push(i>>s&o);if(n)s>0&&c.push(i<=e)return"Excess padding";if(i<a)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let u=tR(o);if(typeof u=="string")throw new Error(u);let f=o+"1";for(let p=0;p>5)throw new Error("Non 5-bit word");u=Ml(u)^S,f+=A1.charAt(S)}for(let p=0;p<6;++p)u=Ml(u);u^=e;for(let p=0;p<6;++p){let S=u>>(5-p)*5&31;f+=A1.charAt(S)}return f}function n(o,c){if(c=c||90,o.length<8)return o+" too short";if(o.length>c)return"Exceeds length limit";let a=o.toLowerCase(),u=o.toUpperCase();if(o!==a&&o!==u)return"Mixed-case string "+o;o=a;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let p=o.slice(0,f),S=o.slice(f+1);if(S.length<6)return"Data too short";let I=tR(p);if(typeof I=="string")return I;let N=[];for(let R=0;R=S.length)&&N.push(U)}return I!==e?"Invalid checksum for "+o:{prefix:p,words:N}}function i(o,c){let a=n(o,c);if(typeof a=="object")return a}function s(o,c){let a=n(o,c);if(typeof a=="object")return a;throw new Error(a)}return{decodeUnsafe:i,decode:s,encode:r,toWords:ate,fromWordsUnsafe:cte,fromWords:ute}}Dl.bech32=nR("bech32");Dl.bech32m=nR("bech32m")});var oR=L(bi=>{"use strict";h();Object.defineProperty(bi,"__esModule",{value:!0});bi.TokenTransferProperties=bi.TransactionMetadataTransfer=bi.TransactionMetadata=bi.TransactionToDecode=bi.TransactionDecoder=void 0;var sR=iR(),PS=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new Uc;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new E1;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new Uc;s.transfers||(s.transfers=[]);let o=2;for(let c=0;co&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),c=new Uc;return c.sender=e.sender,c.receiver=o,c.value=s,r.length>4&&(c.functionName=this.hexToString(r[4]),c.functionArgs=r.slice(5)),c.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],c}base64Encode(e){return b.Buffer.from(e).toString("base64")}base64Decode(e){return b.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new Uc;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=b.Buffer.from(e,"hex"),n=sR.bech32.toWords(r);return sR.bech32.encode("erd",n)}isAddressValid(e){return b.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return b.Buffer.from(e,"base64").toString("hex")}hexToString(e){return b.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};bi.TransactionDecoder=PS;var E1=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};bi.TransactionToDecode=E1;var Uc=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};bi.TransactionMetadata=Uc;var RS=class{constructor(){this.value=BigInt(0)}};bi.TransactionMetadataTransfer=RS;var MS=class{};bi.TokenTransferProperties=MS});var DS=L(S1=>{"use strict";h();Object.defineProperty(S1,"__esModule",{value:!0});S1.ReturnCode=void 0;var Qt=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};S1.ReturnCode=Qt;Qt.None=new Qt("");Qt.Ok=new Qt("ok");Qt.FunctionNotFound=new Qt("function not found");Qt.FunctionWrongSignature=new Qt("wrong signature for function");Qt.ContractNotFound=new Qt("contract not found");Qt.UserError=new Qt("user error");Qt.OutOfGas=new Qt("out of gas");Qt.AccountCollision=new Qt("account collision");Qt.OutOfFunds=new Qt("out of funds");Qt.CallStackOverFlow=new Qt("call stack overflow");Qt.ContractInvalid=new Qt("contract invalid");Qt.ExecutionFailed=new Qt("execution failed");Qt.Unknown=new Qt("unknown")});var uR=L(_1=>{"use strict";h();Object.defineProperty(_1,"__esModule",{value:!0});_1.ResultsParser=void 0;var lte=oR(),aR=Nt(),cR=Ve(),wa=ra(),fte=Nl(),Bl=DS(),kc;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(kc||(kc={}));var BS;(function(t){t.TooMuchGas="@too much gas provided for processing"})(BS||(BS={}));var dte={argsSerializer:new fte.ArgSerializer},LS=class{constructor(e){e={...dte,...e},this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Bl.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new Bl.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e);return this.parseOutcomeFromUntypedBundle(n,r)}parseOutcomeFromUntypedBundle(e,r){let n=this.argsSerializer.buffersToValues(e.values,r.output);return{returnCode:e.returnCode,returnMessage:e.returnMessage,values:n,firstValue:n[0],secondValue:n[1],thirdValue:n[2],lastValue:n[n.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return wa.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return wa.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return wa.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return wa.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return wa.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return wa.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return wa.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return wa.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new cR.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new lte.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:Bl.ReturnCode.None,returnMessage:Bl.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Bl.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(kc.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),o=r.getLastTopic()?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(kc.OnWriteLog,s=>s.findFirstOrNoneTopic(o=>o.toString().startsWith(BS.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data);return{returnCode:n,returnMessage:n.toString(),values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new aR.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(kc.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),c=s.toString();return{returnCode:s,returnMessage:c,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new aR.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(kc.OnWriteLog,o=>{let c=o.address.bech32()==e.sender.bech32(),a=o.topics[0]?.hex()==n.hex();return c&&a});if(s){let{returnCode:o,returnDataParts:c}=this.sliceDataFieldInParts(s.data),a=o.toString();return{returnCode:o,returnMessage:a,values:c}}}for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(kc.OnWriteLog,o=>o.address.bech32()==n.toBech32());if(s){let{returnCode:o,returnDataParts:c}=this.sliceDataFieldInParts(s.data),a=o.toString();return{returnCode:o,returnMessage:a,values:c}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||b.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new cR.ErrCannotParseContractResults("no return code");return{returnCode:Bl.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){let n=e.topics.map(o=>b.Buffer.from(o.valueOf())).slice(1),i=e.dataPayload?.valueOf()||b.Buffer.from([]),s=e.additionalData?.map(o=>b.Buffer.from(o.valueOf()))||[];return s.length===0&&i.length&&s.push(b.Buffer.from(i)),this.doParseEvent({topics:n,dataItems:s,eventDefinition:r})}doParseEvent(e){let r={},n=e.eventDefinition.inputs.filter(c=>c.indexed),i=this.argsSerializer.buffersToValues(e.topics,n);for(let c=0;c!c.indexed),o=this.argsSerializer.buffersToValues(e.dataItems,s);for(let c=0;c{"use strict";h();Object.defineProperty(I1,"__esModule",{value:!0});I1.SmartContract=void 0;var T1=Nt(),FS=iS(),qS=xr(),hte=Ve(),US=gS(),kS=vS(),pte=fi(),lR=Rm(),fR=rS(),dR=xS(),gte=c1(),mte=Uh(),VS=class{constructor(e={}){this.address=T1.Address.empty(),this.methodsExplicit={},this.methods={},this.address=e.address||T1.Address.empty(),this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new fR.ContractFunction(i);return new dR.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new fR.ContractFunction(i),c=gte.NativeSerializer.nativeToTypedValues(s||[],n);return new dR.Interaction(e,o,c||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return pte.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:c,chainID:a}){FS.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()");let u=new kS.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new US.SmartContractTransactionsFactory({config:u,abi:this.abi}),p=b.Buffer.from(r.toString(),"hex"),S=this.getMetadataPropertiesAsObject(n),I=f.createTransactionForDeploy({sender:e,bytecode:p,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:S.upgradeable,isReadable:S.readable,isPayable:S.payable,isPayableBySmartContract:S.payableBySc});return I.setChainID(a),I.setValue(s??0),I.setGasPrice(c??qS.TRANSACTION_MIN_GAS_PRICE),I}getMetadataPropertiesAsObject(e){let r;return e?r=lR.CodeMetadata.fromBytes(b.Buffer.from(e.toString(),"hex")):r=new lR.CodeMetadata,r.toJSON()}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:c,chainID:a}){FS.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress();let u=new kS.TransactionsFactoryConfig({chainID:a.valueOf()}),f=new US.SmartContractTransactionsFactory({config:u,abi:this.abi}),p=Uint8Array.from(b.Buffer.from(r.toString(),"hex")),S=this.getMetadataPropertiesAsObject(n),I=f.createTransactionForUpgrade({sender:e,contract:this.getAddress(),bytecode:p,gasLimit:BigInt(o.valueOf()),arguments:i,isUpgradeable:S.upgradeable,isReadable:S.readable,isPayable:S.payable,isPayableBySmartContract:S.payableBySc});return I.setChainID(a),I.setValue(s??0),I.setGasPrice(c??qS.TRANSACTION_MIN_GAS_PRICE),I}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:c,caller:a}){FS.Compatibility.guardAddressIsSetAndNonZero(a,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress();let u=new kS.TransactionsFactoryConfig({chainID:c.valueOf()}),f=new US.SmartContractTransactionsFactory({config:u,abi:this.abi});r=r||[],n=n||0;let p=f.createTransactionForExecute({sender:a,contract:s||this.getAddress(),function:e.toString(),gasLimit:BigInt(i.valueOf()),arguments:r});return p.setChainID(c),p.setValue(n),p.setGasPrice(o??qS.TRANSACTION_MIN_GAS_PRICE),p}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new mte.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new hte.ErrContractHasNoAddress}static computeAddress(e,r){let n=T1.Address.fromBech32(e.bech32());return new T1.AddressComputer().computeContractAddress(n,BigInt(r.valueOf()))}};I1.SmartContract=VS});var pR=L(Aa=>{"use strict";h();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.ContractCallPayloadBuilder=Aa.ContractUpgradePayloadBuilder=Aa.ContractDeployPayloadBuilder=void 0;var yte=xr(),jS=No(),QS=fi(),vte=Nl(),HS=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(){QS.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${yte.WasmVirtualMachine}@${r}`;return n=KS(n,this.arguments),new jS.TransactionPayload(n)}};Aa.ContractDeployPayloadBuilder=HS;var GS=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(){QS.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=KS(n,this.arguments),new jS.TransactionPayload(n)}};Aa.ContractUpgradePayloadBuilder=GS;var zS=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(){QS.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=KS(e,this.arguments),new jS.TransactionPayload(e)}};Aa.ContractCallPayloadBuilder=zS;function KS(t,e){let{argumentsString:r,count:n}=new vte.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var yi=L(Sr=>{"use strict";h();var bte=Sr&&Sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wn=Sr&&Sr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bte(e,t,r)};Object.defineProperty(Sr,"__esModule",{value:!0});wn(Nl(),Sr);wn(PP(),Sr);wn(QE(),Sr);wn(Rm(),Sr);wn(rS(),Sr);wn(xS(),Sr);wn(_S(),Sr);wn(NS(),Sr);wn(c1(),Sr);wn(Uh(),Sr);wn(uR(),Sr);wn(DS(),Sr);wn(hR(),Sr);wn(pR(),Sr);wn(dr(),Sr)});var Ll=L(Pr=>{"use strict";h();Object.defineProperty(Pr,"__esModule",{value:!0});Pr.gatherAllEvents=Pr.findEventsByFirstTopic=Pr.findEventsByIdentifier=Pr.findEventsByPredicate=Pr.SmartContractCallOutcome=Pr.TransactionOutcome=Pr.SmartContractResult=Pr.TransactionLogs=Pr.TransactionEvent=void 0;var WS=class{constructor(e){this.address="",this.identifier="",this.topics=[],this.dataItems=[],Object.assign(this,e)}};Pr.TransactionEvent=WS;var kh=class{constructor(e){this.address="",this.events=[],Object.assign(this,e)}};Pr.TransactionLogs=kh;var $S=class{constructor(e){this.sender="",this.receiver="",this.data=new Uint8Array,this.logs=new kh({}),Object.assign(this,e)}};Pr.SmartContractResult=$S;var YS=class{constructor(e){this.directSmartContractCallOutcome=new C1({}),this.smartContractResults=[],this.logs=new kh({}),Object.assign(this,e)}};Pr.TransactionOutcome=YS;var C1=class{constructor(e){this.function="",this.returnDataParts=[],this.returnMessage="",this.returnCode="",Object.assign(this,e)}};Pr.SmartContractCallOutcome=C1;function JS(t,e){return gR(t).filter(e)}Pr.findEventsByPredicate=JS;function wte(t,e){return JS(t,r=>r.identifier==e)}Pr.findEventsByIdentifier=wte;function Ate(t,e){return JS(t,r=>r.topics[0]?.toString()==e)}Pr.findEventsByFirstTopic=Ate;function gR(t){let e=[];e.push(...t.logs.events);for(let r of t.smartContractResults)e.push(...r.logs.events);return e}Pr.gatherAllEvents=gR});var Vh=L(x1=>{"use strict";h();Object.defineProperty(x1,"__esModule",{value:!0});x1.TransactionsConverter=void 0;var Ete=yi(),Ste=Dn(),Fl=Ll(),XS=class{transactionToPlainObject(e){return{nonce:Number(e.nonce),value:e.value.toString(),receiver:e.receiver,sender:e.sender,senderUsername:this.toBase64OrUndefined(e.senderUsername),receiverUsername:this.toBase64OrUndefined(e.receiverUsername),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:this.toBase64OrUndefined(e.data),chainID:e.chainID.valueOf(),version:e.version,options:e.options==0?void 0:e.options,guardian:e.guardian?e.guardian:void 0,signature:this.toHexOrUndefined(e.signature),guardianSignature:this.toHexOrUndefined(e.guardianSignature),relayer:e.relayer?e.relayer:void 0,innerTransactions:e.innerTransactions.length?e.innerTransactions.map(n=>this.transactionToPlainObject(n)):void 0}}toBase64OrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("base64"):void 0}toHexOrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("hex"):void 0}plainObjectToTransaction(e){return new Ste.Transaction({nonce:BigInt(e.nonce),value:BigInt(e.value||""),receiver:e.receiver,receiverUsername:this.bufferFromBase64(e.receiverUsername).toString(),sender:e.sender,senderUsername:this.bufferFromBase64(e.senderUsername).toString(),guardian:e.guardian,gasPrice:BigInt(e.gasPrice),gasLimit:BigInt(e.gasLimit),data:this.bufferFromBase64(e.data),chainID:String(e.chainID),version:Number(e.version),options:Number(e.options),signature:this.bufferFromHex(e.signature),guardianSignature:this.bufferFromHex(e.guardianSignature),relayer:e.relayer,innerTransactions:e.innerTransactions?e.innerTransactions.map(n=>this.plainObjectToTransaction(n)):void 0})}bufferFromBase64(e){return b.Buffer.from(e||"","base64")}bufferFromHex(e){return b.Buffer.from(e||"","hex")}transactionOnNetworkToOutcome(e){let n=new Ete.ResultsParser().parseUntypedOutcome(e),i=new Fl.SmartContractCallOutcome({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.values}),s=e.contractResults.items.map(c=>this.smartContractResultOnNetworkToSmartContractResult(c)),o=new Fl.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(c=>this.eventOnNetworkToEvent(c))});return new Fl.TransactionOutcome({logs:o,smartContractResults:s,directSmartContractCallOutcome:i})}smartContractResultOnNetworkToSmartContractResult(e){return new Fl.SmartContractResult({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:b.Buffer.from(e.data),logs:new Fl.TransactionLogs({address:e.logs.address.bech32(),events:e.logs.events.map(r=>this.eventOnNetworkToEvent(r))})})}eventOnNetworkToEvent(e){let r=e.dataPayload?.valueOf()||b.Buffer.from(e.data||""),n=e.additionalData?.map(i=>b.Buffer.from(i.valueOf()))||[];return n.length===0&&r.length&&n.push(b.Buffer.from(r)),new Fl.TransactionEvent({address:e.address.bech32(),identifier:e.identifier,topics:e.topics.map(i=>b.Buffer.from(i.hex(),"hex")),dataItems:n})}};x1.TransactionsConverter=XS});var mR=L(Bs=>{"use strict";h();var _te=Bs&&Bs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tte=Bs&&Bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ite=Bs&&Bs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_te(e,t,r);return Tte(e,t),e};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.Hash=void 0;var Cte=Ite(Ve()),ZS=class t{constructor(e){if(!e)this.hash=b.Buffer.from([]);else if(e instanceof b.Buffer)this.hash=e;else if(typeof e=="string")this.hash=b.Buffer.from(e,"hex");else throw new Cte.ErrBadType("hash","buffer | string",e)}static empty(){return new t(b.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};Bs.Hash=ZS});var N1=L(wi=>{"use strict";h();var xte=wi&&wi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nte=wi&&wi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ote=wi&&wi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xte(e,t,r);return Nte(e,t),e};Object.defineProperty(wi,"__esModule",{value:!0});wi.interpretSignatureAsBuffer=wi.Signature=void 0;var yR=Ote(Ve()),vR=64,e_=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof b.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new yR.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return b.Buffer.from(e,"hex").length==vR}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=vR)throw new yR.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};wi.Signature=e_;function Pte(t){if(ArrayBuffer.isView(t))return b.Buffer.from(t);if(t.hex!=null)return b.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}wi.interpretSignatureAsBuffer=Pte});var wR=L((NTe,bR)=>{"use strict";h();bR.exports=Rte;function Rte(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";h();var O1=SR;O1.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var ql=new Array(64),ER=new Array(123);for(Ji=0;Ji<64;)ER[ql[Ji]=Ji<26?Ji+65:Ji<52?Ji+71:Ji<62?Ji-4:Ji-59|43]=Ji++;var Ji;O1.encode=function(e,r,n){for(var i=null,s=[],o=0,c=0,a;r>2],a=(u&3)<<4,c=1;break;case 1:s[o++]=ql[a|u>>4],a=(u&15)<<2,c=2;break;case 2:s[o++]=ql[a|u>>6],s[o++]=ql[u&63],c=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return c&&(s[o++]=ql[a],s[o++]=61,c===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var AR="invalid encoding";O1.decode=function(e,r,n){for(var i=n,s=0,o,c=0;c1)break;if((a=ER[a])===void 0)throw Error(AR);switch(s){case 0:o=a,s=1;break;case 1:r[n++]=o<<2|(a&48)>>4,o=a,s=2;break;case 2:r[n++]=(o&15)<<4|(a&60)>>2,o=a,s=3;break;case 3:r[n++]=(o&3)<<6|a,s=0;break}}if(s===1)throw Error(AR);return n-i};O1.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var IR=L((MTe,TR)=>{"use strict";h();TR.exports=P1;function P1(){this._listeners={}}P1.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};P1.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";h();RR.exports=CR(CR);function CR(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(a,u,f){e[0]=a,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3]}function s(a,u,f){e[0]=a,u[f]=r[3],u[f+1]=r[2],u[f+2]=r[1],u[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(a,u){return r[0]=a[u],r[1]=a[u+1],r[2]=a[u+2],r[3]=a[u+3],e[0]}function c(a,u){return r[3]=a[u],r[2]=a[u+1],r[1]=a[u+2],r[0]=a[u+3],e[0]}t.readFloatLE=n?o:c,t.readFloatBE=n?c:o}():function(){function e(n,i,s,o){var c=i<0?1:0;if(c&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((c<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((c<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var a=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-a)*8388608)&8388607;n((c<<31|a+127<<23|u)>>>0,s,o)}}t.writeFloatLE=e.bind(null,xR),t.writeFloatBE=e.bind(null,NR);function r(n,i,s){var o=n(i,s),c=(o>>31)*2+1,a=o>>>23&255,u=o&8388607;return a===255?u?NaN:c*(1/0):a===0?c*1401298464324817e-60*u:c*Math.pow(2,a-150)*(u+8388608)}t.readFloatLE=r.bind(null,OR),t.readFloatBE=r.bind(null,PR)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(a,u,f){e[0]=a,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3],u[f+4]=r[4],u[f+5]=r[5],u[f+6]=r[6],u[f+7]=r[7]}function s(a,u,f){e[0]=a,u[f]=r[7],u[f+1]=r[6],u[f+2]=r[5],u[f+3]=r[4],u[f+4]=r[3],u[f+5]=r[2],u[f+6]=r[1],u[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(a,u){return r[0]=a[u],r[1]=a[u+1],r[2]=a[u+2],r[3]=a[u+3],r[4]=a[u+4],r[5]=a[u+5],r[6]=a[u+6],r[7]=a[u+7],e[0]}function c(a,u){return r[7]=a[u],r[6]=a[u+1],r[5]=a[u+2],r[4]=a[u+3],r[3]=a[u+4],r[2]=a[u+5],r[1]=a[u+6],r[0]=a[u+7],e[0]}t.readDoubleLE=n?o:c,t.readDoubleBE=n?c:o}():function(){function e(n,i,s,o,c,a){var u=o<0?1:0;if(u&&(o=-o),o===0)n(0,c,a+i),n(1/o>0?0:2147483648,c,a+s);else if(isNaN(o))n(0,c,a+i),n(2146959360,c,a+s);else if(o>17976931348623157e292)n(0,c,a+i),n((u<<31|2146435072)>>>0,c,a+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,c,a+i),n((u<<31|f/4294967296)>>>0,c,a+s);else{var p=Math.floor(Math.log(o)/Math.LN2);p===1024&&(p=1023),f=o*Math.pow(2,-p),n(f*4503599627370496>>>0,c,a+i),n((u<<31|p+1023<<20|f*1048576&1048575)>>>0,c,a+s)}}}t.writeDoubleLE=e.bind(null,xR,0,4),t.writeDoubleBE=e.bind(null,NR,4,0);function r(n,i,s,o,c){var a=n(o,c+i),u=n(o,c+s),f=(u>>31)*2+1,p=u>>>20&2047,S=4294967296*(u&1048575)+a;return p===2047?S?NaN:f*(1/0):p===0?f*5e-324*S:f*Math.pow(2,p-1075)*(S+4503599627370496)}t.readDoubleLE=r.bind(null,OR,0,4),t.readDoubleBE=r.bind(null,PR,4,0)}(),t}function xR(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function NR(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function OR(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function PR(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var DR=L((exports,module)=>{"use strict";h();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var LR=L(BR=>{"use strict";h();var t_=BR;t_.length=function(e){for(var r=0,n=0,i=0;i191&&a<224?o[c++]=(a&31)<<6|e[r++]&63:a>239&&a<365?(a=((a&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[c++]=55296+(a>>10),o[c++]=56320+(a&1023)):o[c++]=(a&15)<<12|(e[r++]&63)<<6|e[r++]&63,c>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),c=0);return s?(c&&s.push(String.fromCharCode.apply(String,o.slice(0,c))),s.join("")):String.fromCharCode.apply(String,o.slice(0,c))};t_.write=function(e,r,n){for(var i=n,s,o,c=0;c>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(c+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++c,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var qR=L((kTe,FR)=>{"use strict";h();FR.exports=Mte;function Mte(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(a){if(a<1||a>i)return t(a);o+a>n&&(s=t(n),o=0);var u=e.call(s,o,o+=a);return o&7&&(o=(o|7)+1),u}}});var kR=L((HTe,UR)=>{"use strict";h();UR.exports=Ur;var Hh=Sa();function Ur(t,e){this.lo=t>>>0,this.hi=e>>>0}var Vc=Ur.zero=new Ur(0,0);Vc.toNumber=function(){return 0};Vc.zzEncode=Vc.zzDecode=function(){return this};Vc.length=function(){return 1};var Dte=Ur.zeroHash="\0\0\0\0\0\0\0\0";Ur.fromNumber=function(e){if(e===0)return Vc;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Ur(n,i)};Ur.from=function(e){if(typeof e=="number")return Ur.fromNumber(e);if(Hh.isString(e))if(Hh.Long)e=Hh.Long.fromString(e);else return Ur.fromNumber(parseInt(e,10));return e.low||e.high?new Ur(e.low>>>0,e.high>>>0):Vc};Ur.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Ur.prototype.toLong=function(e){return Hh.Long?new Hh.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ea=String.prototype.charCodeAt;Ur.fromHash=function(e){return e===Dte?Vc:new Ur((Ea.call(e,0)|Ea.call(e,1)<<8|Ea.call(e,2)<<16|Ea.call(e,3)<<24)>>>0,(Ea.call(e,4)|Ea.call(e,5)<<8|Ea.call(e,6)<<16|Ea.call(e,7)<<24)>>>0)};Ur.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)};Ur.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};Ur.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};Ur.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Sa=L(r_=>{"use strict";h();var we=r_;we.asPromise=wR();we.base64=_R();we.EventEmitter=IR();we.float=MR();we.inquire=DR();we.utf8=LR();we.pool=qR();we.LongBits=kR();we.isNode=!!(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||r_;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,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};we.Buffer=function(){try{var t=we.inquire("buffer").Buffer;return t.prototype.utf8Write?t: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,r){var n=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function VR(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};we.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";h();QR.exports=ot;var Ai=Sa(),n_,R1=Ai.LongBits,GR=Ai.base64,zR=Ai.utf8;function Gh(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function s_(){}function Bte(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function ot(){this.len=0,this.head=new Gh(s_,0,0),this.tail=this.head,this.states=null}var jR=function(){return Ai.Buffer?function(){return(ot.create=function(){return new n_})()}:function(){return new ot}};ot.create=jR();ot.alloc=function(e){return new Ai.Array(e)};Ai.Array!==Array&&(ot.alloc=Ai.pool(ot.alloc,Ai.Array.prototype.subarray));ot.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Gh(e,r,n),this.len+=r,this};function o_(t,e,r){e[r]=t&255}function Lte(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function a_(t,e){this.len=t,this.next=void 0,this.val=e}a_.prototype=Object.create(Gh.prototype);a_.prototype.fn=Lte;ot.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new a_((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};ot.prototype.int32=function(e){return e<0?this._push(c_,10,R1.fromNumber(e)):this.uint32(e)};ot.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function c_(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}ot.prototype.uint64=function(e){var r=R1.from(e);return this._push(c_,r.length(),r)};ot.prototype.int64=ot.prototype.uint64;ot.prototype.sint64=function(e){var r=R1.from(e).zzEncode();return this._push(c_,r.length(),r)};ot.prototype.bool=function(e){return this._push(o_,1,e?1:0)};function i_(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}ot.prototype.fixed32=function(e){return this._push(i_,4,e>>>0)};ot.prototype.sfixed32=ot.prototype.fixed32;ot.prototype.fixed64=function(e){var r=R1.from(e);return this._push(i_,4,r.lo)._push(i_,4,r.hi)};ot.prototype.sfixed64=ot.prototype.fixed64;ot.prototype.float=function(e){return this._push(Ai.float.writeFloatLE,4,e)};ot.prototype.double=function(e){return this._push(Ai.float.writeDoubleLE,8,e)};var Fte=Ai.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(o_,1,0);if(Ai.isString(e)){var n=ot.alloc(r=GR.length(e));GR.decode(e,n,0),e=n}return this.uint32(r)._push(Fte,r,e)};ot.prototype.string=function(e){var r=zR.length(e);return r?this.uint32(r)._push(zR.write,r,e):this._push(o_,1,0)};ot.prototype.fork=function(){return this.states=new Bte(this),this.head=this.tail=new Gh(s_,0,0),this.len=0,this};ot.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 Gh(s_,0,0),this.len=0),this};ot.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};ot.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};ot._configure=function(t){n_=t,ot.create=jR(),n_._configure()}});var $R=L((WTe,WR)=>{"use strict";h();WR.exports=Ls;var KR=u_();(Ls.prototype=Object.create(KR.prototype)).constructor=Ls;var _a=Sa();function Ls(){KR.call(this)}Ls._configure=function(){Ls.alloc=_a._Buffer_allocUnsafe,Ls.writeBytesBuffer=_a.Buffer&&_a.Buffer.prototype instanceof Uint8Array&&_a.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(Ls.writeBytesBuffer,r,e),this};function qte(t,e,r){t.length<40?_a.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Ls.prototype.string=function(e){var r=_a.Buffer.byteLength(e);return this.uint32(r),r&&this._push(qte,r,e),this};Ls._configure()});var d_=L((YTe,eM)=>{"use strict";h();eM.exports=_r;var Xi=Sa(),f_,XR=Xi.LongBits,Ute=Xi.utf8;function Zi(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function _r(t){this.buf=t,this.pos=0,this.len=t.length}var YR=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new _r(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new _r(e);throw Error("illegal buffer")},ZR=function(){return Xi.Buffer?function(r){return(_r.create=function(i){return Xi.Buffer.isBuffer(i)?new f_(i):YR(i)})(r)}:YR};_r.create=ZR();_r.prototype._slice=Xi.Array.prototype.subarray||Xi.Array.prototype.slice;_r.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,Zi(this,10);return e}}();_r.prototype.int32=function(){return this.uint32()|0};_r.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function l_(){var t=new XR(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Zi(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Zi(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}_r.prototype.bool=function(){return this.uint32()!==0};function M1(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}_r.prototype.fixed32=function(){if(this.pos+4>this.len)throw Zi(this,4);return M1(this.buf,this.pos+=4)};_r.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Zi(this,4);return M1(this.buf,this.pos+=4)|0};function JR(){if(this.pos+8>this.len)throw Zi(this,8);return new XR(M1(this.buf,this.pos+=4),M1(this.buf,this.pos+=4))}_r.prototype.float=function(){if(this.pos+4>this.len)throw Zi(this,4);var e=Xi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};_r.prototype.double=function(){if(this.pos+8>this.len)throw Zi(this,4);var e=Xi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};_r.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Zi(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=Xi.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};_r.prototype.string=function(){var e=this.bytes();return Ute.read(e,0,e.length)};_r.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Zi(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Zi(this);while(this.buf[this.pos++]&128);return this};_r.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};_r._configure=function(t){f_=t,_r.create=ZR(),f_._configure();var e=Xi.Long?"toLong":"toNumber";Xi.merge(_r.prototype,{int64:function(){return l_.call(this)[e](!1)},uint64:function(){return l_.call(this)[e](!0)},sint64:function(){return l_.call(this).zzDecode()[e](!1)},fixed64:function(){return JR.call(this)[e](!0)},sfixed64:function(){return JR.call(this)[e](!1)}})}});var iM=L((XTe,nM)=>{"use strict";h();nM.exports=Hc;var rM=d_();(Hc.prototype=Object.create(rM.prototype)).constructor=Hc;var tM=Sa();function Hc(t){rM.call(this,t)}Hc._configure=function(){tM.Buffer&&(Hc.prototype._slice=tM.Buffer.prototype.slice)};Hc.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))};Hc._configure()});var oM=L((eIe,sM)=>{"use strict";h();sM.exports=zh;var h_=Sa();(zh.prototype=Object.create(h_.EventEmitter.prototype)).constructor=zh;function zh(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");h_.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}zh.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return h_.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(a,u){if(a)return o.emit("error",a,e),s(a);if(u===null){o.end(!0);return}if(!(u instanceof n))try{u=n[o.responseDelimited?"decodeDelimited":"decode"](u)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",u,e),s(null,u)})}catch(c){o.emit("error",c,e),setTimeout(function(){s(c)},0);return}};zh.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var cM=L(aM=>{"use strict";h();var kte=aM;kte.Service=oM()});var lM=L((iIe,uM)=>{"use strict";h();uM.exports={}});var hM=L(dM=>{"use strict";h();var Fn=dM;Fn.build="minimal";Fn.Writer=u_();Fn.BufferWriter=$R();Fn.Reader=d_();Fn.BufferReader=iM();Fn.util=Sa();Fn.rpc=cM();Fn.roots=lM();Fn.configure=fM;function fM(){Fn.util._configure(),Fn.Writer._configure(Fn.BufferWriter),Fn.Reader._configure(Fn.BufferReader)}fM()});var gM=L((cIe,pM)=>{"use strict";h();pM.exports=hM()});var p_=L((mM,jh)=>{"use strict";h();(function(t,e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof Mp=="function"&&typeof jh=="object"&&jh&&jh.exports&&(jh.exports=e(gM()))})(mM,function(t){"use strict";var e=t.Reader,r=t.Writer,n=t.util,i=t.roots.default||(t.roots.default={});return i.proto=function(){var s={};return s.Transaction=function(){function o(c){if(this.InnerTransactions=[],c)for(var a=Object.keys(c),u=0;u>>3){case 1:{p.Nonce=a.uint64();break}case 2:{p.Value=a.bytes();break}case 3:{p.RcvAddr=a.bytes();break}case 4:{p.RcvUserName=a.bytes();break}case 5:{p.SndAddr=a.bytes();break}case 6:{p.SndUserName=a.bytes();break}case 7:{p.GasPrice=a.uint64();break}case 8:{p.GasLimit=a.uint64();break}case 9:{p.Data=a.bytes();break}case 10:{p.ChainID=a.bytes();break}case 11:{p.Version=a.uint32();break}case 12:{p.Signature=a.bytes();break}case 13:{p.Options=a.uint32();break}case 14:{p.GuardianAddr=a.bytes();break}case 15:{p.GuardianSignature=a.bytes();break}case 16:{p.Relayer=a.bytes();break}case 17:{p.InnerTransactions&&p.InnerTransactions.length||(p.InnerTransactions=[]),p.InnerTransactions.push(i.proto.Transaction.decode(a,a.uint32()));break}default:a.skipType(S&7);break}}return p},o.decodeDelimited=function(a){return a instanceof e||(a=new e(a)),this.decode(a,a.uint32())},o.verify=function(a){if(typeof a!="object"||a===null)return"object expected";if(a.Nonce!=null&&a.hasOwnProperty("Nonce")&&!n.isInteger(a.Nonce)&&!(a.Nonce&&n.isInteger(a.Nonce.low)&&n.isInteger(a.Nonce.high)))return"Nonce: integer|Long expected";if(a.Value!=null&&a.hasOwnProperty("Value")&&!(a.Value&&typeof a.Value.length=="number"||n.isString(a.Value)))return"Value: buffer expected";if(a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&!(a.RcvAddr&&typeof a.RcvAddr.length=="number"||n.isString(a.RcvAddr)))return"RcvAddr: buffer expected";if(a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&!(a.RcvUserName&&typeof a.RcvUserName.length=="number"||n.isString(a.RcvUserName)))return"RcvUserName: buffer expected";if(a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&!(a.SndAddr&&typeof a.SndAddr.length=="number"||n.isString(a.SndAddr)))return"SndAddr: buffer expected";if(a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&!(a.SndUserName&&typeof a.SndUserName.length=="number"||n.isString(a.SndUserName)))return"SndUserName: buffer expected";if(a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&!n.isInteger(a.GasPrice)&&!(a.GasPrice&&n.isInteger(a.GasPrice.low)&&n.isInteger(a.GasPrice.high)))return"GasPrice: integer|Long expected";if(a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&!n.isInteger(a.GasLimit)&&!(a.GasLimit&&n.isInteger(a.GasLimit.low)&&n.isInteger(a.GasLimit.high)))return"GasLimit: integer|Long expected";if(a.Data!=null&&a.hasOwnProperty("Data")&&!(a.Data&&typeof a.Data.length=="number"||n.isString(a.Data)))return"Data: buffer expected";if(a.ChainID!=null&&a.hasOwnProperty("ChainID")&&!(a.ChainID&&typeof a.ChainID.length=="number"||n.isString(a.ChainID)))return"ChainID: buffer expected";if(a.Version!=null&&a.hasOwnProperty("Version")&&!n.isInteger(a.Version))return"Version: integer expected";if(a.Signature!=null&&a.hasOwnProperty("Signature")&&!(a.Signature&&typeof a.Signature.length=="number"||n.isString(a.Signature)))return"Signature: buffer expected";if(a.Options!=null&&a.hasOwnProperty("Options")&&!n.isInteger(a.Options))return"Options: integer expected";if(a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&!(a.GuardianAddr&&typeof a.GuardianAddr.length=="number"||n.isString(a.GuardianAddr)))return"GuardianAddr: buffer expected";if(a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&!(a.GuardianSignature&&typeof a.GuardianSignature.length=="number"||n.isString(a.GuardianSignature)))return"GuardianSignature: buffer expected";if(a.Relayer!=null&&a.hasOwnProperty("Relayer")&&!(a.Relayer&&typeof a.Relayer.length=="number"||n.isString(a.Relayer)))return"Relayer: buffer expected";if(a.InnerTransactions!=null&&a.hasOwnProperty("InnerTransactions")){if(!Array.isArray(a.InnerTransactions))return"InnerTransactions: array expected";for(var u=0;u>>0,a.Nonce.high>>>0).toNumber(!0))),a.Value!=null&&(typeof a.Value=="string"?n.base64.decode(a.Value,u.Value=n.newBuffer(n.base64.length(a.Value)),0):a.Value.length>=0&&(u.Value=a.Value)),a.RcvAddr!=null&&(typeof a.RcvAddr=="string"?n.base64.decode(a.RcvAddr,u.RcvAddr=n.newBuffer(n.base64.length(a.RcvAddr)),0):a.RcvAddr.length>=0&&(u.RcvAddr=a.RcvAddr)),a.RcvUserName!=null&&(typeof a.RcvUserName=="string"?n.base64.decode(a.RcvUserName,u.RcvUserName=n.newBuffer(n.base64.length(a.RcvUserName)),0):a.RcvUserName.length>=0&&(u.RcvUserName=a.RcvUserName)),a.SndAddr!=null&&(typeof a.SndAddr=="string"?n.base64.decode(a.SndAddr,u.SndAddr=n.newBuffer(n.base64.length(a.SndAddr)),0):a.SndAddr.length>=0&&(u.SndAddr=a.SndAddr)),a.SndUserName!=null&&(typeof a.SndUserName=="string"?n.base64.decode(a.SndUserName,u.SndUserName=n.newBuffer(n.base64.length(a.SndUserName)),0):a.SndUserName.length>=0&&(u.SndUserName=a.SndUserName)),a.GasPrice!=null&&(n.Long?(u.GasPrice=n.Long.fromValue(a.GasPrice)).unsigned=!0:typeof a.GasPrice=="string"?u.GasPrice=parseInt(a.GasPrice,10):typeof a.GasPrice=="number"?u.GasPrice=a.GasPrice:typeof a.GasPrice=="object"&&(u.GasPrice=new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0))),a.GasLimit!=null&&(n.Long?(u.GasLimit=n.Long.fromValue(a.GasLimit)).unsigned=!0:typeof a.GasLimit=="string"?u.GasLimit=parseInt(a.GasLimit,10):typeof a.GasLimit=="number"?u.GasLimit=a.GasLimit:typeof a.GasLimit=="object"&&(u.GasLimit=new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0))),a.Data!=null&&(typeof a.Data=="string"?n.base64.decode(a.Data,u.Data=n.newBuffer(n.base64.length(a.Data)),0):a.Data.length>=0&&(u.Data=a.Data)),a.ChainID!=null&&(typeof a.ChainID=="string"?n.base64.decode(a.ChainID,u.ChainID=n.newBuffer(n.base64.length(a.ChainID)),0):a.ChainID.length>=0&&(u.ChainID=a.ChainID)),a.Version!=null&&(u.Version=a.Version>>>0),a.Signature!=null&&(typeof a.Signature=="string"?n.base64.decode(a.Signature,u.Signature=n.newBuffer(n.base64.length(a.Signature)),0):a.Signature.length>=0&&(u.Signature=a.Signature)),a.Options!=null&&(u.Options=a.Options>>>0),a.GuardianAddr!=null&&(typeof a.GuardianAddr=="string"?n.base64.decode(a.GuardianAddr,u.GuardianAddr=n.newBuffer(n.base64.length(a.GuardianAddr)),0):a.GuardianAddr.length>=0&&(u.GuardianAddr=a.GuardianAddr)),a.GuardianSignature!=null&&(typeof a.GuardianSignature=="string"?n.base64.decode(a.GuardianSignature,u.GuardianSignature=n.newBuffer(n.base64.length(a.GuardianSignature)),0):a.GuardianSignature.length>=0&&(u.GuardianSignature=a.GuardianSignature)),a.Relayer!=null&&(typeof a.Relayer=="string"?n.base64.decode(a.Relayer,u.Relayer=n.newBuffer(n.base64.length(a.Relayer)),0):a.Relayer.length>=0&&(u.Relayer=a.Relayer)),a.InnerTransactions){if(!Array.isArray(a.InnerTransactions))throw TypeError(".proto.Transaction.InnerTransactions: array expected");u.InnerTransactions=[];for(var f=0;f>>0,a.Nonce.high>>>0).toNumber(!0):a.Nonce),a.Value!=null&&a.hasOwnProperty("Value")&&(f.Value=u.bytes===String?n.base64.encode(a.Value,0,a.Value.length):u.bytes===Array?Array.prototype.slice.call(a.Value):a.Value),a.RcvAddr!=null&&a.hasOwnProperty("RcvAddr")&&(f.RcvAddr=u.bytes===String?n.base64.encode(a.RcvAddr,0,a.RcvAddr.length):u.bytes===Array?Array.prototype.slice.call(a.RcvAddr):a.RcvAddr),a.RcvUserName!=null&&a.hasOwnProperty("RcvUserName")&&(f.RcvUserName=u.bytes===String?n.base64.encode(a.RcvUserName,0,a.RcvUserName.length):u.bytes===Array?Array.prototype.slice.call(a.RcvUserName):a.RcvUserName),a.SndAddr!=null&&a.hasOwnProperty("SndAddr")&&(f.SndAddr=u.bytes===String?n.base64.encode(a.SndAddr,0,a.SndAddr.length):u.bytes===Array?Array.prototype.slice.call(a.SndAddr):a.SndAddr),a.SndUserName!=null&&a.hasOwnProperty("SndUserName")&&(f.SndUserName=u.bytes===String?n.base64.encode(a.SndUserName,0,a.SndUserName.length):u.bytes===Array?Array.prototype.slice.call(a.SndUserName):a.SndUserName),a.GasPrice!=null&&a.hasOwnProperty("GasPrice")&&(typeof a.GasPrice=="number"?f.GasPrice=u.longs===String?String(a.GasPrice):a.GasPrice:f.GasPrice=u.longs===String?n.Long.prototype.toString.call(a.GasPrice):u.longs===Number?new n.LongBits(a.GasPrice.low>>>0,a.GasPrice.high>>>0).toNumber(!0):a.GasPrice),a.GasLimit!=null&&a.hasOwnProperty("GasLimit")&&(typeof a.GasLimit=="number"?f.GasLimit=u.longs===String?String(a.GasLimit):a.GasLimit:f.GasLimit=u.longs===String?n.Long.prototype.toString.call(a.GasLimit):u.longs===Number?new n.LongBits(a.GasLimit.low>>>0,a.GasLimit.high>>>0).toNumber(!0):a.GasLimit),a.Data!=null&&a.hasOwnProperty("Data")&&(f.Data=u.bytes===String?n.base64.encode(a.Data,0,a.Data.length):u.bytes===Array?Array.prototype.slice.call(a.Data):a.Data),a.ChainID!=null&&a.hasOwnProperty("ChainID")&&(f.ChainID=u.bytes===String?n.base64.encode(a.ChainID,0,a.ChainID.length):u.bytes===Array?Array.prototype.slice.call(a.ChainID):a.ChainID),a.Version!=null&&a.hasOwnProperty("Version")&&(f.Version=a.Version),a.Signature!=null&&a.hasOwnProperty("Signature")&&(f.Signature=u.bytes===String?n.base64.encode(a.Signature,0,a.Signature.length):u.bytes===Array?Array.prototype.slice.call(a.Signature):a.Signature),a.Options!=null&&a.hasOwnProperty("Options")&&(f.Options=a.Options),a.GuardianAddr!=null&&a.hasOwnProperty("GuardianAddr")&&(f.GuardianAddr=u.bytes===String?n.base64.encode(a.GuardianAddr,0,a.GuardianAddr.length):u.bytes===Array?Array.prototype.slice.call(a.GuardianAddr):a.GuardianAddr),a.GuardianSignature!=null&&a.hasOwnProperty("GuardianSignature")&&(f.GuardianSignature=u.bytes===String?n.base64.encode(a.GuardianSignature,0,a.GuardianSignature.length):u.bytes===Array?Array.prototype.slice.call(a.GuardianSignature):a.GuardianSignature),a.Relayer!=null&&a.hasOwnProperty("Relayer")&&(f.Relayer=u.bytes===String?n.base64.encode(a.Relayer,0,a.Relayer.length):u.bytes===Array?Array.prototype.slice.call(a.Relayer):a.Relayer),a.InnerTransactions&&a.InnerTransactions.length){f.InnerTransactions=[];for(var S=0;S{"use strict";h();var Vte=Ei&&Ei.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hte=Ei&&Ei.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gte=Ei&&Ei.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vte(e,t,r);return Hte(e,t),e},zte=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.ProtoSerializer=void 0;var jte=zte((qt(),qe(jt))),D1=Nt(),g_=xr(),Qte=Gte(Ve()),Kte=na(),m_=class{serializeTransaction(e){let r=p_().proto,n=this.convertToProtoMessage(e),i=r.Transaction.encode(n).finish();return b.Buffer.from(i)}convertToProtoMessage(e){let r=p_().proto,n=new D1.Address(e.receiver).getPublicKey(),i=new D1.Address(e.sender).getPublicKey(),s=new r.Transaction({Nonce:Number(e.nonce)?Number(e.nonce):void 0,Value:this.serializeTransactionValue(e.value),RcvAddr:n,RcvUserName:e.receiverUsername?b.Buffer.from(e.receiverUsername).toString("base64"):void 0,SndAddr:i,SndUserName:e.senderUsername?b.Buffer.from(e.senderUsername).toString("base64"):void 0,GasPrice:Number(e.gasPrice),GasLimit:Number(e.gasLimit),Data:e.data.length==0?null:e.data,ChainID:b.Buffer.from(e.chainID),Version:e.version,Signature:e.signature});return e.options!==g_.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.options),this.isGuardedTransaction(e)&&(s.GuardianAddr=new D1.Address(e.guardian).getPublicKey(),s.GuardianSignature=e.guardianSignature),e.relayer&&(s.Relayer=new D1.Address(e.relayer).getPublicKey()),s.InnerTransactions=e.innerTransactions.map(o=>this.convertToProtoMessage(o)),s}serializeTransactionValue(e){let r=new jte.default(e.toString());if(r.isZero())return b.Buffer.from([0,0]);let n=Kte.bigIntToBuffer(r);return n=b.Buffer.concat([b.Buffer.from([0]),n]),n}isGuardedTransaction(e){let r=e.guardian.length>0,n=e.guardianSignature.length>0;return this.isWithGuardian(e)&&r&&n}isWithGuardian(e){return(e.options&g_.TRANSACTION_OPTIONS_TX_GUARDED)==g_.TRANSACTION_OPTIONS_TX_GUARDED}deserializeTransaction(e){throw new Qte.ErrUnsupportedOperation("deserializeTransaction")}};Ei.ProtoSerializer=m_});var vM=L(Gc=>{"use strict";h();var Wte=Gc&&Gc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$te=Gc&&Gc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wte(e,t,r)};Object.defineProperty(Gc,"__esModule",{value:!0});$te(yM(),Gc)});var B1=L(_i=>{"use strict";h();var Yte=_i&&_i.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jte=_i&&_i.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xte=_i&&_i.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yte(e,t,r);return Jte(e,t),e},Zte=_i&&_i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_i,"__esModule",{value:!0});_i.TransactionComputer=void 0;var bM=Zte((qt(),qe(jt))),Si=xr(),y_=Xte(Ve()),ere=vM(),tre=Dn(),rre=ZE(),nre=Yd(),ire=32,v_=class{constructor(){}computeTransactionFee(e,r){let n=BigInt(r.MinGasLimit+e.data.length*r.GasPerDataByte);if(n>e.gasLimit)throw new y_.ErrNotEnoughGas(parseInt(e.gasLimit.toString(),10));let i=e.gasPrice,s=n*i;if(n===e.gasLimit)return s;let o=e.gasLimit-n,c=BigInt(new bM.default(i.toString()).multipliedBy(new bM.default(r.GasPriceModifier)).toFixed(0)),a=o*c;return s+a}computeBytesForSigning(e){this.ensureValidTransactionFields(e);let r=this.toPlainObject(e),n=JSON.stringify(r);return new Uint8Array(b.Buffer.from(n))}computeBytesForVerifying(e){return this.hasOptionsSetForHashSigning(e)?this.computeHashForSigning(e):this.computeBytesForSigning(e)}computeHashForSigning(e){let r=this.toPlainObject(e),n=b.Buffer.from(JSON.stringify(r));return nre("keccak256").update(n).digest()}computeTransactionHash(e){let n=new ere.ProtoSerializer().serializeTransaction(new tre.Transaction(e)),i=rre(ire).update(n).digest("hex");return b.Buffer.from(i,"hex")}hasOptionsSetForGuardedTransaction(e){return(e.options&Si.TRANSACTION_OPTIONS_TX_GUARDED)==Si.TRANSACTION_OPTIONS_TX_GUARDED}hasOptionsSetForHashSigning(e){return(e.options&Si.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Si.TRANSACTION_OPTIONS_TX_HASH_SIGN}applyGuardian(e,r){e.versionthis.toPlainObject(i,!0)):void 0,n}toHexOrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("hex"):void 0}toBase64OrUndefined(e){return e&&e.length?b.Buffer.from(e).toString("base64"):void 0}ensureValidTransactionFields(e){if(!e.chainID.length)throw new y_.ErrBadUsage("The `chainID` field is not set");if(e.version= ${Si.MIN_TRANSACTION_VERSION_THAT_SUPPORTS_OPTIONS}`)}};_i.TransactionComputer=v_});var Dn=L(Ul=>{"use strict";h();Object.defineProperty(Ul,"__esModule",{value:!0});Ul.TransactionHash=Ul.Transaction=void 0;var wM=(qt(),qe(jt)),b_=Nt(),w_=xr(),AM=Vh(),sre=mR(),EM=Vd(),SM=N1(),ore=No(),A_=B1(),E_=class{constructor(e){this.nonce=BigInt(e.nonce?.valueOf()||0n),this.value=e.value?BigInt(new wM.BigNumber(e.value.toString()).toFixed(0)):0n,this.sender=this.addressAsBech32(e.sender),this.receiver=this.addressAsBech32(e.receiver),this.senderUsername=e.senderUsername||"",this.receiverUsername=e.receiverUsername||"",this.gasPrice=BigInt(e.gasPrice?.valueOf()||w_.TRANSACTION_MIN_GAS_PRICE),this.gasLimit=BigInt(e.gasLimit.valueOf()),this.data=e.data?.valueOf()||new Uint8Array,this.chainID=e.chainID.valueOf(),this.version=Number(e.version?.valueOf()||w_.TRANSACTION_VERSION_DEFAULT),this.options=Number(e.options?.valueOf()||w_.TRANSACTION_OPTIONS_DEFAULT),this.guardian=e.guardian?this.addressAsBech32(e.guardian):"",this.signature=e.signature||b.Buffer.from([]),this.guardianSignature=e.guardianSignature||b.Buffer.from([]),this.relayer=e.relayer||"",this.innerTransactions=e.innerTransactions||[]}addressAsBech32(e){return typeof e=="string"?e:e.bech32()}getNonce(){return Number(this.nonce)}setNonce(e){this.nonce=BigInt(e.valueOf())}getValue(){return this.value}setValue(e){this.value=BigInt(e.toString())}getSender(){return b_.Address.fromBech32(this.sender)}setSender(e){this.sender=typeof e=="string"?e:e.bech32()}getReceiver(){return b_.Address.fromBech32(this.receiver)}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return new b_.Address(this.guardian)}getGasPrice(){return Number(this.gasPrice)}setGasPrice(e){this.gasPrice=BigInt(e.valueOf())}getGasLimit(){return Number(this.gasLimit)}setGasLimit(e){this.gasLimit=BigInt(e.valueOf())}getData(){return new ore.TransactionPayload(b.Buffer.from(this.data))}getChainID(){return this.chainID}setChainID(e){this.chainID=e.valueOf()}getVersion(){return new EM.TransactionVersion(this.version)}setVersion(e){this.version=e.valueOf()}getOptions(){return new EM.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=e.valueOf()}getSignature(){return b.Buffer.from(this.signature)}getGuardianSignature(){return b.Buffer.from(this.guardianSignature)}setGuardian(e){this.guardian=typeof e=="string"?e:e.bech32()}getHash(){return L1.compute(this)}serializeForSigning(){let r=new A_.TransactionComputer().computeBytesForSigning(this);return b.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){return new AM.TransactionsConverter().transactionToPlainObject(this)}static fromPlainObject(e){return new AM.TransactionsConverter().plainObjectToTransaction(e)}applySignature(e){this.signature=SM.interpretSignatureAsBuffer(e)}applyGuardianSignature(e){this.guardianSignature=SM.interpretSignatureAsBuffer(e)}toSendable(){return this.toPlainObject()}computeFee(e){let n=new A_.TransactionComputer().computeTransactionFee(this,e);return new wM.BigNumber(n.toString())}};Ul.Transaction=E_;var L1=class t extends sre.Hash{constructor(e){super(e)}static compute(e){let n=new A_.TransactionComputer().computeTransactionHash(e);return new t(b.Buffer.from(n).toString("hex"))}};Ul.TransactionHash=L1});var TM=L(F1=>{"use strict";h();Object.defineProperty(F1,"__esModule",{value:!0});F1.TokenOperationsFactory=void 0;var S_=xr(),are=ra(),_M=Vd(),cre=Dn(),ure=No(),ce=Yp(),__=class{constructor(e){this.config=e,this.trueAsHex=ce.utf8ToHex("true"),this.falseAsHex=ce.utf8ToHex("false")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.bigIntToHex(e.initialSupply),ce.bigIntToHex(e.numDecimals),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){are.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.bigIntToHex(e.numDecimals),ae.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ae.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ae.utf8ToHex(e.tokenName),ae.utf8ToHex(e.tokenTicker),ae.utf8ToHex(e.tokenType),ae.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user),...e.addRoleLocalMint?[ae.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ae.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user),...e.addRoleNFTCreate?[ae.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ae.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ae.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ae.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user),...e.addRoleNFTCreate?[ae.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ae.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ae.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ae.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ae.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.initialQuantity),ae.utf8ToHex(e.name),ae.bigIntToHex(e.royalties),ae.utf8ToHex(e.hash),ae.bufferToHex(e.attributes),...e.uris.map(ae.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ae.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ae.utf8ToHex(e.tokenIdentifier),ae.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.tokenNonce),ae.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.tokenNonce),ae.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ae.utf8ToHex(e.tokenIdentifier),ae.bigIntToHex(e.tokenNonce),ae.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:u,dataParts:a}){let c=this.buildTransactionPayload(a),f=o||this.computeGasLimit(c,u),d=new pP.TransactionVersion(Db.TRANSACTION_VERSION_DEFAULT),w=new pP.TransactionOptions(Db.TRANSACTION_OPTIONS_DEFAULT);return new q$.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:c,version:d,options:w})}buildTransactionPayload(e){let r=e.join(Db.ARGUMENTS_SEPARATOR);return new V$.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};O0.TokenOperationsFactory=Pb});var yP=D(D0=>{"use strict";h();Object.defineProperty(D0,"__esModule",{value:!0});D0.TokenOperationsFactoryConfig=void 0;var k$=ke(),Rb=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=k$.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};D0.TokenOperationsFactoryConfig=Rb});var vP=D(P0=>{"use strict";h();Object.defineProperty(P0,"__esModule",{value:!0});P0.TokenOperationsOutcomeParser=void 0;var H$=ke(),Bb=Ie(),wP=Yd(),Mb=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=r.topics[3]?.valueOf();return{tokenIdentifier:n,nonce:i,attributes:s}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){for(let r of e.logs.events)if(r.identifier=="signalError"){let n=p.Buffer.from(r.data.substring(1),"hex").toString(),i=r.topics[1]?.valueOf().toString();throw new Bb.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${i} (${n})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new Bb.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new Bb.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){return e.topics[0]?.valueOf().toString()}extractNonce(e){return wP.bufferToBigInt(e.topics[1]?.valueOf()).toFixed(0)}extractAmount(e){return wP.bufferToBigInt(e.topics[2]?.valueOf()).toFixed(0)}extractAddress(e){return H$.Address.fromBuffer(e.topics[3]?.valueOf()).toString()}};P0.TokenOperationsOutcomeParser=Mb});var Fb=D(Ms=>{"use strict";h();var G$=Ms&&Ms.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lb=Ms&&Ms.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&G$(e,t,r)};Object.defineProperty(Ms,"__esModule",{value:!0});Lb(mP(),Ms);Lb(yP(),Ms);Lb(vP(),Ms)});var AP=D(R0=>{"use strict";h();Object.defineProperty(R0,"__esModule",{value:!0});R0.DelegationTransactionsOutcomeParser=void 0;var j$=ke(),z$=Ie(),Q$=vc(),Ub=class{constructor(){}parseCreateNewDelegationContract(e){return this.ensureNoError(e.logs.events),Q$.findEventsByIdentifier(e,"SCDeploy").map(n=>({contractAddress:this.extractContractAddress(n)}))}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=p.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new z$.ErrParseTransactionOutcome(`encountered signalError: ${i} (${p.Buffer.from(n,"hex").toString()})`)}}extractContractAddress(e){if(!e.topics[0]?.length)return"";let r=p.Buffer.from(e.topics[0]);return j$.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return p.Buffer.from(e).toString()}};R0.DelegationTransactionsOutcomeParser=Ub});var SP=D(B0=>{"use strict";h();Object.defineProperty(B0,"__esModule",{value:!0});B0.SmartContractTransactionsOutcomeParser=void 0;var EP=ke(),K$=Ie(),bP=Vn(),W$=vc(),qb=class{constructor(e){this.abi=e?.abi,this.legacyResultsParser=e?.legacyResultsParser||new bP.ResultsParser}parseDeploy(e){let r=e.transactionOutcome.directSmartContractCallOutcome,i=W$.findEventsByIdentifier(e.transactionOutcome,"SCDeploy").map(s=>this.parseScDeployEvent(s));return{returnCode:r.returnCode,returnMessage:r.returnMessage,contracts:i}}parseScDeployEvent(e){let r=e.topics[0],n=e.topics[1],i=e.topics[2],s=r?.length?new EP.Address(r).toBech32():"",o=n?.length?new EP.Address(n).toBech32():"";return{address:s,ownerAddress:o,codeHash:i}}parseExecute(e){let r=e.transactionOutcome.directSmartContractCallOutcome;if(!this.abi)return{values:r.returnDataParts,returnCode:r.returnCode,returnMessage:r.returnMessage};let n=e.function||r.function;if(!n)throw new K$.Err('Function name is not available in the transaction outcome, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');let i=this.abi.getEndpoint(n),s={returnCode:new bP.ReturnCode(r.returnCode),returnMessage:r.returnMessage,values:r.returnDataParts.map(u=>p.Buffer.from(u))},o=this.legacyResultsParser.parseOutcomeFromUntypedBundle(s,i);return{values:o.values.map(u=>u.valueOf()),returnCode:o.returnCode.toString(),returnMessage:o.returnMessage}}};B0.SmartContractTransactionsOutcomeParser=qb});var TP=D(M0=>{"use strict";h();Object.defineProperty(M0,"__esModule",{value:!0});M0.TokenManagementTransactionsOutcomeParser=void 0;var $$=ke(),IP=Ie(),_P=Pu(),vr=vc(),Vb=class{constructor(){}parseIssueFungible(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"issue").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueNonFungible(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"issueNonFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueSemiFungible(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"issueSemiFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterMetaEsdt(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"registerMetaESDT").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterAndSetAllRoles(e){this.ensureNoError(e.logs.events);let r=vr.findEventsByIdentifier(e,"registerAndSetAllRoles"),n=vr.findEventsByIdentifier(e,"ESDTSetRole");if(r.length!==n.length)throw new IP.ErrParseTransactionOutcome("Register Events and Set Role events mismatch. Should have the same number of events.");return r.map((i,s)=>{let o=this.extractTokenIdentifier(i),a=n[s].topics.slice(3).map(c=>this.decodeTopicAsString(c));return{tokenIdentifier:o,roles:a}})}parseSetBurnRoleGlobally(e){this.ensureNoError(e.logs.events)}parseUnsetBurnRoleGlobally(e){this.ensureNoError(e.logs.events)}parseSetSpecialRole(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTSetRole").map(n=>this.getOutputForSetSpecialRoleEvent(n))}getOutputForSetSpecialRoleEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),s=e.topics.slice(3).map(o=>this.decodeTopicAsString(o));return{userAddress:r,tokenIdentifier:n,roles:s}}parseNftCreate(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTCreate").map(n=>this.getOutputForNftCreateEvent(n))}getOutputForNftCreateEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,initialQuantity:i}}parseLocalMint(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTLocalMint").map(n=>this.getOutputForLocalMintEvent(n))}getOutputForLocalMintEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,mintedSupply:s}}parseLocalBurn(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTLocalBurn").map(n=>this.getOutputForLocalBurnEvent(n))}getOutputForLocalBurnEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,burntSupply:s}}parsePause(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseUnpause(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTUnPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseFreeze(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTFreeze").map(n=>this.getOutputForFreezeEvent(n))}getOutputForFreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTUnFreeze").map(n=>this.getOutputForUnfreezeEvent(n))}getOutputForUnfreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTWipe").map(n=>this.getOutputForWipeEvent(n))}getOutputForWipeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTUpdateAttributes").map(n=>this.getOutputForUpdateAttributesEvent(n))}getOutputForUpdateAttributesEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=e.topics[3]?e.topics[3]:new Uint8Array;return{tokenIdentifier:r,nonce:n,attributes:i}}parseAddQuantity(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTAddQuantity").map(n=>this.getOutputForAddQuantityEvent(n))}getOutputForAddQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,addedQuantity:i}}parseBurnQuantity(e){return this.ensureNoError(e.logs.events),vr.findEventsByIdentifier(e,"ESDTNFTBurn").map(n=>this.getOutputForBurnQuantityEvent(n))}getOutputForBurnQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,burntQuantity:i}}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=p.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new IP.ErrParseTransactionOutcome(`encountered signalError: ${i} (${p.Buffer.from(n,"hex").toString()})`)}}extractTokenIdentifier(e){return e.topics[0]?.length?this.decodeTopicAsString(e.topics[0]):""}extractNonce(e){if(!e.topics[1]?.length)return BigInt(0);let r=p.Buffer.from(e.topics[1]);return BigInt(_P.bufferToBigInt(r).toFixed(0))}extractAmount(e){if(!e.topics[2]?.length)return BigInt(0);let r=p.Buffer.from(e.topics[2]);return BigInt(_P.bufferToBigInt(r).toFixed(0))}extractAddress(e){if(!e.topics[3]?.length)return"";let r=p.Buffer.from(e.topics[3]);return $$.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return p.Buffer.from(e).toString()}};M0.TokenManagementTransactionsOutcomeParser=Vb});var CP=D(L0=>{"use strict";h();Object.defineProperty(L0,"__esModule",{value:!0});L0.TransactionEventsParser=void 0;var Y$=Vn(),kb=class{constructor(e){this.legacyResultsParser=new Y$.ResultsParser,this.abi=e.abi,this.firstTopicIsIdentifier=e.firstTopicIsIdentifier??!0}parseEvents(e){let r=[];for(let n of e.events){let i=this.parseEvent({event:n});r.push(i)}return r}parseEvent(e){let r=e.event.topics.map(u=>p.Buffer.from(u)),n=this.firstTopicIsIdentifier?r[0]?.toString():e.event.identifier;this.firstTopicIsIdentifier&&r.shift();let i=e.event.dataItems.map(u=>p.Buffer.from(u)),s=this.abi.getEvent(n);return this.legacyResultsParser.doParseEvent({topics:r,dataItems:i,eventDefinition:s})}};L0.TransactionEventsParser=kb});var Hb=D(bi=>{"use strict";h();var J$=bi&&bi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),th=bi&&bi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&J$(e,t,r)};Object.defineProperty(bi,"__esModule",{value:!0});th(AP(),bi);th(vc(),bi);th(SP(),bi);th(TP(),bi);th(CP(),bi)});var Sc=D(F0=>{"use strict";h();Object.defineProperty(F0,"__esModule",{value:!0});F0.Account=void 0;var X$=ke(),Gb=class{constructor(e){this.address=X$.Address.empty(),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()}}};F0.Account=Gb});var zb=D(Ic=>{"use strict";h();Object.defineProperty(Ic,"__esModule",{value:!0});Ic.MessageComputer=Ic.Message=void 0;var rh=yr(),Z$=ke(),eY=af(),U0=class{constructor(e){this.data=e.data,this.signature=e.signature,this.address=e.address,this.version=e.version||rh.DEFAULT_MESSAGE_VERSION,this.signer=e.signer||rh.SDK_JS_SIGNER}};Ic.Message=U0;var jb=class{constructor(){}computeBytesForSigning(e){let r=p.Buffer.from(e.data.length.toString()),n=p.Buffer.concat([r,e.data]),i=p.Buffer.concat([p.Buffer.from(rh.MESSAGE_PREFIX),n]);return eY("keccak256").update(i).digest()}computeBytesForVerifying(e){return this.computeBytesForSigning(e)}packMessage(e){return{message:p.Buffer.from(e.data).toString("hex"),signature:e.signature?p.Buffer.from(e.signature).toString("hex"):"",address:e.address?e.address.bech32():"",version:e.version,signer:e.signer}}unpackMessage(e){let r=this.trimHexPrefix(e.message),n=p.Buffer.from(r,"hex"),i=this.trimHexPrefix(e.signature||""),s=p.Buffer.from(i,"hex"),o;e.address&&(o=Z$.Address.fromBech32(e.address));let u=e.version||rh.DEFAULT_MESSAGE_VERSION,a=e.signer||rh.UNKNOWN_SIGNER;return new U0({data:n,signature:s,address:o,version:u,signer:a})}trimHexPrefix(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}};Ic.MessageComputer=jb});var Wb=D(es=>{"use strict";h();var tY=es&&es.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rY=es&&es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nY=es&&es.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tY(e,t,r);return rY(e,t),e};Object.defineProperty(es,"__esModule",{value:!0});es.AsyncTimer=void 0;var iY=nY(Ie()),sY=Ie(),Qb=so(),Kb=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new iY.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Qb.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){Qb.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new sY.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Qb.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};es.AsyncTimer=Kb});var V0=D(q0=>{"use strict";h();Object.defineProperty(q0,"__esModule",{value:!0});q0.TransactionWatcher=void 0;var $b=Wb(),NP=yr(),Ls=Ie(),xP=so(),Co=class t{constructor(e,r={}){this.fetcher=new Yb(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}async awaitPending(e){let r=s=>s.status.isPending(),n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Ls.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitCompleted(e){let r=s=>{if(s.isCompleted===void 0)throw new Ls.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Ls.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitAllEvents(e,r){let n=o=>{let u=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>u.includes(c))},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Ls.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitAnyEvent(e,r){let n=o=>{let u=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>u.includes(c))!=null},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Ls.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitOnCondition(e,r){let n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Ls.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}transactionOrTxHashToTxHash(e){let r=typeof e=="string"?e:e.getHash().hex();if(r.length!==NP.HEX_TRANSACTION_HASH_LENGTH)throw new Ls.Err(`Invalid transaction hash length. The length of a hex encoded hash should be ${NP.HEX_TRANSACTION_HASH_LENGTH}.`);return r}async awaitConditionally(e,r,n){let i=new $b.AsyncTimer("watcher:periodic"),s=new $b.AsyncTimer("watcher:patience"),o=new $b.AsyncTimer("watcher:timeout"),u=!1,a,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),u=!0});!u;){await i.start(this.pollingIntervalMilliseconds);try{if(a=await r(),c=e(a),c||u)break}catch(f){if(xP.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Ls.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Ls.Err))throw f}}if(c&&await s.start(this.patienceMilliseconds),o.isStopped()||o.stop(),!a||!c)throw n();return a}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};q0.TransactionWatcher=Co;Co.DefaultPollingInterval=6e3;Co.DefaultTimeout=Co.DefaultPollingInterval*15;Co.DefaultPatience=0;Co.NoopOnStatusReceived=t=>{};var Yb=class{constructor(e){this.fetcher=e}async getTransaction(e){return xP.Logger.debug(`transactionWatcher, getTransaction(${e})`),await this.fetcher.getTransaction(e)}}});var H0=D(k0=>{"use strict";h();Object.defineProperty(k0,"__esModule",{value:!0});k0.SignableMessage=void 0;var oY=ke(),aY=Yf(),uY=yr(),cY=af(),Jb=class{constructor(e){this.message=p.Buffer.from([]),this.signature=p.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=oY.Address.empty(),Object.assign(this,e)}serializeForSigning(){let e=p.Buffer.from(this.message.length.toString()),r=p.Buffer.concat([e,this.message]),n=p.Buffer.concat([p.Buffer.from(uY.MESSAGE_PREFIX),r]);return cY("keccak256").update(n).digest()}serializeForSigningRaw(){return p.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=aY.interpretSignatureAsBuffer(e)}getMessageSize(){let e=p.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};k0.SignableMessage=Jb});var _c=D(Ar=>{"use strict";h();var lY=Ar&&Ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fY=Ar&&Ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hY=Ar&&Ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lY(e,t,r);return fY(e,t),e};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.zeroPadStringIfOddLength=Ar.isPaddedHex=Ar.numberToPaddedHex=Ar.Nonce=Ar.Address=void 0;var OP=hY(_v()),dY="erd",Xb=class t{constructor(e){this.value=e}static fromPubkey(e){let r=OP.toWords(e),n=OP.encode(dY,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Ar.Address=Xb;var Zb=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return DP(this.value)}};Ar.Nonce=Zb;function DP(t){let e=t.toString(16);return PP(e)}Ar.numberToPaddedHex=DP;function gY(t){t=t||"";let e=p.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ar.isPaddedHex=gY;function PP(t){return t=t||"",t.length%2==1?"0"+t:t}Ar.zeroPadStringIfOddLength=PP});var RP=D(No=>{"use strict";h();var pY=No&&No.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(No,"__esModule",{value:!0});No.EsdtContractAddress=No.MaxUint64AsBigNumber=void 0;var mY=pY((nr(),xe(hr))),yY=_c();No.MaxUint64AsBigNumber=new mY.default("18446744073709551615");No.EsdtContractAddress=new yY.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var tS=D(Tc=>{"use strict";h();var wY=Tc&&Tc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tc,"__esModule",{value:!0});Tc.ContractQueryResponse=void 0;var vY=wY((nr(),xe(hr))),AY=RP(),eS=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new vY.default(e.gasRemaining||e.GasRemaining||0),o=AY.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>p.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};Tc.ContractQueryResponse=eS});var BP=D(xo=>{"use strict";h();Object.defineProperty(xo,"__esModule",{value:!0});xo.ErrAccountNotConnected=xo.ErrCannotSignSingleTransaction=xo.Err=void 0;var nh=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};xo.Err=nh;var rS=class extends nh{constructor(){super("Cannot sign single transaction.")}};xo.ErrCannotSignSingleTransaction=rS;var nS=class extends nh{constructor(){super("Account is not connected.")}};xo.ErrAccountNotConnected=nS});var MP=D(ih=>{"use strict";h();Object.defineProperty(ih,"__esModule",{value:!0});ih.Operation=void 0;var EY;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(EY=ih.Operation||(ih.Operation={}))});var iS=D(Cc=>{"use strict";h();var Oo=Cc&&Cc.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cc,"__esModule",{value:!0});Cc.ExtensionProvider=void 0;var bY=en(),LP=BP(),sh=MP(),oh=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Oo(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oo(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(sh.Operation.Connect,n),this.account.address})}logout(){return Oo(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(sh.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 Oo(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 Oo(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oo(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new LP.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new LP.ErrAccountNotConnected}signTransactions(e){return Oo(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(sh.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>bY.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Oo(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(sh.Operation.SignMessage,r)).signature,s=p.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(sh.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};Cc.ExtensionProvider=oh;oh._instance=new oh});function TY(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){CY(t);return}return e}function CY(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function ah(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!_Y.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(SY.test(t)||IY.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,TY)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var SY,IY,_Y,kP=de(()=>{h();SY=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,IY=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,_Y=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function NY(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function dr(t,...e){try{return NY(t(...e))}catch(r){return Promise.reject(r)}}function xY(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function OY(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function uh(t){if(xY(t))return String(t);if(OY(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return uh(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function HP(){if(typeof p.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function GP(t){if(typeof t=="string")return t;HP();let e=p.Buffer.from(t).toString("base64");return sS+e}function jP(t){return typeof t!="string"||!t.startsWith(sS)?t:(HP(),p.Buffer.from(t.slice(sS.length),"base64"))}function Hr(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function zP(...t){return Hr(t.join(":"))}function ch(t){return t=Hr(t),t?t+":":""}var sS,QP=de(()=>{h();sS="base64:"});function $P(t={}){let e={mounts:{"":t.driver||PY()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(d=>d.startsWith(c)||f&&c.startsWith(d)).map(d=>({relativeBase:c.length>d.length?c.slice(d.length):void 0,mountpoint:d,driver:e.mounts[d]})),i=(c,f)=>{if(e.watching){f=Hr(f);for(let d of e.watchListeners)d(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await KP(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},u=(c,f,d)=>{let w=new Map,A=_=>{let N=w.get(_.base);return N||(N={driver:_.driver,base:_.base,items:[]},w.set(_.base,N)),N};for(let _ of c){let N=typeof _=="string",P=Hr(N?_:_.key),V=N?void 0:_.value,U=N||!_.options?f:{...f,..._.options},Q=r(P);A(Q).items.push({key:P,value:V,relativeKey:Q.relativeKey,options:U})}return Promise.all([...w.values()].map(_=>d(_))).then(_=>_.flat())},a={hasItem(c,f={}){c=Hr(c);let{relativeKey:d,driver:w}=r(c);return dr(w.hasItem,d,f)},getItem(c,f={}){c=Hr(c);let{relativeKey:d,driver:w}=r(c);return dr(w.getItem,d,f).then(A=>ah(A))},getItems(c,f){return u(c,f,d=>d.driver.getItems?dr(d.driver.getItems,d.items.map(w=>({key:w.relativeKey,options:w.options})),f).then(w=>w.map(A=>({key:zP(d.base,A.key),value:ah(A.value)}))):Promise.all(d.items.map(w=>dr(d.driver.getItem,w.relativeKey,w.options).then(A=>({key:w.key,value:ah(A)})))))},getItemRaw(c,f={}){c=Hr(c);let{relativeKey:d,driver:w}=r(c);return w.getItemRaw?dr(w.getItemRaw,d,f):dr(w.getItem,d,f).then(A=>jP(A))},async setItem(c,f,d={}){if(f===void 0)return a.removeItem(c);c=Hr(c);let{relativeKey:w,driver:A}=r(c);A.setItem&&(await dr(A.setItem,w,uh(f),d),A.watch||i("update",c))},async setItems(c,f){await u(c,f,async d=>{if(d.driver.setItems)return dr(d.driver.setItems,d.items.map(w=>({key:w.relativeKey,value:uh(w.value),options:w.options})),f);d.driver.setItem&&await Promise.all(d.items.map(w=>dr(d.driver.setItem,w.relativeKey,uh(w.value),w.options)))})},async setItemRaw(c,f,d={}){if(f===void 0)return a.removeItem(c,d);c=Hr(c);let{relativeKey:w,driver:A}=r(c);if(A.setItemRaw)await dr(A.setItemRaw,w,f,d);else if(A.setItem)await dr(A.setItem,w,GP(f),d);else return;A.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=Hr(c);let{relativeKey:d,driver:w}=r(c);w.removeItem&&(await dr(w.removeItem,d,f),(f.removeMeta||f.removeMata)&&await dr(w.removeItem,d+"$",f),w.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=Hr(c);let{relativeKey:d,driver:w}=r(c),A=Object.create(null);if(w.getMeta&&Object.assign(A,await dr(w.getMeta,d,f)),!f.nativeOnly){let _=await dr(w.getItem,d+"$",f).then(N=>ah(N));_&&typeof _=="object"&&(typeof _.atime=="string"&&(_.atime=new Date(_.atime)),typeof _.mtime=="string"&&(_.mtime=new Date(_.mtime)),Object.assign(A,_))}return A},setMeta(c,f,d={}){return this.setItem(c+"$",f,d)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=ch(c);let d=n(c,!0),w=[],A=[];for(let _ of d){let P=(await dr(_.driver.getKeys,_.relativeBase,f)).map(V=>_.mountpoint+Hr(V)).filter(V=>!w.some(U=>V.startsWith(U)));A.push(...P),w=[_.mountpoint,...w.filter(V=>!V.startsWith(_.mountpoint))]}return c?A.filter(_=>_.startsWith(c)&&!_.endsWith("$")):A.filter(_=>!_.endsWith("$"))},async clear(c,f={}){c=ch(c),await Promise.all(n(c,!1).map(async d=>{if(d.driver.clear)return dr(d.driver.clear,d.relativeBase,f);if(d.driver.removeItem){let w=await d.driver.getKeys(d.relativeBase||"",f);return Promise.all(w.map(A=>d.driver.removeItem(A,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>WP(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=ch(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((d,w)=>w.length-d.length)),e.mounts[c]=f,e.watching&&Promise.resolve(KP(f,i,c)).then(d=>{e.unwatch[c]=d}).catch(console.error),a},async unmount(c,f=!0){c=ch(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await WP(e.mounts[c]),e.mountpoints=e.mountpoints.filter(d=>d!==c),delete e.mounts[c])},getMount(c=""){c=Hr(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=Hr(c),n(c,f.parents).map(w=>({driver:w.driver,base:w.mountpoint}))}};return a}function KP(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function WP(t){typeof t.dispose=="function"&&await dr(t.dispose)}var DY,PY,YP=de(()=>{h();kP();QP();DY="memory",PY=()=>{let t=new Map;return{name:DY,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function Ga(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function aS(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Ga(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function lh(){return oS||(oS=aS("keyval-store","keyval")),oS}function uS(t,e=lh()){return e("readonly",r=>Ga(r.get(t)))}function JP(t,e,r=lh()){return r("readwrite",n=>(n.put(e,t),Ga(n.transaction)))}function XP(t,e=lh()){return e("readwrite",r=>(r.delete(t),Ga(r.transaction)))}function ZP(t=lh()){return t("readwrite",e=>(e.clear(),Ga(e.transaction)))}function RY(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ga(t.transaction)}function e8(t=lh()){return t("readonly",e=>{if(e.getAllKeys)return Ga(e.getAllKeys());let r=[];return RY(e,n=>r.push(n.key)).then(()=>r)})}var oS,t8=de(()=>{h()});var r8={};Ot(r8,{safeJsonParse:()=>Po,safeJsonStringify:()=>Si});function Po(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return MY(t)}catch{return t}}function Si(t){return typeof t=="string"?t:BY(t)||""}var BY,MY,Nc=de(()=>{h();BY=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),MY=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var i8={};Ot(i8,{KeyValueStorage:()=>hS,default:()=>hS});function VY(t){var e;return[t[0],Po((e=t[1])!=null?e:"")]}var LY,FY,UY,qY,lS,cS,Q0,fS,kY,n8,HY,GY,hS,s8=de(()=>{h();YP();t8();Nc();LY="idb-keyval",FY=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=aS(t.dbName,t.storeName)),{name:LY,options:t,async hasItem(i){return!(typeof await uS(r(i),n)>"u")},async getItem(i){return await uS(r(i),n)??null},setItem(i,s){return JP(r(i),s,n)},removeItem(i){return XP(r(i),n)},getKeys(){return e8(n)},clear(){return ZP(n)}}},UY="WALLET_CONNECT_V2_INDEXED_DB",qY="keyvaluestorage",lS=class{constructor(){this.indexedDb=$P({driver:FY({dbName:UY,storeName:qY})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Si(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},cS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Q0={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof cS<"u"&&cS.localStorage?Q0.exports=cS.localStorage:typeof window<"u"&&window.localStorage?Q0.exports=window.localStorage:Q0.exports=new e})();fS=class{constructor(){this.localStorage=Q0.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(VY)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Po(r)}async setItem(e,r){this.localStorage.setItem(e,Si(r))}async removeItem(e){this.localStorage.removeItem(e)}},kY="wc_storage_version",n8=1,HY=async(t,e,r)=>{let n=kY,i=await e.getItem(n);if(i&&i>=n8){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let u=s.shift();if(!u)continue;let a=u.toLowerCase();if(a.includes("wc@")||a.includes("walletconnect")||a.includes("wc_")||a.includes("wallet_connect")){let c=await t.getItem(u);await e.setItem(u,c),o.push(u)}}await e.setItem(n,n8),r(e),GY(t,o)},GY=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},hS=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new fS;this.storage=e;try{let r=new lS;HY(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var xc={};Ot(xc,{__assign:()=>gS,__asyncDelegator:()=>rJ,__asyncGenerator:()=>tJ,__asyncValues:()=>nJ,__await:()=>fh,__awaiter:()=>$Y,__classPrivateFieldGet:()=>aJ,__classPrivateFieldSet:()=>uJ,__createBinding:()=>JY,__decorate:()=>QY,__exportStar:()=>XY,__extends:()=>jY,__generator:()=>YY,__importDefault:()=>oJ,__importStar:()=>sJ,__makeTemplateObject:()=>iJ,__metadata:()=>WY,__param:()=>KY,__read:()=>o8,__rest:()=>zY,__spread:()=>ZY,__spreadArrays:()=>eJ,__values:()=>pS});function jY(t,e){dS(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function zY(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;u--)(o=t[u])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function KY(t,e){return function(r,n){e(r,n,t)}}function WY(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function $Y(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})}function YY(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(c){return function(f){return a([c,f])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o8(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function ZY(){for(var t=[],e=0;e1||u(w,A)})})}function u(w,A){try{a(n[w](A))}catch(_){d(s[0][3],_)}}function a(w){w.value instanceof fh?Promise.resolve(w.value.v).then(c,f):d(s[0][2],w)}function c(w){u("next",w)}function f(w){u("throw",w)}function d(w,A){w(A),s.shift(),s.length&&u(s[0][0],s[0][1])}}function rJ(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:fh(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function nJ(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof pS=="function"?pS(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(u,a){o=t[s](o),i(u,a,o.done,o.value)})}}function i(s,o,u,a){Promise.resolve(a).then(function(c){s({value:c,done:u})},o)}}function iJ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function sJ(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function oJ(t){return t&&t.__esModule?t:{default:t}}function aJ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function uJ(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var dS,gS,Oc=de(()=>{h();dS=function(t,e){return dS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},dS(t,e)};gS=function(){return gS=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";h();Object.defineProperty(K0,"__esModule",{value:!0});K0.delay=void 0;function cJ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}K0.delay=cJ});var u8=D(Dc=>{"use strict";h();Object.defineProperty(Dc,"__esModule",{value:!0});Dc.ONE_THOUSAND=Dc.ONE_HUNDRED=void 0;Dc.ONE_HUNDRED=100;Dc.ONE_THOUSAND=1e3});var c8=D(le=>{"use strict";h();Object.defineProperty(le,"__esModule",{value:!0});le.ONE_YEAR=le.FOUR_WEEKS=le.THREE_WEEKS=le.TWO_WEEKS=le.ONE_WEEK=le.THIRTY_DAYS=le.SEVEN_DAYS=le.FIVE_DAYS=le.THREE_DAYS=le.ONE_DAY=le.TWENTY_FOUR_HOURS=le.TWELVE_HOURS=le.SIX_HOURS=le.THREE_HOURS=le.ONE_HOUR=le.SIXTY_MINUTES=le.THIRTY_MINUTES=le.TEN_MINUTES=le.FIVE_MINUTES=le.ONE_MINUTE=le.SIXTY_SECONDS=le.THIRTY_SECONDS=le.TEN_SECONDS=le.FIVE_SECONDS=le.ONE_SECOND=void 0;le.ONE_SECOND=1;le.FIVE_SECONDS=5;le.TEN_SECONDS=10;le.THIRTY_SECONDS=30;le.SIXTY_SECONDS=60;le.ONE_MINUTE=le.SIXTY_SECONDS;le.FIVE_MINUTES=le.ONE_MINUTE*5;le.TEN_MINUTES=le.ONE_MINUTE*10;le.THIRTY_MINUTES=le.ONE_MINUTE*30;le.SIXTY_MINUTES=le.ONE_MINUTE*60;le.ONE_HOUR=le.SIXTY_MINUTES;le.THREE_HOURS=le.ONE_HOUR*3;le.SIX_HOURS=le.ONE_HOUR*6;le.TWELVE_HOURS=le.ONE_HOUR*12;le.TWENTY_FOUR_HOURS=le.ONE_HOUR*24;le.ONE_DAY=le.TWENTY_FOUR_HOURS;le.THREE_DAYS=le.ONE_DAY*3;le.FIVE_DAYS=le.ONE_DAY*5;le.SEVEN_DAYS=le.ONE_DAY*7;le.THIRTY_DAYS=le.ONE_DAY*30;le.ONE_WEEK=le.SEVEN_DAYS;le.TWO_WEEKS=le.ONE_WEEK*2;le.THREE_WEEKS=le.ONE_WEEK*3;le.FOUR_WEEKS=le.ONE_WEEK*4;le.ONE_YEAR=le.ONE_DAY*365});var mS=D(W0=>{"use strict";h();Object.defineProperty(W0,"__esModule",{value:!0});var l8=(Oc(),xe(xc));l8.__exportStar(u8(),W0);l8.__exportStar(c8(),W0)});var h8=D(Pc=>{"use strict";h();Object.defineProperty(Pc,"__esModule",{value:!0});Pc.fromMiliseconds=Pc.toMiliseconds=void 0;var f8=mS();function lJ(t){return t*f8.ONE_THOUSAND}Pc.toMiliseconds=lJ;function fJ(t){return Math.floor(t/f8.ONE_THOUSAND)}Pc.fromMiliseconds=fJ});var g8=D($0=>{"use strict";h();Object.defineProperty($0,"__esModule",{value:!0});var d8=(Oc(),xe(xc));d8.__exportStar(a8(),$0);d8.__exportStar(h8(),$0)});var p8=D(hh=>{"use strict";h();Object.defineProperty(hh,"__esModule",{value:!0});hh.Watch=void 0;var Y0=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};hh.Watch=Y0;hh.default=Y0});var m8=D(J0=>{"use strict";h();Object.defineProperty(J0,"__esModule",{value:!0});J0.IWatch=void 0;var yS=class{};J0.IWatch=yS});var y8=D(wS=>{"use strict";h();Object.defineProperty(wS,"__esModule",{value:!0});var hJ=(Oc(),xe(xc));hJ.__exportStar(m8(),wS)});var Bc=D(Rc=>{"use strict";h();Object.defineProperty(Rc,"__esModule",{value:!0});var X0=(Oc(),xe(xc));X0.__exportStar(g8(),Rc);X0.__exportStar(p8(),Rc);X0.__exportStar(y8(),Rc);X0.__exportStar(mS(),Rc)});var dh,w8=de(()=>{h();dh=class{}});var v8={};Ot(v8,{IEvents:()=>dh});var vS=de(()=>{h();w8()});var b8={};Ot(b8,{HEARTBEAT_EVENTS:()=>E8,HEARTBEAT_INTERVAL:()=>AS,HeartBeat:()=>ES,IHeartBeat:()=>Z0});var A8,em,Z0,AS,E8,ES,S8=de(()=>{h();A8=ge(Os()),em=ge(Bc());vS();Z0=class extends dh{constructor(e){super()}},AS=em.FIVE_SECONDS,E8={pulse:"heartbeat_pulse"},ES=class t extends Z0{constructor(e){super(e),this.events=new A8.EventEmitter,this.interval=AS,this.interval=e?.interval||AS}static async init(e){let r=new t(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,em.toMiliseconds)(this.interval))}pulse(){this.events.emit(E8.pulse)}}});var _8=D((KAe,I8)=>{"use strict";h();function dJ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}I8.exports=gJ;function gJ(t,e,r){var n=r&&r.stringify||dJ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var u=1;u-1?d:0,t.charCodeAt(A+1)){case 100:case 102:if(f>=a||e[f]==null)break;d=a||e[f]==null)break;d=a||e[f]===void 0)break;d",d=A+2,A++;break}c+=n(e[f]),d=A+2,A++;break;case 115:if(f>=a)break;d{"use strict";h();var T8=_8();x8.exports=ts;var gh=IJ().console||{},pJ={mapHttpRequest:tm,mapHttpResponse:tm,wrapRequestSerializer:bS,wrapResponseSerializer:bS,wrapErrorSerializer:bS,req:tm,res:tm,err:AJ};function mJ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function ts(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||gh;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=mJ(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let u=t.level||"info",a=Object.create(r);a.log||(a.log=ph),Object.defineProperty(a,"levelVal",{get:f}),Object.defineProperty(a,"level",{get:d,set:w});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:EJ(t)};a.levels=ts.levels,a.level=u,a.setMaxListeners=a.getMaxListeners=a.emit=a.addListener=a.on=a.prependListener=a.once=a.prependOnceListener=a.removeListener=a.removeAllListeners=a.listeners=a.listenerCount=a.eventNames=a.write=a.flush=ph,a.serializers=n,a._serialize=i,a._stdErrSerialize=s,a.child=A,e&&(a._logEvent=SS());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function w(_){if(_!=="silent"&&!this.levels.values[_])throw Error("unknown level "+_);this._level=_,Mc(c,a,"error","log"),Mc(c,a,"fatal","error"),Mc(c,a,"warn","error"),Mc(c,a,"info","log"),Mc(c,a,"debug","log"),Mc(c,a,"trace","log")}function A(_,N){if(!_)throw new Error("missing bindings for child Pino");N=N||{},i&&_.serializers&&(N.serializers=_.serializers);let P=N.serializers;if(i&&P){var V=Object.assign({},n,P),U=t.browser.serialize===!0?Object.keys(V):i;delete _.serializers,rm([_],U,V,this._stdErrSerialize)}function Q(L){this._childLevel=(L._childLevel|0)+1,this.error=Lc(L,_,"error"),this.fatal=Lc(L,_,"fatal"),this.warn=Lc(L,_,"warn"),this.info=Lc(L,_,"info"),this.debug=Lc(L,_,"debug"),this.trace=Lc(L,_,"trace"),V&&(this.serializers=V,this._serialize=U),e&&(this._logEvent=SS([].concat(L._logEvent.bindings,_)))}return Q.prototype=this,new Q(this)}return a}ts.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"}};ts.stdSerializers=pJ;ts.stdTimeFunctions=Object.assign({},{nullTime:C8,epochTime:N8,unixTime:bJ,isoTime:SJ});function Mc(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?ph:i[r]?i[r]:gh[r]||gh[n]||ph,yJ(t,e,r)}function yJ(t,e,r){!t.transmit&&e[r]===ph||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===gh?gh:this;for(var a=0;a-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Lc(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;iam,PINO_CUSTOM_CONTEXT_KEY:()=>Fc,PINO_LOGGER_DEFAULTS:()=>R8,formatChildLoggerContext:()=>F8,generateChildLogger:()=>DJ,generateClientLogger:()=>U8,generatePlatformLogger:()=>PJ,generateServerLogger:()=>q8,getBrowserLoggerContext:()=>B8,getDefaultLoggerOptions:()=>OJ,getLoggerContext:()=>L8,pino:()=>P8.default,setBrowserLoggerContext:()=>M8});function OJ(t){return om(sm({},t),{level:t?.level||R8.level})}function B8(t,e=Fc){return t[e]||""}function M8(t,e,r=Fc){return t[r]=e,t}function L8(t,e=Fc){let r="";return typeof t.bindings>"u"?r=B8(t,e):r=t.bindings().context||"",r}function F8(t,e,r=Fc){let n=L8(t,r);return n.trim()?`${n}/${e}`:e}function DJ(t,e,r=Fc){let n=F8(t,e,r),i=t.child({context:n});return M8(i,n,r)}function U8(t){var e,r;let n=new TS((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Fs.default)(om(sm({},t.opts),{level:"trace",browser:om(sm({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function q8(t){var e;let r=new CS((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Fs.default)(om(sm({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function PJ(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?U8(t):q8(t)}var Fs,P8,R8,Fc,am,_S,nm,im,TS,CS,_J,TJ,CJ,O8,NJ,xJ,D8,sm,om,xS=de(()=>{h();Fs=ge(IS()),P8=ge(IS());Nc();R8={level:"info"},Fc="custom_context",am=1e3*1024,_S=class{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},nm=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let r=new _S(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};let r=e.value;return e=e.next,{done:!1,value:r}}}}},im=class{constructor(e,r=am){this.level=e??"error",this.levelValue=Fs.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new nm(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Fs.levels.values.error?console.error(e):r===Fs.levels.values.warn?console.warn(e):r===Fs.levels.values.debug?console.debug(e):r===Fs.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Si({timestamp:new Date().toISOString(),log:e}));let r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new nm(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let r=this.getLogArray();return r.push(Si({extraMetadata:e})),new Blob(r,{type:"application/json"})}},TS=class{constructor(e,r=am){this.baseChunkLogger=new im(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){let r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},CS=class{constructor(e,r=am){this.baseChunkLogger=new im(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}},_J=Object.defineProperty,TJ=Object.defineProperties,CJ=Object.getOwnPropertyDescriptors,O8=Object.getOwnPropertySymbols,NJ=Object.prototype.hasOwnProperty,xJ=Object.prototype.propertyIsEnumerable,D8=(t,e,r)=>e in t?_J(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sm=(t,e)=>{for(var r in e||(e={}))NJ.call(e,r)&&D8(t,r,e[r]);if(O8)for(var r of O8(e))xJ.call(e,r)&&D8(t,r,e[r]);return t},om=(t,e)=>TJ(t,CJ(e))});var WS=D(ur=>{"use strict";h();Object.defineProperty(ur,"__esModule",{value:!0});var Uc=(vS(),xe(v8)),V8=Os();function RJ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var BJ=RJ(V8),OS=class extends Uc.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},DS=class{constructor(e,r,n){this.core=e,this.logger=r}},PS=class extends Uc.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},RS=class{constructor(e,r){this.logger=e,this.core=r}},BS=class extends Uc.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},MS=class extends Uc.IEvents{constructor(e){super()}},LS=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},FS=class{constructor(){this.map=new Map}},US=class extends Uc.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},qS=class{constructor(e,r){this.core=e,this.logger=r}},VS=class extends Uc.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},kS=class{constructor(e,r){this.logger=e,this.core=r}},HS=class{constructor(e,r){this.projectId=e,this.logger=r}},GS=class{constructor(e,r){this.projectId=e,this.logger=r}},jS=class extends BJ.default{constructor(){super()}},zS=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},QS=class extends V8.EventEmitter{constructor(){super()}},KS=class{constructor(e){this.client=e}};ur.ICore=OS,ur.ICrypto=DS,ur.IEchoClient=GS,ur.IEngine=KS,ur.IEngineEvents=QS,ur.IExpirer=VS,ur.IJsonRpcHistory=PS,ur.IKeyChain=qS,ur.IMessageTracker=RS,ur.IPairing=kS,ur.IPublisher=BS,ur.IRelayer=MS,ur.ISignClient=zS,ur.ISignClientEvents=jS,ur.IStore=LS,ur.ISubscriber=US,ur.ISubscriberTopicMap=FS,ur.IVerify=HS});var H8=D(um=>{"use strict";h();Object.defineProperty(um,"__esModule",{value:!0});um.BrowserRandomSource=void 0;var k8=65536,$S=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";h();Object.defineProperty(YS,"__esModule",{value:!0});function MJ(t){for(var e=0;e{h()});var j8=D(cm=>{"use strict";h();Object.defineProperty(cm,"__esModule",{value:!0});cm.NodeRandomSource=void 0;var LJ=Wn(),JS=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Pd<"u"){let e=G8();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";h();Object.defineProperty(lm,"__esModule",{value:!0});lm.SystemRandomSource=void 0;var FJ=H8(),UJ=j8(),XS=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new FJ.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new UJ.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)}};lm.SystemRandomSource=XS});var Q8=D(gn=>{"use strict";h();Object.defineProperty(gn,"__esModule",{value:!0});function qJ(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}gn.mul=Math.imul||qJ;function VJ(t,e){return t+e|0}gn.add=VJ;function kJ(t,e){return t-e|0}gn.sub=kJ;function HJ(t,e){return t<>>32-e}gn.rotl=HJ;function GJ(t,e){return t<<32-e|t>>>e}gn.rotr=GJ;function jJ(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}gn.isInteger=Number.isInteger||jJ;gn.MAX_SAFE_INTEGER=9007199254740991;gn.isSafeInteger=function(t){return gn.isInteger(t)&&t>=-gn.MAX_SAFE_INTEGER&&t<=gn.MAX_SAFE_INTEGER}});var qc=D(Ne=>{"use strict";h();Object.defineProperty(Ne,"__esModule",{value:!0});var K8=Q8();function zJ(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=zJ;function QJ(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=QJ;function KJ(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=KJ;function WJ(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=WJ;function W8(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=W8;Ne.writeInt16BE=W8;function $8(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=$8;Ne.writeInt16LE=$8;function ZS(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=ZS;function eI(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=eI;function tI(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=tI;function rI(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=rI;function fm(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=fm;Ne.writeInt32BE=fm;function hm(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=hm;Ne.writeInt32LE=hm;function $J(t,e){e===void 0&&(e=0);var r=ZS(t,e),n=ZS(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=$J;function YJ(t,e){e===void 0&&(e=0);var r=eI(t,e),n=eI(t,e+4);return r*4294967296+n}Ne.readUint64BE=YJ;function JJ(t,e){e===void 0&&(e=0);var r=tI(t,e),n=tI(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=JJ;function XJ(t,e){e===void 0&&(e=0);var r=rI(t,e),n=rI(t,e+4);return n*4294967296+r}Ne.readUint64LE=XJ;function Y8(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fm(t/4294967296>>>0,e,r),fm(t>>>0,e,r+4),e}Ne.writeUint64BE=Y8;Ne.writeInt64BE=Y8;function J8(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),hm(t>>>0,e,r),hm(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=J8;Ne.writeInt64LE=J8;function ZJ(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=ZJ;function eX(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=tX;function rX(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!K8.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";h();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.randomStringForEntropy=Mr.randomString=Mr.randomUint32=Mr.randomBytes=Mr.defaultRandomSource=void 0;var fX=z8(),hX=qc(),X8=Wn();Mr.defaultRandomSource=new fX.SystemRandomSource;function nI(t,e=Mr.defaultRandomSource){return e.randomBytes(t)}Mr.randomBytes=nI;function dX(t=Mr.defaultRandomSource){let e=nI(4,t),r=(0,hX.readUint32LE)(e);return(0,X8.wipe)(e),r}Mr.randomUint32=dX;var Z8="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function eR(t,e=Z8,r=Mr.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=nI(Math.ceil(t*256/s),r);for(let u=0;u0;u++){let a=o[u];a{"use strict";h();Object.defineProperty(Us,"__esModule",{value:!0});var kc=qc(),Vc=Wn();Us.DIGEST_LENGTH=64;Us.BLOCK_SIZE=128;var rR=function(){function t(){this.digestLength=Us.DIGEST_LENGTH,this.blockSize=Us.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Vc.wipe(this._buffer),Vc.wipe(this._tempHi),Vc.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(iI(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=iI(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var u=n+1;u0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Vc.wipe(e.stateHi),Vc.wipe(e.stateLo),e.buffer&&Vc.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Us.SHA512=rR;var tR=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 iI(t,e,r,n,i,s,o){for(var u=r[0],a=r[1],c=r[2],f=r[3],d=r[4],w=r[5],A=r[6],_=r[7],N=n[0],P=n[1],V=n[2],U=n[3],Q=n[4],L=n[5],k=n[6],H=n[7],q,v,C,R,F,B,l,g;o>=128;){for(var y=0;y<16;y++){var E=8*y+s;t[y]=kc.readUint32BE(i,E),e[y]=kc.readUint32BE(i,E+4)}for(var y=0;y<80;y++){var I=u,T=a,M=c,x=f,m=d,O=w,Y=A,$=_,b=N,j=P,z=V,W=U,ie=Q,te=L,ee=k,se=H;if(q=_,v=H,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=(d>>>14|Q<<18)^(d>>>18|Q<<14)^(Q>>>9|d<<23),v=(Q>>>14|d<<18)^(Q>>>18|d<<14)^(d>>>9|Q<<23),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=d&w^~d&A,v=Q&L^~Q&k,F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=tR[y*2],v=tR[y*2+1],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=t[y%16],v=e[y%16],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,C=l&65535|g<<16,R=F&65535|B<<16,q=C,v=R,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=(u>>>28|N<<4)^(N>>>2|u<<30)^(N>>>7|u<<25),v=(N>>>28|u<<4)^(u>>>2|N<<30)^(u>>>7|N<<25),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,q=u&a^u&c^a&c,v=N&P^N&V^P&V,F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,$=l&65535|g<<16,se=F&65535|B<<16,q=x,v=W,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=C,v=R,F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,x=l&65535|g<<16,W=F&65535|B<<16,a=I,c=T,f=M,d=x,w=m,A=O,_=Y,u=$,P=b,V=j,U=z,Q=W,L=ie,k=te,H=ee,N=se,y%16===15)for(var E=0;E<16;E++)q=t[E],v=e[E],F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=t[(E+9)%16],v=e[(E+9)%16],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,C=t[(E+1)%16],R=e[(E+1)%16],q=(C>>>1|R<<31)^(C>>>8|R<<24)^C>>>7,v=(R>>>1|C<<31)^(R>>>8|C<<24)^(R>>>7|C<<25),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,C=t[(E+14)%16],R=e[(E+14)%16],q=(C>>>19|R<<13)^(R>>>29|C<<3)^C>>>6,v=(R>>>19|C<<13)^(C>>>29|R<<3)^(R>>>6|C<<26),F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,t[E]=l&65535|g<<16,e[E]=F&65535|B<<16}q=u,v=N,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[0],v=n[0],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[0]=u=l&65535|g<<16,n[0]=N=F&65535|B<<16,q=a,v=P,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[1],v=n[1],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[1]=a=l&65535|g<<16,n[1]=P=F&65535|B<<16,q=c,v=V,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[2],v=n[2],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[2]=c=l&65535|g<<16,n[2]=V=F&65535|B<<16,q=f,v=U,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[3],v=n[3],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[3]=f=l&65535|g<<16,n[3]=U=F&65535|B<<16,q=d,v=Q,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[4],v=n[4],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[4]=d=l&65535|g<<16,n[4]=Q=F&65535|B<<16,q=w,v=L,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[5],v=n[5],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[5]=w=l&65535|g<<16,n[5]=L=F&65535|B<<16,q=A,v=k,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[6],v=n[6],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[6]=A=l&65535|g<<16,n[6]=k=F&65535|B<<16,q=_,v=H,F=v&65535,B=v>>>16,l=q&65535,g=q>>>16,q=r[7],v=n[7],F+=v&65535,B+=v>>>16,l+=q&65535,g+=q>>>16,B+=F>>>16,l+=B>>>16,g+=l>>>16,r[7]=_=l&65535|g<<16,n[7]=H=F&65535|B<<16,s+=128,o-=128}return s}function pX(t){var e=new rR;e.update(t);var r=e.digest();return e.clean(),r}Us.hash=pX});var yR=D(Ge=>{"use strict";h();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.convertSecretKeyToX25519=Ge.convertPublicKeyToX25519=Ge.verify=Ge.sign=Ge.extractPublicKeyFromSecretKey=Ge.generateKeyPair=Ge.generateKeyPairFromSeed=Ge.SEED_LENGTH=Ge.SECRET_KEY_LENGTH=Ge.PUBLIC_KEY_LENGTH=Ge.SIGNATURE_LENGTH=void 0;var mX=mh(),yh=nR(),uR=Wn();Ge.SIGNATURE_LENGTH=64;Ge.PUBLIC_KEY_LENGTH=32;Ge.SECRET_KEY_LENGTH=64;Ge.SEED_LENGTH=32;function Ae(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,cR(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function lR(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function oR(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return wh(r,t),wh(n,e),lR(r,n)}function fR(t){let e=new Uint8Array(32);return wh(e,t),e[0]&1}function EX(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function ja(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Qa(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Nt(t,e,r){let n,i,s=0,o=0,u=0,a=0,c=0,f=0,d=0,w=0,A=0,_=0,N=0,P=0,V=0,U=0,Q=0,L=0,k=0,H=0,q=0,v=0,C=0,R=0,F=0,B=0,l=0,g=0,y=0,E=0,I=0,T=0,M=0,x=r[0],m=r[1],O=r[2],Y=r[3],$=r[4],b=r[5],j=r[6],z=r[7],W=r[8],ie=r[9],te=r[10],ee=r[11],se=r[12],oe=r[13],J=r[14],ue=r[15];n=e[0],s+=n*x,o+=n*m,u+=n*O,a+=n*Y,c+=n*$,f+=n*b,d+=n*j,w+=n*z,A+=n*W,_+=n*ie,N+=n*te,P+=n*ee,V+=n*se,U+=n*oe,Q+=n*J,L+=n*ue,n=e[1],o+=n*x,u+=n*m,a+=n*O,c+=n*Y,f+=n*$,d+=n*b,w+=n*j,A+=n*z,_+=n*W,N+=n*ie,P+=n*te,V+=n*ee,U+=n*se,Q+=n*oe,L+=n*J,k+=n*ue,n=e[2],u+=n*x,a+=n*m,c+=n*O,f+=n*Y,d+=n*$,w+=n*b,A+=n*j,_+=n*z,N+=n*W,P+=n*ie,V+=n*te,U+=n*ee,Q+=n*se,L+=n*oe,k+=n*J,H+=n*ue,n=e[3],a+=n*x,c+=n*m,f+=n*O,d+=n*Y,w+=n*$,A+=n*b,_+=n*j,N+=n*z,P+=n*W,V+=n*ie,U+=n*te,Q+=n*ee,L+=n*se,k+=n*oe,H+=n*J,q+=n*ue,n=e[4],c+=n*x,f+=n*m,d+=n*O,w+=n*Y,A+=n*$,_+=n*b,N+=n*j,P+=n*z,V+=n*W,U+=n*ie,Q+=n*te,L+=n*ee,k+=n*se,H+=n*oe,q+=n*J,v+=n*ue,n=e[5],f+=n*x,d+=n*m,w+=n*O,A+=n*Y,_+=n*$,N+=n*b,P+=n*j,V+=n*z,U+=n*W,Q+=n*ie,L+=n*te,k+=n*ee,H+=n*se,q+=n*oe,v+=n*J,C+=n*ue,n=e[6],d+=n*x,w+=n*m,A+=n*O,_+=n*Y,N+=n*$,P+=n*b,V+=n*j,U+=n*z,Q+=n*W,L+=n*ie,k+=n*te,H+=n*ee,q+=n*se,v+=n*oe,C+=n*J,R+=n*ue,n=e[7],w+=n*x,A+=n*m,_+=n*O,N+=n*Y,P+=n*$,V+=n*b,U+=n*j,Q+=n*z,L+=n*W,k+=n*ie,H+=n*te,q+=n*ee,v+=n*se,C+=n*oe,R+=n*J,F+=n*ue,n=e[8],A+=n*x,_+=n*m,N+=n*O,P+=n*Y,V+=n*$,U+=n*b,Q+=n*j,L+=n*z,k+=n*W,H+=n*ie,q+=n*te,v+=n*ee,C+=n*se,R+=n*oe,F+=n*J,B+=n*ue,n=e[9],_+=n*x,N+=n*m,P+=n*O,V+=n*Y,U+=n*$,Q+=n*b,L+=n*j,k+=n*z,H+=n*W,q+=n*ie,v+=n*te,C+=n*ee,R+=n*se,F+=n*oe,B+=n*J,l+=n*ue,n=e[10],N+=n*x,P+=n*m,V+=n*O,U+=n*Y,Q+=n*$,L+=n*b,k+=n*j,H+=n*z,q+=n*W,v+=n*ie,C+=n*te,R+=n*ee,F+=n*se,B+=n*oe,l+=n*J,g+=n*ue,n=e[11],P+=n*x,V+=n*m,U+=n*O,Q+=n*Y,L+=n*$,k+=n*b,H+=n*j,q+=n*z,v+=n*W,C+=n*ie,R+=n*te,F+=n*ee,B+=n*se,l+=n*oe,g+=n*J,y+=n*ue,n=e[12],V+=n*x,U+=n*m,Q+=n*O,L+=n*Y,k+=n*$,H+=n*b,q+=n*j,v+=n*z,C+=n*W,R+=n*ie,F+=n*te,B+=n*ee,l+=n*se,g+=n*oe,y+=n*J,E+=n*ue,n=e[13],U+=n*x,Q+=n*m,L+=n*O,k+=n*Y,H+=n*$,q+=n*b,v+=n*j,C+=n*z,R+=n*W,F+=n*ie,B+=n*te,l+=n*ee,g+=n*se,y+=n*oe,E+=n*J,I+=n*ue,n=e[14],Q+=n*x,L+=n*m,k+=n*O,H+=n*Y,q+=n*$,v+=n*b,C+=n*j,R+=n*z,F+=n*W,B+=n*ie,l+=n*te,g+=n*ee,y+=n*se,E+=n*oe,I+=n*J,T+=n*ue,n=e[15],L+=n*x,k+=n*m,H+=n*O,q+=n*Y,v+=n*$,C+=n*b,R+=n*j,F+=n*z,B+=n*W,l+=n*ie,g+=n*te,y+=n*ee,E+=n*se,I+=n*oe,T+=n*J,M+=n*ue,s+=38*k,o+=38*H,u+=38*q,a+=38*v,c+=38*C,f+=38*R,d+=38*F,w+=38*B,A+=38*l,_+=38*g,N+=38*y,P+=38*E,V+=38*I,U+=38*T,Q+=38*M,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=u,t[3]=a,t[4]=c,t[5]=f,t[6]=d,t[7]=w,t[8]=A,t[9]=_,t[10]=N,t[11]=P,t[12]=V,t[13]=U,t[14]=Q,t[15]=L}function za(t,e){Nt(t,e,e)}function hR(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)za(r,r),n!==2&&n!==4&&Nt(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function bX(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)za(r,r),n!==1&&Nt(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function uI(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),u=Ae(),a=Ae(),c=Ae(),f=Ae();Qa(r,t[1],t[0]),Qa(f,e[1],e[0]),Nt(r,r,f),ja(n,t[0],t[1]),ja(f,e[0],e[1]),Nt(n,n,f),Nt(i,t[3],e[3]),Nt(i,i,vX),Nt(s,t[2],e[2]),ja(s,s,s),Qa(o,n,r),Qa(u,s,i),ja(a,s,i),ja(c,n,r),Nt(t[0],o,u),Nt(t[1],c,a),Nt(t[2],a,u),Nt(t[3],o,c)}function aR(t,e,r){for(let n=0;n<4;n++)cR(t[n],e[n],r)}function lI(t,e){let r=Ae(),n=Ae(),i=Ae();hR(i,e[2]),Nt(r,e[0],i),Nt(n,e[1],i),wh(t,n),t[31]^=fR(r)<<7}function dR(t,e,r){Ro(t[0],aI),Ro(t[1],Hc),Ro(t[2],Hc),Ro(t[3],aI);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;aR(t,e,i),uI(e,t),uI(t,t),aR(t,e,i)}}function fI(t,e){let r=[Ae(),Ae(),Ae(),Ae()];Ro(r[0],iR),Ro(r[1],sR),Ro(r[2],Hc),Nt(r[3],iR,sR),dR(t,r,e)}function gR(t){if(t.length!==Ge.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ge.SEED_LENGTH} bytes`);let e=(0,yh.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ae(),Ae(),Ae(),Ae()];fI(n,e),lI(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ge.generateKeyPairFromSeed=gR;function SX(t){let e=(0,mX.randomBytes)(32,t),r=gR(e);return(0,uR.wipe)(e),r}Ge.generateKeyPair=SX;function IX(t){if(t.length!==Ge.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ge.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ge.extractPublicKeyFromSecretKey=IX;var oI=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 pR(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*oI[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*oI[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function cI(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;pR(t,e)}function _X(t,e){let r=new Float64Array(64),n=[Ae(),Ae(),Ae(),Ae()],i=(0,yh.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new yh.SHA512;o.update(s.subarray(32)),o.update(e);let u=o.digest();o.clean(),cI(u),fI(n,u),lI(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let a=o.digest();cI(a);for(let c=0;c<32;c++)r[c]=u[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=a[c]*i[f];return pR(s.subarray(32),r),s}Ge.sign=_X;function mR(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),u=Ae(),a=Ae();return Ro(t[2],Hc),EX(t[1],e),za(i,t[1]),Nt(s,i,wX),Qa(i,i,t[2]),ja(s,t[2],s),za(o,s),za(u,o),Nt(a,u,o),Nt(r,a,i),Nt(r,r,s),bX(r,r),Nt(r,r,i),Nt(r,r,s),Nt(r,r,s),Nt(t[0],r,s),za(n,t[0]),Nt(n,n,s),oR(n,i)&&Nt(t[0],t[0],AX),za(n,t[0]),Nt(n,n,s),oR(n,i)?-1:(fR(t[0])===e[31]>>7&&Qa(t[0],aI,t[0]),Nt(t[3],t[0],t[1]),0)}function TX(t,e,r){let n=new Uint8Array(32),i=[Ae(),Ae(),Ae(),Ae()],s=[Ae(),Ae(),Ae(),Ae()];if(r.length!==Ge.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ge.SIGNATURE_LENGTH} bytes`);if(mR(s,t))return!1;let o=new yh.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let u=o.digest();return cI(u),dR(i,s,u),fI(s,r.subarray(32)),uI(i,s),lI(n,i),!lR(r,n)}Ge.verify=TX;function CX(t){let e=[Ae(),Ae(),Ae(),Ae()];if(mR(e,t))throw new Error("Ed25519: invalid public key");let r=Ae(),n=Ae(),i=e[1];ja(r,Hc,i),Qa(n,Hc,i),hR(n,n),Nt(r,r,n);let s=new Uint8Array(32);return wh(s,r),s}Ge.convertPublicKeyToX25519=CX;function NX(t){let e=(0,yh.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,uR.wipe)(e),r}Ge.convertSecretKeyToX25519=NX});var dm,gm,Ka,Gc,pm,vh,mm,ym,wm,jc,vm,Am,wR,vR,Em=de(()=>{h();dm="EdDSA",gm="JWT",Ka=".",Gc="base64url",pm="utf8",vh="utf8",mm=":",ym="did",wm="key",jc="base58btc",vm="z",Am="K36",wR=32,vR=32});function zc(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}var bm=de(()=>{h()});function Sm(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=zc(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var hI=de(()=>{h();bm()});function xX(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(Q);V!==U;){for(var k=_[V],H=0,q=Q-1;(k!==0||H>>0,L[q]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");P=H,V++}for(var v=Q-P;v!==Q&&L[v]===0;)v++;for(var C=a.repeat(N);v>>0,Q=new Uint8Array(U);_[N];){var L=r[_.charCodeAt(N)];if(L===255)return;for(var k=0,H=U-1;(L!==0||k>>0,Q[H]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");V=k,N++}if(_[N]!==" "){for(var q=U-V;q!==U&&Q[q]===0;)q++;for(var v=new Uint8Array(P+(U-q)),C=P;q!==U;)v[C++]=Q[q++];return v}}}function A(_){var N=w(_);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:w,decode:A}}var OX,DX,AR,ER=de(()=>{h();OX=xX,DX=OX,AR=DX});var PEe,bR,qs,SR,IR,Bo=de(()=>{h();PEe=new Uint8Array(0),bR=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},SR=t=>new TextEncoder().encode(t),IR=t=>new TextDecoder().decode(t)});var dI,gI,pI,TR,mI,Qc,Mo,PX,RX,jt,Ii=de(()=>{h();ER();Bo();dI=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},gI=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return TR(this,e)}},pI=class{constructor(e){this.decoders=e}or(e){return TR(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},TR=(t,e)=>new pI({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),mI=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new dI(e,r,n),this.decoder=new gI(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Qc=({name:t,prefix:e,encode:r,decode:n})=>new mI(t,e,r,n),Mo=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=AR(r,e);return Qc({prefix:t,name:e,encode:n,decode:s=>qs(i(s))})},PX=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(u-=8,o[c++]=255&a>>u)}if(u>=r||255&a<<8-u)throw new SyntaxError("Unexpected end of data");return o},RX=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&u>>o];if(o&&(s+=e[i&u<Qc({prefix:e,name:t,encode(i){return RX(i,n,r)},decode(i){return PX(i,n,r,t)}})});var yI={};Ot(yI,{identity:()=>BX});var BX,CR=de(()=>{h();Ii();Bo();BX=Qc({prefix:"\0",name:"identity",encode:t=>IR(t),decode:t=>SR(t)})});var wI={};Ot(wI,{base2:()=>MX});var MX,NR=de(()=>{h();Ii();MX=jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var vI={};Ot(vI,{base8:()=>LX});var LX,xR=de(()=>{h();Ii();LX=jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var AI={};Ot(AI,{base10:()=>FX});var FX,OR=de(()=>{h();Ii();FX=Mo({prefix:"9",name:"base10",alphabet:"0123456789"})});var EI={};Ot(EI,{base16:()=>UX,base16upper:()=>qX});var UX,qX,DR=de(()=>{h();Ii();UX=jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qX=jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var bI={};Ot(bI,{base32:()=>Kc,base32hex:()=>GX,base32hexpad:()=>zX,base32hexpadupper:()=>QX,base32hexupper:()=>jX,base32pad:()=>kX,base32padupper:()=>HX,base32upper:()=>VX,base32z:()=>KX});var Kc,VX,kX,HX,GX,jX,zX,QX,KX,SI=de(()=>{h();Ii();Kc=jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),VX=jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kX=jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),HX=jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),GX=jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jX=jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zX=jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),QX=jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),KX=jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var II={};Ot(II,{base36:()=>WX,base36upper:()=>$X});var WX,$X,PR=de(()=>{h();Ii();WX=Mo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$X=Mo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var _I={};Ot(_I,{base58btc:()=>rs,base58flickr:()=>YX});var rs,YX,TI=de(()=>{h();Ii();rs=Mo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),YX=Mo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var CI={};Ot(CI,{base64:()=>JX,base64pad:()=>XX,base64url:()=>ZX,base64urlpad:()=>eZ});var JX,XX,ZX,eZ,RR=de(()=>{h();Ii();JX=jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),XX=jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ZX=jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),eZ=jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var NI={};Ot(NI,{base256emoji:()=>sZ});function nZ(t){return t.reduce((e,r)=>(e+=tZ[r],e),"")}function iZ(t){let e=[];for(let r of t){let n=rZ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var BR,tZ,rZ,sZ,MR=de(()=>{h();Ii();BR=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}"),tZ=BR.reduce((t,e,r)=>(t[r]=e,t),[]),rZ=BR.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);sZ=Qc({prefix:"\u{1F680}",name:"base256emoji",encode:nZ,decode:iZ})});function UR(t,e,r){e=e||[],r=r||0;for(var n=r;t>=cZ;)e[r++]=t&255|LR,t/=128;for(;t&uZ;)e[r++]=t&255|LR,t>>>=7;return e[r]=t|0,UR.bytes=r-n+1,e}function xI(t,n){var r=0,n=n||0,i=0,s=n,o,u=t.length;do{if(s>=u)throw xI.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&FR)<=fZ);return xI.bytes=s-n,r}var oZ,LR,aZ,uZ,cZ,lZ,fZ,FR,hZ,dZ,gZ,pZ,mZ,yZ,wZ,vZ,AZ,EZ,bZ,SZ,Ah,qR=de(()=>{h();oZ=UR,LR=128,aZ=127,uZ=~aZ,cZ=Math.pow(2,31);lZ=xI,fZ=128,FR=127;hZ=Math.pow(2,7),dZ=Math.pow(2,14),gZ=Math.pow(2,21),pZ=Math.pow(2,28),mZ=Math.pow(2,35),yZ=Math.pow(2,42),wZ=Math.pow(2,49),vZ=Math.pow(2,56),AZ=Math.pow(2,63),EZ=function(t){return t{h();qR();Eh=(t,e=0)=>[Ah.decode(t,e),Ah.decode.bytes],Wc=(t,e,r=0)=>(Ah.encode(t,e,r),e),$c=t=>Ah.encodingLength(t)});var Wa,VR,kR,Yc,Sh=de(()=>{h();Bo();_m();Wa=(t,e)=>{let r=e.byteLength,n=$c(t),i=n+$c(r),s=new Uint8Array(i+r);return Wc(t,s,0),Wc(r,s,n),s.set(e,i),new Yc(t,r,e,s)},VR=t=>{let e=qs(t),[r,n]=Eh(e),[i,s]=Eh(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Yc(r,i,o,e)},kR=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&bR(t.bytes,e.bytes),Yc=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var DI,OI,PI=de(()=>{h();Sh();DI=({name:t,code:e,encode:r})=>new OI(t,e,r),OI=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Wa(this.code,r):r.then(n=>Wa(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var RI={};Ot(RI,{sha256:()=>IZ,sha512:()=>_Z});var GR,IZ,_Z,jR=de(()=>{h();PI();GR=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),IZ=DI({name:"sha2-256",code:18,encode:GR("SHA-256")}),_Z=DI({name:"sha2-512",code:19,encode:GR("SHA-512")})});var BI={};Ot(BI,{identity:()=>NZ});var zR,TZ,QR,CZ,NZ,KR=de(()=>{h();Bo();Sh();zR=0,TZ="identity",QR=qs,CZ=t=>Wa(zR,QR(t)),NZ={code:zR,name:TZ,encode:QR,digest:CZ}});var WR=de(()=>{h();Bo()});var wbe,vbe,$R=de(()=>{h();wbe=new TextEncoder,vbe=new TextDecoder});var Nm,DZ,PZ,RZ,Ih,BZ,YR,JR,Tm,Cm,MZ,LZ,FZ,XR=de(()=>{h();_m();Sh();TI();SI();Bo();Nm=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Cm,byteLength:Cm,code:Tm,version:Tm,multihash:Tm,bytes:Tm,_baseCache:Cm,asCID:Cm})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Ih)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==BZ)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Wa(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&kR(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return PZ(r,i,e||rs.encoder);default:return RZ(r,i,e||Kc.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 LZ(/^0\.0/,FZ),!!(e&&(e[JR]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||YR(r,n,i.bytes))}else if(e!=null&&e[JR]===!0){let{version:r,multihash:n,code:i}=e,s=VR(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==Ih)throw new Error(`Version 0 CID must use dag-pb (code: ${Ih}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=YR(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Ih,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=qs(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Yc(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,w]=Eh(e.subarray(r));return r+=w,d},i=n(),s=Ih;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,u=n(),a=n(),c=r+a,f=c-o;return{version:i,codec:s,multihashCode:u,digestSize:a,multihashSize:f,size:c}}static parse(e,r){let[n,i]=DZ(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},DZ=(t,e)=>{switch(t[0]){case"Q":{let r=e||rs;return[rs.prefix,r.decode(`${rs.prefix}${t}`)]}case rs.prefix:{let r=e||rs;return[rs.prefix,r.decode(t)]}case Kc.prefix:{let r=e||Kc;return[Kc.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},PZ=(t,e,r)=>{let{prefix:n}=r;if(n!==rs.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},RZ=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},Ih=112,BZ=18,YR=(t,e,r)=>{let n=$c(t),i=n+$c(e),s=new Uint8Array(i+r.byteLength);return Wc(t,s,0),Wc(e,s,n),s.set(r,i),s},JR=Symbol.for("@ipld/js-cid/CID"),Tm={writable:!1,configurable:!1,enumerable:!0},Cm={writable:!1,enumerable:!1,configurable:!1},MZ="0.0.0-dev",LZ=(t,e)=>{if(t.test(MZ))console.warn(e);else throw new Error(e)},FZ=`CID.isCID(v) is deprecated and will be removed in the next major release. +Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.bigIntToHex(e.numDecimals),ce.utf8ToHex("canFreeze"),e.canFreeze?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canWipe"),e.canWipe?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canPause"),e.canPause?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canTransferNFTCreateRole"),e.canTransferNFTCreateRole?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canChangeOwner"),e.canChangeOwner?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canUpgrade"),e.canUpgrade?this.trueAsHex:this.falseAsHex,ce.utf8ToHex("canAddSpecialRoles"),e.canAddSpecialRoles?this.trueAsHex:this.falseAsHex];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ce.utf8ToHex(e.tokenName),ce.utf8ToHex(e.tokenTicker),ce.utf8ToHex(e.tokenType),ce.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user),...e.addRoleLocalMint?[ce.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ce.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user),...e.addRoleNFTCreate?[ce.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ce.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ce.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ce.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user),...e.addRoleNFTCreate?[ce.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ce.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ce.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ce.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ce.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.initialQuantity),ce.utf8ToHex(e.name),ce.bigIntToHex(e.royalties),ce.utf8ToHex(e.hash),ce.bufferToHex(e.attributes),...e.uris.map(ce.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ce.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ce.utf8ToHex(e.tokenIdentifier),ce.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.tokenNonce),ce.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.tokenNonce),ce.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ce.utf8ToHex(e.tokenIdentifier),ce.bigIntToHex(e.tokenNonce),ce.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:c,dataParts:a}){let u=this.buildTransactionPayload(a),f=o||this.computeGasLimit(u,c),p=new _M.TransactionVersion(S_.TRANSACTION_VERSION_DEFAULT),S=new _M.TransactionOptions(S_.TRANSACTION_OPTIONS_DEFAULT);return new cre.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:u,version:p,options:S})}buildTransactionPayload(e){let r=e.join(S_.ARGUMENTS_SEPARATOR);return new ure.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};F1.TokenOperationsFactory=__});var IM=L(q1=>{"use strict";h();Object.defineProperty(q1,"__esModule",{value:!0});q1.TokenOperationsFactoryConfig=void 0;var lre=Nt(),T_=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=lre.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};q1.TokenOperationsFactoryConfig=T_});var xM=L(U1=>{"use strict";h();Object.defineProperty(U1,"__esModule",{value:!0});U1.TokenOperationsOutcomeParser=void 0;var fre=Nt(),I_=Ve(),CM=Yp(),C_=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=r.topics[3]?.valueOf();return{tokenIdentifier:n,nonce:i,attributes:s}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){for(let r of e.logs.events)if(r.identifier=="signalError"){let n=b.Buffer.from(r.data.substring(1),"hex").toString(),i=r.topics[1]?.valueOf().toString();throw new I_.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${i} (${n})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new I_.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new I_.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){return e.topics[0]?.valueOf().toString()}extractNonce(e){return CM.bufferToBigInt(e.topics[1]?.valueOf()).toFixed(0)}extractAmount(e){return CM.bufferToBigInt(e.topics[2]?.valueOf()).toFixed(0)}extractAddress(e){return fre.Address.fromBuffer(e.topics[3]?.valueOf()).toString()}};U1.TokenOperationsOutcomeParser=C_});var N_=L(Oo=>{"use strict";h();var dre=Oo&&Oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x_=Oo&&Oo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dre(e,t,r)};Object.defineProperty(Oo,"__esModule",{value:!0});x_(TM(),Oo);x_(IM(),Oo);x_(xM(),Oo)});var NM=L(k1=>{"use strict";h();Object.defineProperty(k1,"__esModule",{value:!0});k1.DelegationTransactionsOutcomeParser=void 0;var hre=Nt(),pre=Vh(),gre=Ve(),mre=Ll(),O_=class{constructor(){}parseCreateNewDelegationContract(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),mre.findEventsByIdentifier(e,"SCDeploy").map(n=>({contractAddress:this.extractContractAddress(n)}))}ensureTransactionOutcome(e){return"hash"in e?new pre.TransactionsConverter().transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=b.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new gre.ErrParseTransactionOutcome(`encountered signalError: ${i} (${b.Buffer.from(n,"hex").toString()})`)}}extractContractAddress(e){if(!e.topics[0]?.length)return"";let r=b.Buffer.from(e.topics[0]);return hre.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return b.Buffer.from(e).toString()}};k1.DelegationTransactionsOutcomeParser=O_});var RM=L(V1=>{"use strict";h();Object.defineProperty(V1,"__esModule",{value:!0});V1.SmartContractTransactionsOutcomeParser=void 0;var OM=Nt(),yre=xr(),PM=Ve(),kl=yi(),Qh=Ll(),Vl;(function(t){t.SCDeploy="SCDeploy",t.SignalError="signalError",t.WriteLog="writeLog"})(Vl||(Vl={}));var P_=class{constructor(e){this.abi=e?.abi,this.legacyResultsParser=e?.legacyResultsParser||new kl.ResultsParser}parseDeploy(e){return"transactionOutcome"in e?this.parseDeployGivenTransactionOutcome(e.transactionOutcome):this.parseDeployGivenTransactionOnNetwork(e.transactionOnNetwork)}parseDeployGivenTransactionOutcome(e){let r=e.directSmartContractCallOutcome,i=Qh.findEventsByIdentifier(e,Vl.SCDeploy).map(s=>this.parseScDeployEvent(s));return{returnCode:r.returnCode,returnMessage:r.returnMessage,contracts:i}}parseDeployGivenTransactionOnNetwork(e){let r=this.findDirectSmartContractCallOutcome(e),i=e.logs.events.concat(e.contractResults.items.flatMap(s=>s.logs.events)).filter(s=>s.identifier===Vl.SCDeploy).map(s=>this.parseScDeployEvent({topics:s.topics.map(o=>b.Buffer.from(o.hex(),"hex"))}));return{returnCode:r.returnCode,returnMessage:r.returnMessage,contracts:i}}parseScDeployEvent(e){let r=e.topics[0],n=e.topics[1],i=e.topics[2],s=r?.length?new OM.Address(r).toBech32():"",o=n?.length?new OM.Address(n).toBech32():"";return{address:s,ownerAddress:o,codeHash:i}}parseExecute(e){return"transactionOutcome"in e?this.parseExecuteGivenTransactionOutcome(e.transactionOutcome,e.function):this.parseExecuteGivenTransactionOnNetwork(e.transactionOnNetwork,e.function)}parseExecuteGivenTransactionOutcome(e,r){let n=e.directSmartContractCallOutcome;if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(r=r||n.function,!r)throw new PM.Err('Function name is not available in the transaction outcome, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');let i=this.abi.getEndpoint(r),s={returnCode:new kl.ReturnCode(n.returnCode),returnMessage:n.returnMessage,values:n.returnDataParts.map(c=>b.Buffer.from(c))},o=this.legacyResultsParser.parseOutcomeFromUntypedBundle(s,i);return{values:o.values.map(c=>c.valueOf()),returnCode:o.returnCode.toString(),returnMessage:o.returnMessage}}parseExecuteGivenTransactionOnNetwork(e,r){let n=this.findDirectSmartContractCallOutcome(e);if(!this.abi)return{values:n.returnDataParts,returnCode:n.returnCode,returnMessage:n.returnMessage};if(r=r||n.function,!r)throw new PM.Err('Function name is not available in the transaction, thus endpoint definition (ABI) cannot be picked (for parsing). Maybe provide the "function" parameter explicitly?');let i=new kl.ArgSerializer,s=this.abi.getEndpoint(r),o=n.returnDataParts.map(a=>b.Buffer.from(a)),c=i.buffersToValues(o,s.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:c}}findDirectSmartContractCallOutcome(e){let r=this.findDirectSmartContractCallOutcomeWithinSmartContractResults(e);return r||(r=this.findDirectSmartContractCallOutcomeIfError(e),r)||(r=this.findDirectSmartContractCallOutcomeWithinWriteLogEvents(e),r)?r:new Qh.SmartContractCallOutcome({function:e.function,returnCode:"",returnMessage:"",returnDataParts:[]})}findDirectSmartContractCallOutcomeWithinSmartContractResults(e){let r=new kl.ArgSerializer,n=[];for(let a of e.contractResults.items){let u=a.data.startsWith(yre.ARGUMENTS_SEPARATOR),f=a.receiver.bech32()===e.sender.bech32(),p=a.previousHash===e.hash;u&&f&&p&&n.push(a)}if(n.length===0)return null;if(n.length>1)throw new Error(`More than one smart contract result (holding the return data) found for transaction: ${e.hash}`);let[i]=n,[s,o,...c]=r.stringToBuffers(i.data);return new Qh.SmartContractCallOutcome({function:e.function,returnCode:o?.toString(),returnMessage:i.returnMessage||o?.toString(),returnDataParts:c})}findDirectSmartContractCallOutcomeIfError(e){let r=new kl.ArgSerializer,n=Vl.SignalError,i=[];i.push(...e.logs.events.filter(f=>f.identifier===n));for(let f of e.contractResults.items)f.previousHash==e.hash&&i.push(...f.logs.events.filter(p=>p.identifier===n));if(i.length===0)return null;if(i.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);let[s]=i,o=s.dataPayload?.valueOf().toString()||"",c=s.getLastTopic()?.toString(),a=r.stringToBuffers(o),u=a[a.length-1];return new Qh.SmartContractCallOutcome({function:e.function,returnCode:u?.toString()||n,returnMessage:c||u?.toString()||n,returnDataParts:[]})}findDirectSmartContractCallOutcomeWithinWriteLogEvents(e){let r=new kl.ArgSerializer,n=Vl.WriteLog,i=[];i.push(...e.logs.events.filter(f=>f.identifier===n));for(let f of e.contractResults.items)f.previousHash==e.hash&&i.push(...f.logs.events.filter(p=>p.identifier===n));if(i.length===0)return null;if(i.length>1)throw new Error(`More than one "${n}" event found for transaction: ${e.hash}`);let[s]=i,o=s.dataPayload?.valueOf().toString()||"",[c,a,...u]=r.stringToBuffers(o);return new Qh.SmartContractCallOutcome({function:e.function,returnCode:a?.toString(),returnMessage:a?.toString(),returnDataParts:u})}};V1.SmartContractTransactionsOutcomeParser=P_});var BM=L(H1=>{"use strict";h();Object.defineProperty(H1,"__esModule",{value:!0});H1.TokenManagementTransactionsOutcomeParser=void 0;var vre=Nt(),bre=Vh(),MM=Ve(),DM=na(),kr=Ll(),R_=class{constructor(){}parseIssueFungible(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"issue").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueNonFungible(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"issueNonFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseIssueSemiFungible(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"issueSemiFungible").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterMetaEsdt(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"registerMetaESDT").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseRegisterAndSetAllRoles(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events);let r=kr.findEventsByIdentifier(e,"registerAndSetAllRoles"),n=kr.findEventsByIdentifier(e,"ESDTSetRole");if(r.length!==n.length)throw new MM.ErrParseTransactionOutcome("Register Events and Set Role events mismatch. Should have the same number of events.");return r.map((i,s)=>{let o=this.extractTokenIdentifier(i),a=n[s].topics.slice(3).map(u=>this.decodeTopicAsString(u));return{tokenIdentifier:o,roles:a}})}parseSetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseUnsetBurnRoleGlobally(e){e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events)}parseSetSpecialRole(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTSetRole").map(n=>this.getOutputForSetSpecialRoleEvent(n))}getOutputForSetSpecialRoleEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),s=e.topics.slice(3).map(o=>this.decodeTopicAsString(o));return{userAddress:r,tokenIdentifier:n,roles:s}}parseNftCreate(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTCreate").map(n=>this.getOutputForNftCreateEvent(n))}getOutputForNftCreateEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,initialQuantity:i}}parseLocalMint(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTLocalMint").map(n=>this.getOutputForLocalMintEvent(n))}getOutputForLocalMintEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,mintedSupply:s}}parseLocalBurn(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTLocalBurn").map(n=>this.getOutputForLocalBurnEvent(n))}getOutputForLocalBurnEvent(e){let r=e.address,n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,burntSupply:s}}parsePause(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseUnpause(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTUnPause").map(n=>({tokenIdentifier:this.extractTokenIdentifier(n)}))}parseFreeze(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTFreeze").map(n=>this.getOutputForFreezeEvent(n))}getOutputForFreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTUnFreeze").map(n=>this.getOutputForUnfreezeEvent(n))}getOutputForUnfreezeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTWipe").map(n=>this.getOutputForWipeEvent(n))}getOutputForWipeEvent(e){let r=this.extractAddress(e),n=this.extractTokenIdentifier(e),i=this.extractNonce(e),s=this.extractAmount(e);return{userAddress:r,tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTUpdateAttributes").map(n=>this.getOutputForUpdateAttributesEvent(n))}getOutputForUpdateAttributesEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=e.topics[3]?e.topics[3]:new Uint8Array;return{tokenIdentifier:r,nonce:n,attributes:i}}parseAddQuantity(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTAddQuantity").map(n=>this.getOutputForAddQuantityEvent(n))}getOutputForAddQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,addedQuantity:i}}parseBurnQuantity(e){return e=this.ensureTransactionOutcome(e),this.ensureNoError(e.logs.events),kr.findEventsByIdentifier(e,"ESDTNFTBurn").map(n=>this.getOutputForBurnQuantityEvent(n))}getOutputForBurnQuantityEvent(e){let r=this.extractTokenIdentifier(e),n=this.extractNonce(e),i=this.extractAmount(e);return{tokenIdentifier:r,nonce:n,burntQuantity:i}}ensureTransactionOutcome(e){return"hash"in e?new bre.TransactionsConverter().transactionOnNetworkToOutcome(e):e}ensureNoError(e){for(let r of e)if(r.identifier=="signalError"){let n=b.Buffer.from(r.dataItems[0]?.toString().slice(1)).toString()||"",i=this.decodeTopicAsString(r.topics[1]);throw new MM.ErrParseTransactionOutcome(`encountered signalError: ${i} (${b.Buffer.from(n,"hex").toString()})`)}}extractTokenIdentifier(e){return e.topics[0]?.length?this.decodeTopicAsString(e.topics[0]):""}extractNonce(e){if(!e.topics[1]?.length)return BigInt(0);let r=b.Buffer.from(e.topics[1]);return BigInt(DM.bufferToBigInt(r).toFixed(0))}extractAmount(e){if(!e.topics[2]?.length)return BigInt(0);let r=b.Buffer.from(e.topics[2]);return BigInt(DM.bufferToBigInt(r).toFixed(0))}extractAddress(e){if(!e.topics[3]?.length)return"";let r=b.Buffer.from(e.topics[3]);return vre.Address.fromBuffer(r).bech32()}decodeTopicAsString(e){return b.Buffer.from(e).toString()}};H1.TokenManagementTransactionsOutcomeParser=R_});var LM=L(G1=>{"use strict";h();Object.defineProperty(G1,"__esModule",{value:!0});G1.TransactionEventsParser=void 0;var wre=yi(),M_=class{constructor(e){this.legacyResultsParser=new wre.ResultsParser,this.abi=e.abi,this.firstTopicIsIdentifier=e.firstTopicIsIdentifier??!0}parseEvents(e){let r=[];for(let n of e.events){let i=this.parseEvent({event:n});r.push(i)}return r}parseEvent(e){let r=e.event.topics.map(c=>b.Buffer.from(c)),n=this.firstTopicIsIdentifier?r[0]?.toString():e.event.identifier;this.firstTopicIsIdentifier&&r.shift();let i=e.event.dataItems.map(c=>b.Buffer.from(c)),s=this.abi.getEvent(n);return this.legacyResultsParser.doParseEvent({topics:r,dataItems:i,eventDefinition:s})}};G1.TransactionEventsParser=M_});var D_=L(es=>{"use strict";h();var Are=es&&es.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kh=es&&es.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Are(e,t,r)};Object.defineProperty(es,"__esModule",{value:!0});Kh(NM(),es);Kh(Ll(),es);Kh(RM(),es);Kh(BM(),es);Kh(LM(),es)});var Hl=L(z1=>{"use strict";h();Object.defineProperty(z1,"__esModule",{value:!0});z1.Account=void 0;var Ere=Nt(),B_=class{constructor(e){this.address=Ere.Address.empty(),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()}}};z1.Account=B_});var Q1=L(Gl=>{"use strict";h();Object.defineProperty(Gl,"__esModule",{value:!0});Gl.MessageComputer=Gl.Message=void 0;var Wh=xr(),Sre=Nt(),_re=Yd(),j1=class{constructor(e){this.data=e.data,this.signature=e.signature,this.address=e.address,this.version=e.version||Wh.DEFAULT_MESSAGE_VERSION,this.signer=e.signer||Wh.SDK_JS_SIGNER}};Gl.Message=j1;var L_=class{constructor(){}computeBytesForSigning(e){let r=b.Buffer.from(e.data.length.toString()),n=b.Buffer.concat([r,e.data]),i=b.Buffer.concat([b.Buffer.from(Wh.MESSAGE_PREFIX),n]);return _re("keccak256").update(i).digest()}computeBytesForVerifying(e){return this.computeBytesForSigning(e)}packMessage(e){return{message:b.Buffer.from(e.data).toString("hex"),signature:e.signature?b.Buffer.from(e.signature).toString("hex"):"",address:e.address?e.address.bech32():"",version:e.version,signer:e.signer}}unpackMessage(e){let r=this.trimHexPrefix(e.message),n=b.Buffer.from(r,"hex"),i=this.trimHexPrefix(e.signature||""),s=b.Buffer.from(i,"hex"),o;e.address&&(o=Sre.Address.fromBech32(e.address));let c=e.version||Wh.DEFAULT_MESSAGE_VERSION,a=e.signer||Wh.UNKNOWN_SIGNER;return new j1({data:n,signature:s,address:o,version:c,signer:a})}trimHexPrefix(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}};Gl.MessageComputer=L_});var U_=L(Fs=>{"use strict";h();var Tre=Fs&&Fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ire=Fs&&Fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cre=Fs&&Fs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tre(e,t,r);return Ire(e,t),e};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.AsyncTimer=void 0;var xre=Cre(Ve()),Nre=Ve(),F_=ra(),q_=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new xre.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,F_.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){F_.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new Nre.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(F_.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};Fs.AsyncTimer=q_});var W1=L(K1=>{"use strict";h();Object.defineProperty(K1,"__esModule",{value:!0});K1.TransactionWatcher=void 0;var k_=U_(),FM=xr(),Po=Ve(),qM=ra(),Ta=class t{constructor(e,r={}){this.fetcher=new V_(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}async awaitPending(e){let r=s=>s.status.isPending(),n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Po.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitCompleted(e){let r=s=>{if(s.isCompleted===void 0)throw new Po.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Po.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}async awaitAllEvents(e,r){let n=o=>{let c=this.getAllTransactionEvents(o).map(u=>u.identifier);return r.every(u=>c.includes(u))},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Po.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitAnyEvent(e,r){let n=o=>{let c=this.getAllTransactionEvents(o).map(u=>u.identifier);return r.find(u=>c.includes(u))!=null},i=async()=>{let o=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(o)},s=()=>new Po.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)}async awaitOnCondition(e,r){let n=async()=>{let s=this.transactionOrTxHashToTxHash(e);return await this.fetcher.getTransaction(s)},i=()=>new Po.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)}transactionOrTxHashToTxHash(e){let r=typeof e=="string"?e:e.getHash().hex();if(r.length!==FM.HEX_TRANSACTION_HASH_LENGTH)throw new Po.Err(`Invalid transaction hash length. The length of a hex encoded hash should be ${FM.HEX_TRANSACTION_HASH_LENGTH}.`);return r}async awaitConditionally(e,r,n){let i=new k_.AsyncTimer("watcher:periodic"),s=new k_.AsyncTimer("watcher:patience"),o=new k_.AsyncTimer("watcher:timeout"),c=!1,a,u=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),c=!0});!c;){await i.start(this.pollingIntervalMilliseconds);try{if(a=await r(),u=e(a),u||c)break}catch(f){if(qM.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Po.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Po.Err))throw f}}if(u&&await s.start(this.patienceMilliseconds),o.isStopped()||o.stop(),!a||!u)throw n();return a}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};K1.TransactionWatcher=Ta;Ta.DefaultPollingInterval=6e3;Ta.DefaultTimeout=Ta.DefaultPollingInterval*15;Ta.DefaultPatience=0;Ta.NoopOnStatusReceived=t=>{};var V_=class{constructor(e){this.fetcher=e}async getTransaction(e){return qM.Logger.debug(`transactionWatcher, getTransaction(${e})`),await this.fetcher.getTransaction(e)}}});var Ti=L(Vr=>{"use strict";h();var Ore=Vr&&Vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pre=Vr&&Vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rre=Vr&&Vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ore(e,t,r);return Pre(e,t),e};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.zeroPadStringIfOddLength=Vr.isPaddedHex=Vr.numberToPaddedHex=Vr.Nonce=Vr.Address=void 0;var UM=Rre(g2()),Mre="erd",H_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=UM.toWords(e),n=UM.encode(Mre,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vr.Address=H_;var G_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return kM(this.value)}};Vr.Nonce=G_;function kM(t){let e=t.toString(16);return VM(e)}Vr.numberToPaddedHex=kM;function Dre(t){t=t||"";let e=b.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vr.isPaddedHex=Dre;function VM(t){return t=t||"",t.length%2==1?"0"+t:t}Vr.zeroPadStringIfOddLength=VM});var $h=L(Ii=>{"use strict";h();var Bre=Ii&&Ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.UnknownClientName=Ii.BaseUserAgent=Ii.EsdtContractAddress=Ii.MaxUint64AsBigNumber=void 0;var Lre=Bre((qt(),qe(jt))),Fre=Ti();Ii.MaxUint64AsBigNumber=new Lre.default("18446744073709551615");Ii.EsdtContractAddress=new Fre.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u");Ii.BaseUserAgent="multiversx-sdk";Ii.UnknownClientName="unknown"});var jl=L(zl=>{"use strict";h();var qre=zl&&zl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zl,"__esModule",{value:!0});zl.ContractQueryResponse=void 0;var Ure=qre((qt(),qe(jt))),kre=$h(),z_=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new Ure.default(e.gasRemaining||e.GasRemaining||0),o=kre.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>b.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};zl.ContractQueryResponse=z_});var HM=L(()=>{"use strict";h();global.Buffer||(global.Buffer=wo().Buffer)});var K_=L(Ql=>{"use strict";h();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.SmartContractQueryResponse=Ql.SmartContractQuery=void 0;var j_=class{constructor(e){this.contract=e.contract,this.caller=e.caller,this.value=e.value,this.function=e.function,this.arguments=e.arguments}};Ql.SmartContractQuery=j_;var Q_=class{constructor(e){this.function=e.function,this.returnCode=e.returnCode,this.returnMessage=e.returnMessage,this.returnDataParts=e.returnDataParts}};Ql.SmartContractQueryResponse=Q_});var zM=L($1=>{"use strict";h();Object.defineProperty($1,"__esModule",{value:!0});$1.QueryRunnerAdapter=void 0;var GM=Nt(),Vre=K_(),W_=class{constructor(e){this.networkProvider=e.networkProvider}async runQuery(e){let r={address:GM.Address.fromBech32(e.contract),caller:e.caller?GM.Address.fromBech32(e.caller):void 0,func:e.function,value:e.value,getEncodedArguments:()=>e.arguments.map(i=>b.Buffer.from(i).toString("hex"))},n=await this.networkProvider.queryContract(r);return new Vre.SmartContractQueryResponse({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.getReturnDataParts()})}};$1.QueryRunnerAdapter=W_});var jM=L(zc=>{"use strict";h();var Hre=zc&&zc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gre=zc&&zc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hre(e,t,r)};Object.defineProperty(zc,"__esModule",{value:!0});Gre(zM(),zc)});var QM=L(jc=>{"use strict";h();var zre=jc&&jc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jre=jc&&jc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zre(e,t,r)};Object.defineProperty(jc,"__esModule",{value:!0});jre(Vh(),jc)});var WM=L(Qc=>{"use strict";h();Object.defineProperty(Qc,"__esModule",{value:!0});Qc.GasEstimator=Qc.DefaultGasConfiguration=void 0;Qc.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Qre=1e5,KM=8e5,$_=class{constructor(e){this.gasConfiguration=e||Qc.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Qre}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+KM}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+KM)*r+this.gasConfiguration.gasPerDataByte*e}};Qc.GasEstimator=$_});var YM=L($M=>{"use strict";h();Object.defineProperty($M,"__esModule",{value:!0})});var XM=L(JM=>{"use strict";h();Object.defineProperty(JM,"__esModule",{value:!0})});var ZM=L(Y1=>{"use strict";h();Object.defineProperty(Y1,"__esModule",{value:!0});Y1.RelayedTransactionV1Builder=void 0;var Y_=Nt(),Kre=Ve(),Wre=Dn(),$re=No(),Yre=s1(),J_=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new Kre.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${b.Buffer.from(e).toString("hex")}`,n=new $re.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new Wre.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new Y_.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Y_.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:BigInt(this.innerTransaction.getValue().toString()),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:b.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new Y_.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?b.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?b.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return Yre.stringify(e)}};Y1.RelayedTransactionV1Builder=J_});var t7=L(J1=>{"use strict";h();Object.defineProperty(J1,"__esModule",{value:!0});J1.RelayedTransactionV2Builder=void 0;var e7=Ve(),Yh=yi(),Jre=Dn(),Xre=No(),X_=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new e7.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new e7.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Yh.ArgSerializer().valuesToString([new Yh.AddressValue(this.innerTransaction.getReceiver()),new Yh.U64Value(this.innerTransaction.getNonce().valueOf()),new Yh.BytesValue(this.innerTransaction.getData().valueOf()),new Yh.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new Xre.TransactionPayload(r),i=new Jre.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID,version:this.innerTransaction.getVersion(),options:this.innerTransaction.getOptions()});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};J1.RelayedTransactionV2Builder=X_});var r7=L(X1=>{"use strict";h();Object.defineProperty(X1,"__esModule",{value:!0});X1.SignableMessage=void 0;var Zre=Nt(),ene=N1(),tne=xr(),rne=Yd(),Z_=class{constructor(e){this.message=b.Buffer.from([]),this.signature=b.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=Zre.Address.empty(),Object.assign(this,e)}serializeForSigning(){let e=b.Buffer.from(this.message.length.toString()),r=b.Buffer.concat([e,this.message]),n=b.Buffer.concat([b.Buffer.from(tne.MESSAGE_PREFIX),r]);return rne("keccak256").update(n).digest()}serializeForSigningRaw(){return b.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=ene.interpretSignatureAsBuffer(e)}getMessageSize(){let e=b.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};X1.SignableMessage=Z_});var i7=L(ey=>{"use strict";h();Object.defineProperty(ey,"__esModule",{value:!0});ey.SmartContractQueriesController=void 0;var n7=Ve(),nne=K_(),Z1=yi(),ine=dr(),e3=class{constructor(e){this.abi=e.abi,this.queryRunner=e.queryRunner,this.legacyResultsParser=new Z1.ResultsParser}async query(e){let r=this.createQuery(e),n=await this.runQuery(r);return this.raiseForStatus(n),this.parseQueryResponse(n)}raiseForStatus(e){if(!(e.returnCode==="ok"))throw new n7.ErrSmartContractQuery(e.returnCode,e.returnMessage)}createQuery(e){let r=this.encodeArguments(e.function,e.arguments);return new nne.SmartContractQuery({contract:e.contract,caller:e.caller,function:e.function,arguments:r,value:e.value})}encodeArguments(e,r){let n=this.abi?.getEndpoint(e);if(n){let i=Z1.NativeSerializer.nativeToTypedValues(r,n);return new Z1.ArgSerializer().valuesToBuffers(i)}if(this.areArgsOfTypedValue(r))return new Z1.ArgSerializer().valuesToBuffers(r);if(this.areArgsBuffers(r))return r.map(i=>b.Buffer.from(i));throw new n7.Err("cannot encode arguments: when ABI is not available, they must be either typed values or buffers")}areArgsOfTypedValue(e){return e.every(r=>ine.isTyped(r))}areArgsBuffers(e){for(let r of e)if(!ArrayBuffer.isView(r))return!1;return!0}async runQuery(e){return await this.queryRunner.runQuery(e)}parseQueryResponse(e){if(!this.abi)return e.returnDataParts;let r={returnCode:e.returnCode,returnMessage:e.returnMessage,getReturnDataParts:()=>e.returnDataParts.map(c=>b.Buffer.from(c))},n=e.function,i=this.abi.getEndpoint(n);return this.legacyResultsParser.parseQueryResponse(r,i).values.map(c=>c.valueOf())}};ey.SmartContractQueriesController=e3});var e0=L((S8e,G7)=>{"use strict";h();function b7(t,e){return function(){return t.apply(e,arguments)}}var{toString:sne}=Object.prototype,{getPrototypeOf:p3}=Object,oy=(t=>e=>{let r=sne.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),rs=t=>(t=t.toLowerCase(),e=>oy(e)===t),ay=t=>e=>typeof e===t,{isArray:$l}=Array,Xh=ay("undefined");function one(t){return t!==null&&!Xh(t)&&t.constructor!==null&&!Xh(t.constructor)&&Yn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var w7=rs("ArrayBuffer");function ane(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&w7(t.buffer),e}var cne=ay("string"),Yn=ay("function"),A7=ay("number"),cy=t=>t!==null&&typeof t=="object",une=t=>t===!0||t===!1,ty=t=>{if(oy(t)!=="object")return!1;let e=p3(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},lne=rs("Date"),fne=rs("File"),dne=rs("Blob"),hne=rs("FileList"),pne=t=>cy(t)&&Yn(t.pipe),gne=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Yn(t.append)&&((e=oy(t))==="formdata"||e==="object"&&Yn(t.toString)&&t.toString()==="[object FormData]"))},mne=rs("URLSearchParams"),[yne,vne,bne,wne]=["ReadableStream","Request","Response","Headers"].map(rs),Ane=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Zh(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),$l(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var Kc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,S7=t=>!Xh(t)&&t!==Kc;function s3(){let{caseless:t}=S7(this)&&this||{},e={},r=(n,i)=>{let s=t&&E7(e,i)||i;ty(e[s])&&ty(n)?e[s]=s3(e[s],n):ty(n)?e[s]=s3({},n):$l(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(Zh(e,(i,s)=>{r&&Yn(i)?t[s]=b7(i,r):t[s]=i},{allOwnKeys:n}),t),Sne=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),_ne=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Tne=(t,e,r,n)=>{let i,s,o,c={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!c[o]&&(e[o]=t[o],c[o]=!0);t=r!==!1&&p3(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Ine=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},Cne=t=>{if(!t)return null;if($l(t))return t;let e=t.length;if(!A7(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},xne=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&p3(Uint8Array)),Nne=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},One=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Pne=rs("HTMLFormElement"),Rne=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),s7=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Mne=rs("RegExp"),_7=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};Zh(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},Dne=t=>{_7(t,(e,r)=>{if(Yn(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(Yn(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Bne=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return $l(t)?n(t):n(String(t).split(e)),r},Lne=()=>{},Fne=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,t3="abcdefghijklmnopqrstuvwxyz",o7="0123456789",T7={DIGIT:o7,ALPHA:t3,ALPHA_DIGIT:t3+t3.toUpperCase()+o7},qne=(t=16,e=T7.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function Une(t){return!!(t&&Yn(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var kne=t=>{let e=new Array(10),r=(n,i)=>{if(cy(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=$l(n)?[]:{};return Zh(n,(o,c)=>{let a=r(o,i+1);!Xh(a)&&(s[c]=a)}),e[i]=void 0,s}}return n};return r(t,0)},Vne=rs("AsyncFunction"),Hne=t=>t&&(cy(t)||Yn(t))&&Yn(t.then)&&Yn(t.catch),I7=((t,e)=>t?setImmediate:e?((r,n)=>(Kc.addEventListener("message",({source:i,data:s})=>{i===Kc&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Kc.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Yn(Kc.postMessage)),Gne=typeof queueMicrotask<"u"?queueMicrotask.bind(Kc):typeof O.default<"u"&&O.default.nextTick||I7,te={isArray:$l,isArrayBuffer:w7,isBuffer:one,isFormData:gne,isArrayBufferView:ane,isString:cne,isNumber:A7,isBoolean:une,isObject:cy,isPlainObject:ty,isReadableStream:yne,isRequest:vne,isResponse:bne,isHeaders:wne,isUndefined:Xh,isDate:lne,isFile:fne,isBlob:dne,isRegExp:Mne,isFunction:Yn,isStream:pne,isURLSearchParams:mne,isTypedArray:xne,isFileList:hne,forEach:Zh,merge:s3,extend:Ene,trim:Ane,stripBOM:Sne,inherits:_ne,toFlatObject:Tne,kindOf:oy,kindOfTest:rs,endsWith:Ine,toArray:Cne,forEachEntry:Nne,matchAll:One,isHTMLForm:Pne,hasOwnProperty:s7,hasOwnProp:s7,reduceDescriptors:_7,freezeMethods:Dne,toObjectSet:Bne,toCamelCase:Rne,noop:Lne,toFiniteNumber:Fne,findKey:E7,global:Kc,isContextDefined:S7,ALPHABET:T7,generateString:qne,isSpecCompliantForm:Une,toJSONObject:kne,isAsyncFn:Vne,isThenable:Hne,setImmediate:I7,asap:Gne};function je(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}te.inherits(je,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:te.toJSONObject(this.config),code:this.code,status:this.status}}});var C7=je.prototype,x7={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{x7[t]={value:t}});Object.defineProperties(je,x7);Object.defineProperty(C7,"isAxiosError",{value:!0});je.from=(t,e,r,n,i,s)=>{let o=Object.create(C7);return te.toFlatObject(t,o,function(a){return a!==Error.prototype},c=>c!=="isAxiosError"),je.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var zne=null;function o3(t){return te.isPlainObject(t)||te.isArray(t)}function N7(t){return te.endsWith(t,"[]")?t.slice(0,-2):t}function a7(t,e,r){return t?t.concat(e).map(function(i,s){return i=N7(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function jne(t){return te.isArray(t)&&!t.some(o3)}var Qne=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});function uy(t,e,r){if(!te.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=te.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(R,D){return!te.isUndefined(D[R])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,a=(r.Blob||typeof Blob<"u"&&Blob)&&te.isSpecCompliantForm(e);if(!te.isFunction(i))throw new TypeError("visitor must be a function");function u(N){if(N===null)return"";if(te.isDate(N))return N.toISOString();if(!a&&te.isBlob(N))throw new je("Blob is not supported. Use a Buffer instead.");return te.isArrayBuffer(N)||te.isTypedArray(N)?a&&typeof Blob=="function"?new Blob([N]):b.Buffer.from(N):N}function f(N,R,D){let U=N;if(N&&!D&&typeof N=="object"){if(te.endsWith(R,"{}"))R=n?R:R.slice(0,-2),N=JSON.stringify(N);else if(te.isArray(N)&&jne(N)||(te.isFileList(N)||te.endsWith(R,"[]"))&&(U=te.toArray(N)))return R=N7(R),U.forEach(function(z,H){!(te.isUndefined(z)||z===null)&&e.append(o===!0?a7([R],H,s):o===null?R:R+"[]",u(z))}),!1}return o3(N)?!0:(e.append(a7(D,R,s),u(N)),!1)}let p=[],S=Object.assign(Qne,{defaultVisitor:f,convertValue:u,isVisitable:o3});function I(N,R){if(!te.isUndefined(N)){if(p.indexOf(N)!==-1)throw Error("Circular reference detected in "+R.join("."));p.push(N),te.forEach(N,function(U,k){(!(te.isUndefined(U)||U===null)&&i.call(e,U,te.isString(k)?k.trim():k,R,S))===!0&&I(U,R?R.concat(k):[k])}),p.pop()}}if(!te.isObject(t))throw new TypeError("data must be an object");return I(t),e}function c7(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function g3(t,e){this._pairs=[],t&&uy(t,this,e)}var O7=g3.prototype;O7.append=function(e,r){this._pairs.push([e,r])};O7.toString=function(e){let r=e?function(n){return e.call(this,n,c7)}:c7;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Kne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function P7(t,e,r){if(!e)return t;let n=r&&r.encode||Kne,i=r&&r.serialize,s;if(i?s=i(e,r):s=te.isURLSearchParams(e)?e.toString():new g3(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var a3=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){te.forEach(this.handlers,function(n){n!==null&&e(n)})}},u7=a3,R7={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wne=typeof URLSearchParams<"u"?URLSearchParams:g3,$ne=typeof FormData<"u"?FormData:null,Yne=typeof Blob<"u"?Blob:null,Jne={isBrowser:!0,classes:{URLSearchParams:Wne,FormData:$ne,Blob:Yne},protocols:["http","https","file","blob","url","data"]},m3=typeof window<"u"&&typeof document<"u",c3=typeof navigator=="object"&&navigator||void 0,Xne=m3&&(!c3||["ReactNative","NativeScript","NS"].indexOf(c3.product)<0),Zne=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",eie=m3&&window.location.href||"http://localhost",tie=Object.freeze({__proto__:null,hasBrowserEnv:m3,hasStandardBrowserWebWorkerEnv:Zne,hasStandardBrowserEnv:Xne,navigator:c3,origin:eie}),qn={...tie,...Jne};function rie(t,e){return uy(t,new qn.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return qn.isNode&&te.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function nie(t){return te.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function iie(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&te.isArray(i)?i.length:o,a?(te.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!te.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&te.isArray(i[o])&&(i[o]=iie(i[o])),!c)}if(te.isFormData(t)&&te.isFunction(t.entries)){let r={};return te.forEachEntry(t,(n,i)=>{e(nie(n),i,r,0)}),r}return null}function sie(t,e,r){if(te.isString(t))try{return(e||JSON.parse)(t),te.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var y3={transitional:R7,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=te.isObject(e);if(s&&te.isHTMLForm(e)&&(e=new FormData(e)),te.isFormData(e))return i?JSON.stringify(M7(e)):e;if(te.isArrayBuffer(e)||te.isBuffer(e)||te.isStream(e)||te.isFile(e)||te.isBlob(e)||te.isReadableStream(e))return e;if(te.isArrayBufferView(e))return e.buffer;if(te.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return rie(e,this.formSerializer).toString();if((c=te.isFileList(e))||n.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return uy(c?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),sie(e)):e}],transformResponse:[function(e){let r=this.transitional||y3.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(te.isResponse(e)||te.isReadableStream(e))return e;if(e&&te.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(c){if(o)throw c.name==="SyntaxError"?je.from(c,je.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qn.classes.FormData,Blob:qn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(["delete","get","head","post","put","patch"],t=>{y3.headers[t]={}});var v3=y3,oie=te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),aie=t=>{let e={},r,n,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&oie[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},l7=Symbol("internals");function Jh(t){return t&&String(t).trim().toLowerCase()}function ry(t){return t===!1||t==null?t:te.isArray(t)?t.map(ry):String(t)}function cie(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var uie=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function r3(t,e,r,n,i){if(te.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!te.isString(e)){if(te.isString(n))return e.indexOf(n)!==-1;if(te.isRegExp(n))return n.test(e)}}function lie(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function fie(t,e){let r=te.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Kl=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(c,a,u){let f=Jh(a);if(!f)throw new Error("header name must be a non-empty string");let p=te.findKey(i,f);(!p||i[p]===void 0||u===!0||u===void 0&&i[p]!==!1)&&(i[p||a]=ry(c))}let o=(c,a)=>te.forEach(c,(u,f)=>s(u,f,a));if(te.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(te.isString(e)&&(e=e.trim())&&!uie(e))o(aie(e),r);else if(te.isHeaders(e))for(let[c,a]of e.entries())s(a,c,n);else e!=null&&s(r,e,n);return this}get(e,r){if(e=Jh(e),e){let n=te.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return cie(i);if(te.isFunction(r))return r.call(this,i,n);if(te.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Jh(e),e){let n=te.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||r3(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=Jh(o),o){let c=te.findKey(n,o);c&&(!r||r3(n,n[c],c,r))&&(delete n[c],i=!0)}}return te.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||r3(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return te.forEach(this,(i,s)=>{let o=te.findKey(n,s);if(o){r[o]=ry(i),delete r[s];return}let c=e?lie(s):String(s).trim();c!==s&&delete r[s],r[c]=ry(i),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return te.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&te.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[l7]=this[l7]={accessors:{}}).accessors,i=this.prototype;function s(o){let c=Jh(o);n[c]||(fie(i,o),n[c]=!0)}return te.isArray(e)?e.forEach(s):s(e),this}};Kl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);te.reduceDescriptors(Kl.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});te.freezeMethods(Kl);var ts=Kl;function n3(t,e){let r=this||v3,n=e||r,i=ts.from(n.headers),s=n.data;return te.forEach(t,function(c){s=c.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function D7(t){return!!(t&&t.__CANCEL__)}function Yl(t,e,r){je.call(this,t??"canceled",je.ERR_CANCELED,e,r),this.name="CanceledError"}te.inherits(Yl,je,{__CANCEL__:!0});function B7(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new je("Request failed with status code "+r.status,[je.ERR_BAD_REQUEST,je.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function die(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function hie(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(a){let u=Date.now(),f=n[s];o||(o=u),r[i]=a,n[i]=u;let p=s,S=0;for(;p!==i;)S+=r[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o{r=f,i=null,s&&(clearTimeout(s),s=null),t.apply(null,u)};return[(...u)=>{let f=Date.now(),p=f-r;p>=n?o(u,f):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-p)))},()=>i&&o(i)]}var iy=(t,e,r=3)=>{let n=0,i=hie(50,250);return pie(s=>{let o=s.loaded,c=s.lengthComputable?s.total:void 0,a=o-n,u=i(a),f=o<=c;n=o;let p={loaded:o,total:c,progress:c?o/c:void 0,bytes:a,rate:u||void 0,estimated:u&&c&&f?(c-o)/u:void 0,event:s,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},r)},f7=(t,e)=>{let r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},d7=t=>(...e)=>te.asap(()=>t(...e)),gie=qn.hasStandardBrowserEnv?function(){let e=qn.navigator&&/(msie|trident)/i.test(qn.navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let c=te.isString(o)?i(o):o;return c.protocol===n.protocol&&c.host===n.host}}():function(){return function(){return!0}}(),mie=qn.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];te.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),te.isString(n)&&o.push("path="+n),te.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function yie(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function vie(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function L7(t,e){return t&&!yie(e)?vie(t,e):e}var h7=t=>t instanceof ts?{...t}:t;function Wc(t,e){e=e||{};let r={};function n(u,f,p){return te.isPlainObject(u)&&te.isPlainObject(f)?te.merge.call({caseless:p},u,f):te.isPlainObject(f)?te.merge({},f):te.isArray(f)?f.slice():f}function i(u,f,p){if(te.isUndefined(f)){if(!te.isUndefined(u))return n(void 0,u,p)}else return n(u,f,p)}function s(u,f){if(!te.isUndefined(f))return n(void 0,f)}function o(u,f){if(te.isUndefined(f)){if(!te.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function c(u,f,p){if(p in e)return n(u,f);if(p in t)return n(void 0,u)}let a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,f)=>i(h7(u),h7(f),!0)};return te.forEach(Object.keys(Object.assign({},t,e)),function(f){let p=a[f]||i,S=p(t[f],e[f],f);te.isUndefined(S)&&p!==c||(r[f]=S)}),r}var F7=t=>{let e=Wc({},t),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:c}=e;e.headers=o=ts.from(o),e.url=P7(L7(e.baseURL,e.url),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let a;if(te.isFormData(r)){if(qn.hasStandardBrowserEnv||qn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){let[u,...f]=a?a.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...f].join("; "))}}if(qn.hasStandardBrowserEnv&&(n&&te.isFunction(n)&&(n=n(e)),n||n!==!1&&gie(e.url))){let u=i&&s&&mie.read(s);u&&o.set(i,u)}return e},bie=typeof XMLHttpRequest<"u",wie=bie&&function(t){return new Promise(function(r,n){let i=F7(t),s=i.data,o=ts.from(i.headers).normalize(),{responseType:c,onUploadProgress:a,onDownloadProgress:u}=i,f,p,S,I,N;function R(){I&&I(),N&&N(),i.cancelToken&&i.cancelToken.unsubscribe(f),i.signal&&i.signal.removeEventListener("abort",f)}let D=new XMLHttpRequest;D.open(i.method.toUpperCase(),i.url,!0),D.timeout=i.timeout;function U(){if(!D)return;let z=ts.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),F={data:!c||c==="text"||c==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:z,config:t,request:D};B7(function(q){r(q),R()},function(q){n(q),R()},F),D=null}"onloadend"in D?D.onloadend=U:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(U)},D.onabort=function(){D&&(n(new je("Request aborted",je.ECONNABORTED,t,D)),D=null)},D.onerror=function(){n(new je("Network Error",je.ERR_NETWORK,t,D)),D=null},D.ontimeout=function(){let H=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",F=i.transitional||R7;i.timeoutErrorMessage&&(H=i.timeoutErrorMessage),n(new je(H,F.clarifyTimeoutError?je.ETIMEDOUT:je.ECONNABORTED,t,D)),D=null},s===void 0&&o.setContentType(null),"setRequestHeader"in D&&te.forEach(o.toJSON(),function(H,F){D.setRequestHeader(F,H)}),te.isUndefined(i.withCredentials)||(D.withCredentials=!!i.withCredentials),c&&c!=="json"&&(D.responseType=i.responseType),u&&([S,N]=iy(u,!0),D.addEventListener("progress",S)),a&&D.upload&&([p,I]=iy(a),D.upload.addEventListener("progress",p),D.upload.addEventListener("loadend",I)),(i.cancelToken||i.signal)&&(f=z=>{D&&(n(!z||z.type?new Yl(null,t,D):z),D.abort(),D=null)},i.cancelToken&&i.cancelToken.subscribe(f),i.signal&&(i.signal.aborted?f():i.signal.addEventListener("abort",f)));let k=die(i.url);if(k&&qn.protocols.indexOf(k)===-1){n(new je("Unsupported protocol "+k+":",je.ERR_BAD_REQUEST,t));return}D.send(s||null)})},Aie=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,i,s=function(u){if(!i){i=!0,c();let f=u instanceof Error?u:this.reason;n.abort(f instanceof je?f:new Yl(f instanceof Error?f.message:f))}},o=e&&setTimeout(()=>{o=null,s(new je(`timeout ${e} of ms exceeded`,je.ETIMEDOUT))},e),c=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),t=null)};t.forEach(u=>u.addEventListener("abort",s));let{signal:a}=n;return a.unsubscribe=()=>te.asap(c),a}},Eie=Aie,Sie=function*(t,e){let r=t.byteLength;if(!e||r{let i=_ie(t,e),s=0,o,c=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{let{done:u,value:f}=await i.next();if(u){c(),a.close();return}let p=f.byteLength;if(r){let S=s+=p;r(S)}a.enqueue(new Uint8Array(f))}catch(u){throw c(u),u}},cancel(a){return c(a),i.return()}},{highWaterMark:2})},ly=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",q7=ly&&typeof ReadableStream=="function",Iie=ly&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),U7=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Cie=q7&&U7(()=>{let t=!1,e=new Request(qn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),g7=64*1024,u3=q7&&U7(()=>te.isReadableStream(new Response("").body)),sy={stream:u3&&(t=>t.body)};ly&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!sy[e]&&(sy[e]=te.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new je(`Response type '${e}' is not supported`,je.ERR_NOT_SUPPORT,n)})})})(new Response);var xie=async t=>{if(t==null)return 0;if(te.isBlob(t))return t.size;if(te.isSpecCompliantForm(t))return(await new Request(qn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(te.isArrayBufferView(t)||te.isArrayBuffer(t))return t.byteLength;if(te.isURLSearchParams(t)&&(t=t+""),te.isString(t))return(await Iie(t)).byteLength},Nie=async(t,e)=>{let r=te.toFiniteNumber(t.getContentLength());return r??xie(e)},Oie=ly&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:c,onUploadProgress:a,responseType:u,headers:f,withCredentials:p="same-origin",fetchOptions:S}=F7(t);u=u?(u+"").toLowerCase():"text";let I=Eie([i,s&&s.toAbortSignal()],o),N,R=I&&I.unsubscribe&&(()=>{I.unsubscribe()}),D;try{if(a&&Cie&&r!=="get"&&r!=="head"&&(D=await Nie(f,n))!==0){let F=new Request(e,{method:"POST",body:n,duplex:"half"}),V;if(te.isFormData(n)&&(V=F.headers.get("content-type"))&&f.setContentType(V),F.body){let[q,C]=f7(D,iy(d7(a)));n=p7(F.body,g7,q,C)}}te.isString(p)||(p=p?"include":"omit");let U="credentials"in Request.prototype;N=new Request(e,{...S,signal:I,method:r.toUpperCase(),headers:f.normalize().toJSON(),body:n,duplex:"half",credentials:U?p:void 0});let k=await fetch(N),z=u3&&(u==="stream"||u==="response");if(u3&&(c||z&&R)){let F={};["status","statusText","headers"].forEach(B=>{F[B]=k[B]});let V=te.toFiniteNumber(k.headers.get("content-length")),[q,C]=c&&f7(V,iy(d7(c),!0))||[];k=new Response(p7(k.body,g7,q,()=>{C&&C(),R&&R()}),F)}u=u||"text";let H=await sy[te.findKey(sy,u)||"text"](k,t);return!z&&R&&R(),await new Promise((F,V)=>{B7(F,V,{data:H,headers:ts.from(k.headers),status:k.status,statusText:k.statusText,config:t,request:N})})}catch(U){throw R&&R(),U&&U.name==="TypeError"&&/fetch/i.test(U.message)?Object.assign(new je("Network Error",je.ERR_NETWORK,t,N),{cause:U.cause||U}):je.from(U,U&&U.code,t,N)}}),l3={http:zne,xhr:wie,fetch:Oie};te.forEach(l3,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var m7=t=>`- ${t}`,Pie=t=>te.isFunction(t)||t===null||t===!1,k7={getAdapter:t=>{t=te.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${c} `+(a===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : +`+s.map(m7).join(` +`):" "+m7(s[0]):"as no adapter specified";throw new je("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:l3};function i3(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Yl(null,t)}function y7(t){return i3(t),t.headers=ts.from(t.headers),t.data=n3.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),k7.getAdapter(t.adapter||v3.adapter)(t).then(function(n){return i3(t),n.data=n3.call(t,t.transformResponse,n),n.headers=ts.from(n.headers),n},function(n){return D7(n)||(i3(t),n&&n.response&&(n.response.data=n3.call(t,t.transformResponse,n.response),n.response.headers=ts.from(n.response.headers))),Promise.reject(n)})}var V7="1.7.7",b3={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{b3[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var v7={};b3.transitional=function(e,r,n){function i(s,o){return"[Axios v"+V7+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,c)=>{if(e===!1)throw new je(i(o," has been removed"+(r?" in "+r:"")),je.ERR_DEPRECATED);return r&&!v7[o]&&(v7[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,c):!0}};function Rie(t,e,r){if(typeof t!="object")throw new je("options must be an object",je.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let c=t[s],a=c===void 0||o(c,s,t);if(a!==!0)throw new je("option "+s+" must be "+a,je.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new je("Unknown option "+s,je.ERR_BAD_OPTION)}}var f3={assertOptions:Rie,validators:b3},Ia=f3.validators,Wl=class{constructor(e){this.defaults=e,this.interceptors={request:new u7,response:new u7}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Wc(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&f3.assertOptions(n,{silentJSONParsing:Ia.transitional(Ia.boolean),forcedJSONParsing:Ia.transitional(Ia.boolean),clarifyTimeoutError:Ia.transitional(Ia.boolean)},!1),i!=null&&(te.isFunction(i)?r.paramsSerializer={serialize:i}:f3.assertOptions(i,{encode:Ia.function,serialize:Ia.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&te.merge(s.common,s[r.method]);s&&te.forEach(["delete","get","head","post","put","patch","common"],N=>{delete s[N]}),r.headers=ts.concat(o,s);let c=[],a=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(a=a&&R.synchronous,c.unshift(R.fulfilled,R.rejected))});let u=[];this.interceptors.response.forEach(function(R){u.push(R.fulfilled,R.rejected)});let f,p=0,S;if(!a){let N=[y7.bind(this),void 0];for(N.unshift.apply(N,c),N.push.apply(N,u),S=N.length,f=Promise.resolve(r);p{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(c=>{n.subscribe(c),s=c}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,c){n.reason||(n.reason=new Yl(s,o,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Mie=d3;function Die(t){return function(r){return t.apply(null,r)}}function Bie(t){return te.isObject(t)&&t.isAxiosError===!0}var h3={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(h3).forEach(([t,e])=>{h3[e]=t});var Lie=h3;function H7(t){let e=new ny(t),r=b7(ny.prototype.request,e);return te.extend(r,ny.prototype,e,{allOwnKeys:!0}),te.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return H7(Wc(t,i))},r}var Rr=H7(v3);Rr.Axios=ny;Rr.CanceledError=Yl;Rr.CancelToken=Mie;Rr.isCancel=D7;Rr.VERSION=V7;Rr.toFormData=uy;Rr.AxiosError=je;Rr.Cancel=Rr.CanceledError;Rr.all=function(e){return Promise.all(e)};Rr.spread=Die;Rr.isAxiosError=Bie;Rr.mergeConfig=Wc;Rr.AxiosHeaders=ts;Rr.formToJSON=t=>M7(te.isHTMLForm(t)?new FormData(t):t);Rr.getAdapter=k7.getAdapter;Rr.HttpStatusCode=Lie;Rr.default=Rr;G7.exports=Rr});var hy=L(Ca=>{"use strict";h();var Fie=Ca&&Ca.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ca,"__esModule",{value:!0});Ca.GuardianData=Ca.AccountOnNetwork=void 0;var z7=Fie((qt(),qe(jt))),fy=Ti(),w3=class t{constructor(e){this.address=new fy.Address(""),this.nonce=0,this.balance=new z7.default(0),this.code="",this.userName="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new fy.Address(e.address||""),r.nonce=Number(e.nonce||0),r.balance=new z7.default(e.balance||0),r.code=e.code||"",r.userName=e.username||"",r}};Ca.AccountOnNetwork=w3;var A3=class t{constructor(e){this.guarded=!1,Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.guarded=e.guarded||!1,e.activeGuardian&&(r.activeGuardian=dy.fromHttpResponse(e.activeGuardian)),e.pendingGuardian&&(r.pendingGuardian=dy.fromHttpResponse(e.pendingGuardian)),r}getCurrentGuardianAddress(){if(this.guarded)return this.activeGuardian?.address}};Ca.GuardianData=A3;var dy=class t{constructor(){this.activationEpoch=0,this.address=new fy.Address(""),this.serviceUID=""}static fromHttpResponse(e){let r=new t;return r.activationEpoch=Number(e.activationEpoch||0),r.address=new fy.Address(e.address||""),r.serviceUID=e.serviceUID||"",r}}});var E3=L(Jl=>{"use strict";h();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.defaultPagination=Jl.defaultAxiosConfig=void 0;var qie=s1()({constructorAction:"ignore"});Jl.defaultAxiosConfig={timeout:5e3,transformResponse:[function(t){return qie.parse(t)}]};Jl.defaultPagination={from:0,size:100}});var gy=L(py=>{"use strict";h();Object.defineProperty(py,"__esModule",{value:!0});py.ContractQueryRequest=void 0;var S3=class{constructor(e){this.query=e}toHttpRequest(){let e={},r=this.query;return e.scAddress=r.address.bech32(),e.caller=r.caller?.bech32()?r.caller.bech32():void 0,e.funcName=r.func.toString(),e.value=r.value?r.value.toString():void 0,e.args=r.getEncodedArguments(),e}};py.ContractQueryRequest=S3});var my=L(qs=>{"use strict";h();Object.defineProperty(qs,"__esModule",{value:!0});qs.ErrContractQuery=qs.ErrNetworkProvider=qs.ErrUnexpectedCondition=qs.Err=void 0;var Xl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};qs.Err=Xl;var _3=class extends Xl{constructor(e){super(`Unexpected condition: [${e}]`)}};qs.ErrUnexpectedCondition=_3;var T3=class extends Xl{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};qs.ErrNetworkProvider=T3;var I3=class extends Xl{constructor(e){super(e.message.replace("executeQuery:",""))}};qs.ErrContractQuery=I3});var x3=L(yy=>{"use strict";h();Object.defineProperty(yy,"__esModule",{value:!0});yy.NetworkGeneralStatistics=void 0;var C3=class t{constructor(){this.Shards=0,this.Blocks=0,this.Accounts=0,this.Transactions=0,this.RefreshRate=0,this.Epoch=0,this.RoundsPassed=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let r=new t;return r.Shards=Number(e.shards),r.Blocks=Number(e.blocks),r.Accounts=Number(e.accounts),r.Transactions=Number(e.transactions),r.RefreshRate=Number(e.refreshRate),r.Epoch=Number(e.epoch),r.RoundsPassed=Number(e.roundsPassed),r.RoundsPerEpoch=Number(e.roundsPerEpoch),r}};yy.NetworkGeneralStatistics=C3});var O3=L(Zl=>{"use strict";h();var Uie=Zl&&Zl.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zl,"__esModule",{value:!0});Zl.NetworkStake=void 0;var j7=Uie((qt(),qe(jt))),N3=class t{constructor(){this.TotalValidators=0,this.ActiveValidators=0,this.QueueSize=0,this.TotalStaked=new j7.default(0)}static fromHttpResponse(e){let r=new t;return r.TotalValidators=Number(e.totalValidators),r.ActiveValidators=Number(e.activeValidators),r.QueueSize=Number(e.queueSize),r.TotalStaked=new j7.default(e.totalStaked),r}};Zl.NetworkStake=N3});var K7=L(ef=>{"use strict";h();var kie=ef&&ef.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ef,"__esModule",{value:!0});ef.PairOnNetwork=void 0;var Q7=Ti(),Us=kie((qt(),qe(jt))),P3=class t{constructor(e){this.address=new Q7.Address(""),this.id="",this.symbol="",this.name="",this.price=new Us.default(0),this.baseId="",this.basePrice=new Us.default(0),this.baseSymbol="",this.baseName="",this.quoteId="",this.quotePrice=new Us.default(0),this.quoteSymbol="",this.quoteName="",this.totalValue=new Us.default(0),this.volume24h=new Us.default(0),this.state="",this.type="",this.rawResponse={},Object.assign(this,e)}static fromApiHttpResponse(e){let r=new t;return r.address=new Q7.Address(e.address||""),r.id=e.id||"",r.symbol=e.symbol||"",r.name=e.name||"",r.price=new Us.default(e.price||0),r.baseId=e.baseId||"",r.basePrice=new Us.default(e.basePrice||0),r.baseSymbol=e.baseSymbol||"",r.baseName=e.baseName||"",r.quoteId=e.quoteId||"",r.quotePrice=new Us.default(e.quotePrice||0),r.quoteSymbol=e.quoteSymbol||"",r.quoteName=e.quoteName||"",r.totalValue=new Us.default(e.totalValue||0),r.volume24h=new Us.default(e.volume24h||0),r.state=e.state||"",r.type=e.type||"",r.rawResponse=e,r}};ef.PairOnNetwork=P3});var M3=L(tf=>{"use strict";h();var Vie=tf&&tf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tf,"__esModule",{value:!0});tf.NetworkConfig=void 0;var W7=Vie((qt(),qe(jt))),R3=class t{constructor(){this.ChainID="T",this.GasPerDataByte=1500,this.TopUpFactor=0,this.RoundDuration=0,this.RoundsPerEpoch=0,this.TopUpRewardsGradientPoint=new W7.default(0),this.MinGasLimit=5e4,this.MinGasPrice=1e9,this.GasPriceModifier=1,this.MinTransactionVersion=1}static fromHttpResponse(e){let r=new t;return r.ChainID=String(e.erd_chain_id),r.GasPerDataByte=Number(e.erd_gas_per_data_byte),r.TopUpFactor=Number(e.erd_top_up_factor),r.RoundDuration=Number(e.erd_round_duration),r.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),r.TopUpRewardsGradientPoint=new W7.default(e.erd_rewards_top_up_gradient_point),r.MinGasLimit=Number(e.erd_min_gas_limit),r.MinGasPrice=Number(e.erd_min_gas_price),r.MinTransactionVersion=Number(e.erd_min_transaction_version),r.GasPriceModifier=Number(e.erd_gas_price_modifier),r}};tf.NetworkConfig=R3});var B3=L(vy=>{"use strict";h();Object.defineProperty(vy,"__esModule",{value:!0});vy.NetworkStatus=void 0;var D3=class t{constructor(){this.CurrentRound=0,this.EpochNumber=0,this.HighestFinalNonce=0,this.Nonce=0,this.NonceAtEpochStart=0,this.NoncesPassedInCurrentEpoch=0,this.RoundAtEpochStart=0,this.RoundsPassedInCurrentEpoch=0,this.RoundsPerEpoch=0}static fromHttpResponse(e){let r=new t;return r.CurrentRound=Number(e.erd_current_round),r.EpochNumber=Number(e.erd_epoch_number),r.HighestFinalNonce=Number(e.erd_highest_final_nonce),r.Nonce=Number(e.erd_nonce),r.NonceAtEpochStart=Number(e.erd_nonce_at_epoch_start),r.NoncesPassedInCurrentEpoch=Number(e.erd_nonces_passed_in_current_epoch),r.RoundAtEpochStart=Number(e.erd_round_at_epoch_start),r.RoundsPassedInCurrentEpoch=Number(e.erd_rounds_passed_in_current_epoch),r.RoundsPerEpoch=Number(e.erd_rounds_per_epoch),r}};vy.NetworkStatus=D3});var wy=L(xa=>{"use strict";h();var Hie=xa&&xa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xa,"__esModule",{value:!0});xa.DefinitionOfTokenCollectionOnNetwork=xa.DefinitionOfFungibleTokenOnNetwork=void 0;var by=Hie((qt(),qe(jt))),rf=Ti(),L3=class t{constructor(){this.identifier="",this.name="",this.ticker="",this.owner=new rf.Address(""),this.decimals=0,this.supply=new by.default(0),this.isPaused=!1,this.canUpgrade=!1,this.canMint=!1,this.canBurn=!1,this.canChangeOwner=!1,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canAddSpecialRoles=!1,this.assets={}}static fromApiHttpResponse(e){let r=new t;return r.identifier=e.identifier||"",r.name=e.name||"",r.ticker=e.ticker||"",r.owner=new rf.Address(e.owner||""),r.decimals=e.decimals||0,r.supply=new by.default(e.supply||"0"),r.isPaused=e.isPaused||!1,r.canUpgrade=e.canUpgrade||!1,r.canMint=e.canMint||!1,r.canBurn=e.canBurn||!1,r.canChangeOwner=e.canChangeOwner||!1,r.canPause=e.canPause||!1,r.canFreeze=e.canFreeze||!1,r.canWipe=e.canWipe||!1,r.assets=e.assets||{},r}static fromResponseOfGetTokenProperties(e,r){let n=new t,[i,s,o,c,...a]=r,u=$7(a);return n.identifier=e,n.name=i.toString(),n.ticker=e,n.owner=rf.Address.fromPubkey(o),n.decimals=u.NumDecimals.toNumber(),n.supply=new by.default(c.toString()).shiftedBy(-n.decimals),n.isPaused=u.IsPaused,n.canUpgrade=u.CanUpgrade,n.canMint=u.CanMint,n.canBurn=u.CanBurn,n.canChangeOwner=u.CanChangeOwner,n.canPause=u.CanPause,n.canFreeze=u.CanFreeze,n.canWipe=u.CanWipe,n}};xa.DefinitionOfFungibleTokenOnNetwork=L3;var F3=class t{constructor(){this.collection="",this.type="",this.name="",this.ticker="",this.owner=new rf.Address(""),this.decimals=0,this.canPause=!1,this.canFreeze=!1,this.canWipe=!1,this.canUpgrade=!1,this.canChangeOwner=!1,this.canAddSpecialRoles=!1,this.canTransferNftCreateRole=!1,this.canCreateMultiShard=!1}static fromApiHttpResponse(e){let r=new t;return r.collection=e.collection||"",r.type=e.type||"",r.name=e.name||"",r.ticker=e.ticker||"",r.owner=new rf.Address(e.owner||""),r.decimals=e.decimals||0,r.canPause=e.canPause||!1,r.canFreeze=e.canFreeze||!1,r.canWipe=e.canWipe||!1,r.canUpgrade=e.canUpgrade||!1,r.canAddSpecialRoles=e.canAddSpecialRoles||!1,r.canTransferNftCreateRole=e.canTransferNftCreateRole||!1,r}static fromResponseOfGetTokenProperties(e,r){let n=new t,[i,s,o,c,a,...u]=r,f=$7(u);return n.collection=e,n.type=s.toString(),n.name=i.toString(),n.ticker=e,n.owner=rf.Address.fromPubkey(o),n.decimals=f.NumDecimals.toNumber()??0,n.canPause=f.CanPause||!1,n.canFreeze=f.CanFreeze||!1,n.canWipe=f.CanWipe||!1,n.canUpgrade=f.CanUpgrade||!1,n.canChangeOwner=f.CanChangeOwner||!1,n.canAddSpecialRoles=f.CanAddSpecialRoles||!1,n.canTransferNftCreateRole=f.CanTransferNFTCreateRole||!1,n.canCreateMultiShard=f.CanCreateMultiShard||!1,n}};xa.DefinitionOfTokenCollectionOnNetwork=F3;function $7(t){let e={};for(let r of t){let[n,i]=r.toString().split("-");e[n]=Gie(i)}return e}function Gie(t){switch(t){case"true":return!0;case"false":return!1;default:return new by.default(t)}}});var Ay=L(nf=>{"use strict";h();Object.defineProperty(nf,"__esModule",{value:!0});nf.NonFungibleTokenOfAccountOnNetwork=nf.FungibleTokenOfAccountOnNetwork=void 0;var ks=(qt(),qe(jt)),q3=Ti(),U3=class t{constructor(){this.identifier="",this.balance=new ks.BigNumber(0),this.rawResponse={}}static fromHttpResponse(e){let r=new t;return r.identifier=e.tokenIdentifier||e.identifier||"",r.balance=new ks.BigNumber(e.balance||0),r.rawResponse=e,r}};nf.FungibleTokenOfAccountOnNetwork=U3;var k3=class t{constructor(e){this.identifier="",this.collection="",this.timestamp=0,this.attributes=b.Buffer.from([]),this.nonce=0,this.type="",this.name="",this.creator=new q3.Address(""),this.supply=new ks.BigNumber(0),this.decimals=0,this.royalties=new ks.BigNumber(0),this.assets=[],this.balance=new ks.BigNumber(0),Object.assign(this,e)}static fromProxyHttpResponse(e){let r=t.fromHttpResponse(e);return r.identifier=e.tokenIdentifier||"",r.collection=t.parseCollectionFromIdentifier(r.identifier),r.royalties=new ks.BigNumber(e.royalties||0).div(100),r}static fromProxyHttpResponseByNonce(e){let r=t.fromHttpResponse(e),n=new q3.Nonce(r.nonce).hex();return r.identifier=`${e.tokenIdentifier}-${n}`,r.collection=e.tokenIdentifier||"",r.royalties=new ks.BigNumber(e.royalties||0).div(100),r}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.identifier=e.identifier||"",r.collection=e.collection||"",r}static fromHttpResponse(e){let r=new t;return r.timestamp=Number(e.timestamp||0),r.attributes=b.Buffer.from(e.attributes||"","base64"),r.nonce=e.nonce||0,r.type=e.type||"",r.name=e.name||"",r.creator=new q3.Address(e.creator||""),r.decimals=Number(e.decimals||0),r.supply=new ks.BigNumber(e.balance||1),r.royalties=new ks.BigNumber(e.royalties||0),r.assets=e.assets||[],r.balance=new ks.BigNumber(e.balance||1),r}static parseCollectionFromIdentifier(e){return e.split("-").slice(0,2).join("-")}};nf.NonFungibleTokenOfAccountOnNetwork=k3});var sf=L(Ey=>{"use strict";h();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.TransactionStatus=void 0;var V3=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};Ey.TransactionStatus=V3});var G3=L(Na=>{"use strict";h();Object.defineProperty(Na,"__esModule",{value:!0});Na.TransactionEventTopic=Na.TransactionEventData=Na.TransactionEvent=void 0;var Y7=Ti(),H3=class t{constructor(e){this.address=new Y7.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new of(b.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new Y7.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new Sy(n)),r.dataPayload=of.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(of.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Na.TransactionEvent=H3;var of=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(b.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Na.TransactionEventData=of;var Sy=class{constructor(e){this.raw=b.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Na.TransactionEventTopic=Sy});var t0=L(_y=>{"use strict";h();Object.defineProperty(_y,"__esModule",{value:!0});_y.TransactionLogs=void 0;var zie=my(),J7=Ti(),jie=G3(),z3=class t{constructor(e){this.address=new J7.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new J7.Address(e.address),r.events=(e.events||[]).map(n=>jie.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new zie.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};_y.TransactionLogs=z3});var Iy=L(af=>{"use strict";h();Object.defineProperty(af,"__esModule",{value:!0});af.ContractResultItem=af.ContractResults=void 0;var X7=t0(),Ty=Ti(),j3=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>r0.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>r0.fromApiHttpResponse(n));return new t(r)}};af.ContractResults=j3;var r0=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Ty.Address(""),this.sender=new Ty.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new X7.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=b.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new Ty.Address(e.receiver),r.sender=new Ty.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=X7.TransactionLogs.fromHttpResponse(e.logs||{}),r}};af.ContractResultItem=r0});var xy=L(Cy=>{"use strict";h();Object.defineProperty(Cy,"__esModule",{value:!0});Cy.TransactionReceipt=void 0;var Z7=Ti(),Q3=class t{constructor(){this.value="",this.sender=new Z7.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new Z7.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Cy.TransactionReceipt=Q3});var Oy=L(cf=>{"use strict";h();Object.defineProperty(cf,"__esModule",{value:!0});cf.TransactionOnNetwork=cf.prepareTransactionForBroadcasting=void 0;var eD=sf(),K3=Iy(),Ny=Ti(),tD=t0(),rD=xy();function Qie(t){return"toSendable"in t?t.toSendable():{nonce:Number(t.nonce),value:t.value.toString(),receiver:t.receiver,sender:t.sender,senderUsername:t.senderUsername?b.Buffer.from(t.senderUsername).toString("base64"):void 0,receiverUsername:t.receiverUsername?b.Buffer.from(t.receiverUsername).toString("base64"):void 0,gasPrice:Number(t.gasPrice),gasLimit:Number(t.gasLimit),data:t.data.length===0?void 0:b.Buffer.from(t.data).toString("base64"),chainID:t.chainID,version:t.version,options:t.options,guardian:t.guardian||void 0,signature:b.Buffer.from(t.signature).toString("hex"),guardianSignature:t.guardianSignature.length===0?void 0:b.Buffer.from(t.guardianSignature).toString("hex")}}cf.prepareTransactionForBroadcasting=Qie;var W3=class t{constructor(e){this.hash="",this.type="",this.nonce=0,this.round=0,this.epoch=0,this.value="",this.receiver=new Ny.Address(""),this.sender=new Ny.Address(""),this.gasLimit=0,this.gasPrice=0,this.function="",this.data=b.Buffer.from([]),this.signature="",this.status=eD.TransactionStatus.createUnknown(),this.timestamp=0,this.blockNonce=0,this.hyperblockNonce=0,this.hyperblockHash="",this.receipt=new rD.TransactionReceipt,this.contractResults=new K3.ContractResults([]),this.logs=new tD.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e,r,n){let i=t.fromHttpResponse(e,r);return i.contractResults=K3.ContractResults.fromProxyHttpResponse(r.smartContractResults||[]),n&&(i.status=n,i.isCompleted=i.status.isSuccessful()||i.status.isFailed()),i}static fromApiHttpResponse(e,r){let n=t.fromHttpResponse(e,r);return n.contractResults=K3.ContractResults.fromApiHttpResponse(r.results||[]),n.isCompleted=!n.status.isPending(),n}static fromHttpResponse(e,r){let n=new t;return n.hash=e,n.type=r.type||"",n.nonce=r.nonce||0,n.round=r.round,n.epoch=r.epoch||0,n.value=(r.value||0).toString(),n.sender=new Ny.Address(r.sender),n.receiver=new Ny.Address(r.receiver),n.gasPrice=r.gasPrice||0,n.gasLimit=r.gasLimit||0,n.function=r.function||"",n.data=b.Buffer.from(r.data||"","base64"),n.status=new eD.TransactionStatus(r.status),n.timestamp=r.timestamp||0,n.blockNonce=r.blockNonce||0,n.hyperblockNonce=r.hyperblockNonce||0,n.hyperblockHash=r.hyperblockHash||"",n.receipt=rD.TransactionReceipt.fromHttpResponse(r.receipt||{}),n.logs=tD.TransactionLogs.fromHttpResponse(r.logs||{}),n}getDateTime(){return new Date(this.timestamp*1e3)}};cf.TransactionOnNetwork=W3});var $3=L(Py=>{"use strict";h();Object.defineProperty(Py,"__esModule",{value:!0});Py.extendUserAgent=void 0;var nD=e0(),Kie=$h();function Wie(t,e){e.headers||(e.headers=new nD.AxiosHeaders({})),e.clientName||console.log("Can you please provide the client name of the application that uses the SDK? It will be used for metrics.");let r=nD.AxiosHeaders.from(e.headers).normalize(!0),n=e.clientName||Kie.UnknownClientName,i=r.hasUserAgent()?r.getUserAgent():"",s=i?`${i} ${t}/${n}`:`${t}/${n}`;r.setUserAgent(s,!0)}Py.extendUserAgent=Wie});var X3=L(uf=>{"use strict";h();var $ie=uf&&uf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uf,"__esModule",{value:!0});uf.ProxyNetworkProvider=void 0;var iD=$ie(e0()),sD=hy(),Yie=E3(),oD=$h(),Jie=gy(),Xie=jl(),Y3=my(),Zie=M3(),ese=B3(),aD=wy(),Ry=Ay(),n0=Oy(),tse=sf(),rse=$3(),J3=class{constructor(e,r){this.userAgentPrefix=`${oD.BaseUserAgent}/proxy`,this.url=e,this.config={...Yie.defaultAxiosConfig,...r},rse.extendUserAgent(this.userAgentPrefix,this.config)}async getNetworkConfig(){let e=await this.doGetGeneric("network/config");return Zie.NetworkConfig.fromHttpResponse(e.config)}async getNetworkStatus(){let e=await this.doGetGeneric("network/status/4294967295");return ese.NetworkStatus.fromHttpResponse(e.status)}async getNetworkStakeStatistics(){throw new Error("Method not implemented.")}async getNetworkGeneralStatistics(){throw new Error("Method not implemented.")}async getAccount(e){let r=await this.doGetGeneric(`address/${e.bech32()}`);return sD.AccountOnNetwork.fromHttpResponse(r.account)}async getGuardianData(e){let r=await this.doGetGeneric(`address/${e.bech32()}/guardian-data`);return sD.GuardianData.fromHttpResponse(r.guardianData)}async getFungibleTokensOfAccount(e,r){let n=`address/${e.bech32()}/esdt`,i=await this.doGetGeneric(n),c=Object.values(i.esdts).filter(a=>!a.nonce).map(a=>Ry.FungibleTokenOfAccountOnNetwork.fromHttpResponse(a));return c.sort((a,u)=>a.identifier.localeCompare(u.identifier)),c}async getNonFungibleTokensOfAccount(e,r){let n=`address/${e.bech32()}/esdt`,i=await this.doGetGeneric(n),c=Object.values(i.esdts).filter(a=>a.nonce>=0).map(a=>Ry.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponse(a));return c.sort((a,u)=>a.identifier.localeCompare(u.identifier)),c}async getFungibleTokenOfAccount(e,r){let n=await this.doGetGeneric(`address/${e.bech32()}/esdt/${r}`);return Ry.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n.tokenData)}async getNonFungibleTokenOfAccount(e,r,n){let i=await this.doGetGeneric(`address/${e.bech32()}/nft/${r}/nonce/${n.valueOf()}`);return Ry.NonFungibleTokenOfAccountOnNetwork.fromProxyHttpResponseByNonce(i.tokenData)}async getTransaction(e,r){let n;r===!0&&(n=this.getTransactionStatus(e));let i=this.buildUrlWithQueryParameters(`transaction/${e}`,{withResults:"true"}),s=await this.doGetGeneric(i);if(n){let o=await n;return n0.TransactionOnNetwork.fromProxyHttpResponse(e,s.transaction,o)}return n0.TransactionOnNetwork.fromProxyHttpResponse(e,s.transaction)}async getTransactionStatus(e){let r=await this.doGetGeneric(`transaction/${e}/process-status`);return new tse.TransactionStatus(r.status)}async sendTransaction(e){let r=n0.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transaction/send",r)).txHash}async sendTransactions(e){let r=e.map(s=>n0.prepareTransactionForBroadcasting(s)),n=await this.doPostGeneric("transaction/send-multiple",r),i=Array(e.length).fill(null);for(let s=0;s[r]})).getReturnDataParts()}async getDefinitionOfTokenCollection(e){let r=await this.getTokenProperties(e);return aD.DefinitionOfTokenCollectionOnNetwork.fromResponseOfGetTokenProperties(e,r)}async getNonFungibleToken(e,r){throw new Error("Method not implemented.")}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,r){return await this.doPost(e,r)}async doGet(e){let r=`${this.url}/${e}`;try{return(await iD.default.get(r,this.config)).data.data}catch(n){this.handleApiError(n,e)}}async doPost(e,r){let n=`${this.url}/${e}`;try{return(await iD.default.post(n,r,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data.data}catch(i){this.handleApiError(i,e)}}buildUrlWithQueryParameters(e,r){let n=new URLSearchParams;for(let[i,s]of Object.entries(r))s&&n.append(i,s);return`${e}?${n.toString()}`}handleApiError(e,r){if(!e.response)throw new Y3.ErrNetworkProvider(r,e.toString(),e);let n=e.response.data,i=n.message||n.error||JSON.stringify(n);throw new Y3.ErrNetworkProvider(r,i,e)}};uf.ProxyNetworkProvider=J3});var dD=L(lf=>{"use strict";h();var nse=lf&&lf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lf,"__esModule",{value:!0});lf.ApiNetworkProvider=void 0;var cD=nse(e0()),ise=hy(),My=E3(),sse=$h(),ose=gy(),ase=jl(),Z3=my(),cse=x3(),use=O3(),lse=K7(),uD=Ti(),fse=X3(),lD=wy(),i0=Ay(),fD=Oy(),dse=sf(),hse=$3(),e6=class{constructor(e,r){this.userAgentPrefix=`${sse.BaseUserAgent}/api`,this.url=e;let n=this.getProxyConfig(r);this.config={...My.defaultAxiosConfig,...r},this.backingProxyNetworkProvider=new fse.ProxyNetworkProvider(e,n),hse.extendUserAgent(this.userAgentPrefix,this.config)}getProxyConfig(e){let r=JSON.parse(JSON.stringify(e||{}));return r={...My.defaultAxiosConfig,...r},r}async getNetworkConfig(){return await this.backingProxyNetworkProvider.getNetworkConfig()}async getNetworkStatus(){return await this.backingProxyNetworkProvider.getNetworkStatus()}async getNetworkStakeStatistics(){let e=await this.doGetGeneric("stake");return use.NetworkStake.fromHttpResponse(e)}async getNetworkGeneralStatistics(){let e=await this.doGetGeneric("stats");return cse.NetworkGeneralStatistics.fromHttpResponse(e)}async getAccount(e){let r=await this.doGetGeneric(`accounts/${e.bech32()}`);return ise.AccountOnNetwork.fromHttpResponse(r)}async getGuardianData(e){return await this.backingProxyNetworkProvider.getGuardianData(e)}async getFungibleTokensOfAccount(e,r){r=r||My.defaultPagination;let n=`accounts/${e.bech32()}/tokens?${this.buildPaginationParams(r)}`,s=(await this.doGetGeneric(n)).map(o=>i0.FungibleTokenOfAccountOnNetwork.fromHttpResponse(o));return s.sort((o,c)=>o.identifier.localeCompare(c.identifier)),s}async getNonFungibleTokensOfAccount(e,r){r=r||My.defaultPagination;let n=`accounts/${e.bech32()}/nfts?${this.buildPaginationParams(r)}`,s=(await this.doGetGeneric(n)).map(o=>i0.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(o));return s.sort((o,c)=>o.identifier.localeCompare(c.identifier)),s}async getFungibleTokenOfAccount(e,r){let n=await this.doGetGeneric(`accounts/${e.bech32()}/tokens/${r}`);return i0.FungibleTokenOfAccountOnNetwork.fromHttpResponse(n)}async getNonFungibleTokenOfAccount(e,r,n){let i=new uD.Nonce(n).hex(),s=await this.doGetGeneric(`accounts/${e.bech32()}/nfts/${r}-${i}`);return i0.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(s)}async getMexPairs(e){let r="mex/pairs";return e&&(r=`${r}?from=${e.from}&size=${e.size}`),(await this.doGetGeneric(r)).map(i=>lse.PairOnNetwork.fromApiHttpResponse(i))}async getTransaction(e){let r=await this.doGetGeneric(`transactions/${e}`);return fD.TransactionOnNetwork.fromApiHttpResponse(e,r)}async getTransactionStatus(e){let r=await this.doGetGeneric(`transactions/${e}?fields=status`);return new dse.TransactionStatus(r.status)}async sendTransaction(e){let r=fD.prepareTransactionForBroadcasting(e);return(await this.doPostGeneric("transactions",r)).txHash}async sendTransactions(e){return await this.backingProxyNetworkProvider.sendTransactions(e)}async simulateTransaction(e){return await this.backingProxyNetworkProvider.simulateTransaction(e)}async queryContract(e){try{let r=new ose.ContractQueryRequest(e).toHttpRequest(),n=await this.doPostGeneric("query",r);return ase.ContractQueryResponse.fromHttpResponse(n)}catch(r){throw new Z3.ErrContractQuery(r)}}async getDefinitionOfFungibleToken(e){let r=await this.doGetGeneric(`tokens/${e}`);return lD.DefinitionOfFungibleTokenOnNetwork.fromApiHttpResponse(r)}async getDefinitionOfTokenCollection(e){let r=await this.doGetGeneric(`collections/${e}`);return lD.DefinitionOfTokenCollectionOnNetwork.fromApiHttpResponse(r)}async getNonFungibleToken(e,r){let n=new uD.Nonce(r).hex(),i=await this.doGetGeneric(`nfts/${e}-${n}`);return i0.NonFungibleTokenOfAccountOnNetwork.fromApiHttpResponse(i)}async doGetGeneric(e){return await this.doGet(e)}async doPostGeneric(e,r){return await this.doPost(e,r)}buildPaginationParams(e){return`from=${e.from}&size=${e.size}`}async doGet(e){let r=`${this.url}/${e}`;try{return(await cD.default.get(r,this.config)).data}catch(n){this.handleApiError(n,e)}}async doPost(e,r){let n=`${this.url}/${e}`;try{return(await cD.default.post(n,r,{...this.config,headers:{"Content-Type":"application/json",...this.config.headers}})).data}catch(i){this.handleApiError(i,e)}}handleApiError(e,r){if(!e.response)throw new Z3.ErrNetworkProvider(r,e.toString(),e);let n=e.response.data,i=n.message||n.error||JSON.stringify(n);throw new Z3.ErrNetworkProvider(r,i,e)}};lf.ApiNetworkProvider=e6});var mD=L(Ue=>{"use strict";h();Object.defineProperty(Ue,"__esModule",{value:!0});Ue.NetworkStatus=Ue.NetworkStake=Ue.NetworkGeneralStatistics=Ue.NetworkConfig=Ue.NonFungibleTokenOfAccountOnNetwork=Ue.FungibleTokenOfAccountOnNetwork=Ue.DefinitionOfTokenCollectionOnNetwork=Ue.DefinitionOfFungibleTokenOnNetwork=Ue.TransactionOnNetwork=Ue.TransactionStatus=Ue.TransactionReceipt=Ue.TransactionLogsOnNetwork=Ue.TransactionEventTopic=Ue.TransactionEventData=Ue.TransactionEventOnNetwork=Ue.ContractResults=Ue.ContractResultItem=Ue.ContractQueryResponse=Ue.AccountOnNetwork=Ue.ProxyNetworkProvider=Ue.ApiNetworkProvider=void 0;var pse=dD();Object.defineProperty(Ue,"ApiNetworkProvider",{enumerable:!0,get:function(){return pse.ApiNetworkProvider}});var gse=X3();Object.defineProperty(Ue,"ProxyNetworkProvider",{enumerable:!0,get:function(){return gse.ProxyNetworkProvider}});var mse=hy();Object.defineProperty(Ue,"AccountOnNetwork",{enumerable:!0,get:function(){return mse.AccountOnNetwork}});var yse=jl();Object.defineProperty(Ue,"ContractQueryResponse",{enumerable:!0,get:function(){return yse.ContractQueryResponse}});var hD=Iy();Object.defineProperty(Ue,"ContractResultItem",{enumerable:!0,get:function(){return hD.ContractResultItem}});Object.defineProperty(Ue,"ContractResults",{enumerable:!0,get:function(){return hD.ContractResults}});var t6=G3();Object.defineProperty(Ue,"TransactionEventOnNetwork",{enumerable:!0,get:function(){return t6.TransactionEvent}});Object.defineProperty(Ue,"TransactionEventData",{enumerable:!0,get:function(){return t6.TransactionEventData}});Object.defineProperty(Ue,"TransactionEventTopic",{enumerable:!0,get:function(){return t6.TransactionEventTopic}});var vse=t0();Object.defineProperty(Ue,"TransactionLogsOnNetwork",{enumerable:!0,get:function(){return vse.TransactionLogs}});var bse=xy();Object.defineProperty(Ue,"TransactionReceipt",{enumerable:!0,get:function(){return bse.TransactionReceipt}});var wse=sf();Object.defineProperty(Ue,"TransactionStatus",{enumerable:!0,get:function(){return wse.TransactionStatus}});var Ase=Oy();Object.defineProperty(Ue,"TransactionOnNetwork",{enumerable:!0,get:function(){return Ase.TransactionOnNetwork}});var pD=wy();Object.defineProperty(Ue,"DefinitionOfFungibleTokenOnNetwork",{enumerable:!0,get:function(){return pD.DefinitionOfFungibleTokenOnNetwork}});Object.defineProperty(Ue,"DefinitionOfTokenCollectionOnNetwork",{enumerable:!0,get:function(){return pD.DefinitionOfTokenCollectionOnNetwork}});var gD=Ay();Object.defineProperty(Ue,"FungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return gD.FungibleTokenOfAccountOnNetwork}});Object.defineProperty(Ue,"NonFungibleTokenOfAccountOnNetwork",{enumerable:!0,get:function(){return gD.NonFungibleTokenOfAccountOnNetwork}});var Ese=M3();Object.defineProperty(Ue,"NetworkConfig",{enumerable:!0,get:function(){return Ese.NetworkConfig}});var Sse=x3();Object.defineProperty(Ue,"NetworkGeneralStatistics",{enumerable:!0,get:function(){return Sse.NetworkGeneralStatistics}});var _se=O3();Object.defineProperty(Ue,"NetworkStake",{enumerable:!0,get:function(){return _se.NetworkStake}});var Tse=B3();Object.defineProperty(Ue,"NetworkStatus",{enumerable:!0,get:function(){return Tse.NetworkStatus}})});var $c=L(et=>{"use strict";h();var Ise=et&&et.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wt=et&&et.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ise(e,t,r)};Object.defineProperty(et,"__esModule",{value:!0});HM();Wt(Hl(),et);Wt(jM(),et);Wt(Nt(),et);Wt(U_(),et);Wt(Wp(),et);Wt(QM(),et);Wt(Ve(),et);Wt(WM(),et);Wt(YM(),et);Wt(XM(),et);Wt(ra(),et);Wt(Q1(),et);Wt(Vd(),et);Wt(ZM(),et);Wt(t7(),et);Wt(r7(),et);Wt(i7(),et);Wt(yi(),et);Wt(N_(),et);Wt(Sc(),et);Wt(Dn(),et);Wt(B1(),et);Wt(No(),et);Wt(W1(),et);Wt(v1(),et);Wt(D_(),et);Wt(fi(),et);Wt(mD(),et)});var yD=L(Oa=>{"use strict";h();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.ErrAccountNotConnected=Oa.ErrCannotSignSingleTransaction=Oa.Err=void 0;var s0=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Oa.Err=s0;var r6=class extends s0{constructor(){super("Cannot sign single transaction.")}};Oa.ErrCannotSignSingleTransaction=r6;var n6=class extends s0{constructor(){super("Account is not connected.")}};Oa.ErrAccountNotConnected=n6});var bD=L(Dy=>{"use strict";h();Object.defineProperty(Dy,"__esModule",{value:!0});Dy.Operation=void 0;var vD;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(vD||(Dy.Operation=vD={}))});var i6=L(ff=>{"use strict";h();var Yc=ff&&ff.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(ff,"__esModule",{value:!0});ff.ExtensionProvider=void 0;var wD=$c(),Cse=Dn(),AD=yD(),o0=bD(),a0=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Yc(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(){return Yc(this,arguments,void 0,function*(e={}){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(o0.Operation.Connect,n),this.account})}logout(){return Yc(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(o0.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 Yc(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!!this.account.address}getAccount(){return this.account}setAccount(e){this.account=e}signTransaction(e){return Yc(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new AD.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new AD.ErrAccountNotConnected}signTransactions(e){return Yc(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(o0.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>Cse.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Yc(this,void 0,void 0,function*(){var r;this.ensureConnected();let n={account:this.account.address,message:b.Buffer.from(e.data).toString()},s=(yield this.startBgrMsgChannel(o0.Operation.SignMessage,n)).signature,o=b.Buffer.from(s,"hex");return new wD.Message({data:b.Buffer.from(e.data),address:(r=e.address)!==null&&r!==void 0?r:wD.Address.fromBech32(this.account.address),signer:"extension",version:e.version,signature:o})})}cancelAction(){return this.startBgrMsgChannel(o0.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};ff.ExtensionProvider=a0;a0._instance=new a0});var df={};Zt(df,{__assign:()=>o6,__asyncDelegator:()=>kse,__asyncGenerator:()=>Use,__asyncValues:()=>Vse,__await:()=>c0,__awaiter:()=>Mse,__classPrivateFieldGet:()=>jse,__classPrivateFieldSet:()=>Qse,__createBinding:()=>Bse,__decorate:()=>Ose,__exportStar:()=>Lse,__extends:()=>xse,__generator:()=>Dse,__importDefault:()=>zse,__importStar:()=>Gse,__makeTemplateObject:()=>Hse,__metadata:()=>Rse,__param:()=>Pse,__read:()=>ID,__rest:()=>Nse,__spread:()=>Fse,__spreadArrays:()=>qse,__values:()=>a6});function xse(t,e){s6(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Nse(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;c--)(o=t[c])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Pse(t,e){return function(r,n){e(r,n,t)}}function Rse(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Mse(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})}function Dse(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(u){return function(f){return a([u,f])}}function a(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ID(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(c){o={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Fse(){for(var t=[],e=0;e1||c(S,I)})})}function c(S,I){try{a(n[S](I))}catch(N){p(s[0][3],N)}}function a(S){S.value instanceof c0?Promise.resolve(S.value.v).then(u,f):p(s[0][2],S)}function u(S){c("next",S)}function f(S){c("throw",S)}function p(S,I){S(I),s.shift(),s.length&&c(s[0][0],s[0][1])}}function kse(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:c0(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Vse(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof a6=="function"?a6(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,a){o=t[s](o),i(c,a,o.done,o.value)})}}function i(s,o,c,a){Promise.resolve(a).then(function(u){s({value:u,done:c})},o)}}function Hse(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Gse(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function zse(t){return t&&t.__esModule?t:{default:t}}function jse(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Qse(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var s6,o6,hf=pe(()=>{h();s6=function(t,e){return s6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},s6(t,e)};o6=function(){return o6=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";h();Object.defineProperty(qy,"__esModule",{value:!0});qy.delay=void 0;function Kse(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}qy.delay=Kse});var xD=L(pf=>{"use strict";h();Object.defineProperty(pf,"__esModule",{value:!0});pf.ONE_THOUSAND=pf.ONE_HUNDRED=void 0;pf.ONE_HUNDRED=100;pf.ONE_THOUSAND=1e3});var ND=L(fe=>{"use strict";h();Object.defineProperty(fe,"__esModule",{value:!0});fe.ONE_YEAR=fe.FOUR_WEEKS=fe.THREE_WEEKS=fe.TWO_WEEKS=fe.ONE_WEEK=fe.THIRTY_DAYS=fe.SEVEN_DAYS=fe.FIVE_DAYS=fe.THREE_DAYS=fe.ONE_DAY=fe.TWENTY_FOUR_HOURS=fe.TWELVE_HOURS=fe.SIX_HOURS=fe.THREE_HOURS=fe.ONE_HOUR=fe.SIXTY_MINUTES=fe.THIRTY_MINUTES=fe.TEN_MINUTES=fe.FIVE_MINUTES=fe.ONE_MINUTE=fe.SIXTY_SECONDS=fe.THIRTY_SECONDS=fe.TEN_SECONDS=fe.FIVE_SECONDS=fe.ONE_SECOND=void 0;fe.ONE_SECOND=1;fe.FIVE_SECONDS=5;fe.TEN_SECONDS=10;fe.THIRTY_SECONDS=30;fe.SIXTY_SECONDS=60;fe.ONE_MINUTE=fe.SIXTY_SECONDS;fe.FIVE_MINUTES=fe.ONE_MINUTE*5;fe.TEN_MINUTES=fe.ONE_MINUTE*10;fe.THIRTY_MINUTES=fe.ONE_MINUTE*30;fe.SIXTY_MINUTES=fe.ONE_MINUTE*60;fe.ONE_HOUR=fe.SIXTY_MINUTES;fe.THREE_HOURS=fe.ONE_HOUR*3;fe.SIX_HOURS=fe.ONE_HOUR*6;fe.TWELVE_HOURS=fe.ONE_HOUR*12;fe.TWENTY_FOUR_HOURS=fe.ONE_HOUR*24;fe.ONE_DAY=fe.TWENTY_FOUR_HOURS;fe.THREE_DAYS=fe.ONE_DAY*3;fe.FIVE_DAYS=fe.ONE_DAY*5;fe.SEVEN_DAYS=fe.ONE_DAY*7;fe.THIRTY_DAYS=fe.ONE_DAY*30;fe.ONE_WEEK=fe.SEVEN_DAYS;fe.TWO_WEEKS=fe.ONE_WEEK*2;fe.THREE_WEEKS=fe.ONE_WEEK*3;fe.FOUR_WEEKS=fe.ONE_WEEK*4;fe.ONE_YEAR=fe.ONE_DAY*365});var c6=L(Uy=>{"use strict";h();Object.defineProperty(Uy,"__esModule",{value:!0});var OD=(hf(),qe(df));OD.__exportStar(xD(),Uy);OD.__exportStar(ND(),Uy)});var RD=L(gf=>{"use strict";h();Object.defineProperty(gf,"__esModule",{value:!0});gf.fromMiliseconds=gf.toMiliseconds=void 0;var PD=c6();function Wse(t){return t*PD.ONE_THOUSAND}gf.toMiliseconds=Wse;function $se(t){return Math.floor(t/PD.ONE_THOUSAND)}gf.fromMiliseconds=$se});var DD=L(ky=>{"use strict";h();Object.defineProperty(ky,"__esModule",{value:!0});var MD=(hf(),qe(df));MD.__exportStar(CD(),ky);MD.__exportStar(RD(),ky)});var BD=L(u0=>{"use strict";h();Object.defineProperty(u0,"__esModule",{value:!0});u0.Watch=void 0;var Vy=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};u0.Watch=Vy;u0.default=Vy});var LD=L(Hy=>{"use strict";h();Object.defineProperty(Hy,"__esModule",{value:!0});Hy.IWatch=void 0;var u6=class{};Hy.IWatch=u6});var FD=L(l6=>{"use strict";h();Object.defineProperty(l6,"__esModule",{value:!0});var Yse=(hf(),qe(df));Yse.__exportStar(LD(),l6)});var yf=L(mf=>{"use strict";h();Object.defineProperty(mf,"__esModule",{value:!0});var Gy=(hf(),qe(df));Gy.__exportStar(DD(),mf);Gy.__exportStar(BD(),mf);Gy.__exportStar(FD(),mf);Gy.__exportStar(c6(),mf)});var l0,qD=pe(()=>{h();l0=class{}});var UD={};Zt(UD,{IEvents:()=>l0});var f6=pe(()=>{h();qD()});var HD={};Zt(HD,{HEARTBEAT_EVENTS:()=>VD,HEARTBEAT_INTERVAL:()=>d6,HeartBeat:()=>h6,IHeartBeat:()=>zy});var kD,jy,zy,d6,VD,h6,GD=pe(()=>{h();kD=ge(_o()),jy=ge(yf());f6();zy=class extends l0{constructor(e){super()}},d6=jy.FIVE_SECONDS,VD={pulse:"heartbeat_pulse"},h6=class t extends zy{constructor(e){super(e),this.events=new kD.EventEmitter,this.interval=d6,this.interval=e?.interval||d6}static async init(e){let r=new t(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,jy.toMiliseconds)(this.interval))}pulse(){this.events.emit(VD.pulse)}}});function eoe(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){toe(t);return}return e}function toe(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function f0(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Zse.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Jse.test(t)||Xse.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,eoe)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var Jse,Xse,Zse,zD=pe(()=>{h();Jse=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Xse=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Zse=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function roe(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Dr(t,...e){try{return roe(t(...e))}catch(r){return Promise.reject(r)}}function noe(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function ioe(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function d0(t){if(noe(t))return String(t);if(ioe(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return d0(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function jD(){if(typeof b.Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}function QD(t){if(typeof t=="string")return t;jD();let e=b.Buffer.from(t).toString("base64");return p6+e}function KD(t){return typeof t!="string"||!t.startsWith(p6)?t:(jD(),b.Buffer.from(t.slice(p6.length),"base64"))}function An(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function WD(...t){return An(t.join(":"))}function h0(t){return t=An(t),t?t+":":""}var p6,$D=pe(()=>{h();p6="base64:"});function XD(t={}){let e={mounts:{"":t.driver||ooe()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(let f of e.mountpoints)if(u.startsWith(f))return{base:f,relativeKey:u.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:u,driver:e.mounts[""]}},n=(u,f)=>e.mountpoints.filter(p=>p.startsWith(u)||f&&u.startsWith(p)).map(p=>({relativeBase:u.length>p.length?u.slice(p.length):void 0,mountpoint:p,driver:e.mounts[p]})),i=(u,f)=>{if(e.watching){f=An(f);for(let p of e.watchListeners)p(u,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let u in e.mounts)e.unwatch[u]=await YD(e.mounts[u],i,u)}},o=async()=>{if(e.watching){for(let u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},c=(u,f,p)=>{let S=new Map,I=N=>{let R=S.get(N.base);return R||(R={driver:N.driver,base:N.base,items:[]},S.set(N.base,R)),R};for(let N of u){let R=typeof N=="string",D=An(R?N:N.key),U=R?void 0:N.value,k=R||!N.options?f:{...f,...N.options},z=r(D);I(z).items.push({key:D,value:U,relativeKey:z.relativeKey,options:k})}return Promise.all([...S.values()].map(N=>p(N))).then(N=>N.flat())},a={hasItem(u,f={}){u=An(u);let{relativeKey:p,driver:S}=r(u);return Dr(S.hasItem,p,f)},getItem(u,f={}){u=An(u);let{relativeKey:p,driver:S}=r(u);return Dr(S.getItem,p,f).then(I=>f0(I))},getItems(u,f){return c(u,f,p=>p.driver.getItems?Dr(p.driver.getItems,p.items.map(S=>({key:S.relativeKey,options:S.options})),f).then(S=>S.map(I=>({key:WD(p.base,I.key),value:f0(I.value)}))):Promise.all(p.items.map(S=>Dr(p.driver.getItem,S.relativeKey,S.options).then(I=>({key:S.key,value:f0(I)})))))},getItemRaw(u,f={}){u=An(u);let{relativeKey:p,driver:S}=r(u);return S.getItemRaw?Dr(S.getItemRaw,p,f):Dr(S.getItem,p,f).then(I=>KD(I))},async setItem(u,f,p={}){if(f===void 0)return a.removeItem(u);u=An(u);let{relativeKey:S,driver:I}=r(u);I.setItem&&(await Dr(I.setItem,S,d0(f),p),I.watch||i("update",u))},async setItems(u,f){await c(u,f,async p=>{if(p.driver.setItems)return Dr(p.driver.setItems,p.items.map(S=>({key:S.relativeKey,value:d0(S.value),options:S.options})),f);p.driver.setItem&&await Promise.all(p.items.map(S=>Dr(p.driver.setItem,S.relativeKey,d0(S.value),S.options)))})},async setItemRaw(u,f,p={}){if(f===void 0)return a.removeItem(u,p);u=An(u);let{relativeKey:S,driver:I}=r(u);if(I.setItemRaw)await Dr(I.setItemRaw,S,f,p);else if(I.setItem)await Dr(I.setItem,S,QD(f),p);else return;I.watch||i("update",u)},async removeItem(u,f={}){typeof f=="boolean"&&(f={removeMeta:f}),u=An(u);let{relativeKey:p,driver:S}=r(u);S.removeItem&&(await Dr(S.removeItem,p,f),(f.removeMeta||f.removeMata)&&await Dr(S.removeItem,p+"$",f),S.watch||i("remove",u))},async getMeta(u,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),u=An(u);let{relativeKey:p,driver:S}=r(u),I=Object.create(null);if(S.getMeta&&Object.assign(I,await Dr(S.getMeta,p,f)),!f.nativeOnly){let N=await Dr(S.getItem,p+"$",f).then(R=>f0(R));N&&typeof N=="object"&&(typeof N.atime=="string"&&(N.atime=new Date(N.atime)),typeof N.mtime=="string"&&(N.mtime=new Date(N.mtime)),Object.assign(I,N))}return I},setMeta(u,f,p={}){return this.setItem(u+"$",f,p)},removeMeta(u,f={}){return this.removeItem(u+"$",f)},async getKeys(u,f={}){u=h0(u);let p=n(u,!0),S=[],I=[];for(let N of p){let R=await Dr(N.driver.getKeys,N.relativeBase,f);for(let D of R){let U=N.mountpoint+An(D);S.some(k=>U.startsWith(k))||I.push(U)}S=[N.mountpoint,...S.filter(D=>!D.startsWith(N.mountpoint))]}return u?I.filter(N=>N.startsWith(u)&&N[N.length-1]!=="$"):I.filter(N=>N[N.length-1]!=="$")},async clear(u,f={}){u=h0(u),await Promise.all(n(u,!1).map(async p=>{if(p.driver.clear)return Dr(p.driver.clear,p.relativeBase,f);if(p.driver.removeItem){let S=await p.driver.getKeys(p.relativeBase||"",f);return Promise.all(S.map(I=>p.driver.removeItem(I,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>JD(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,f){if(u=h0(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((p,S)=>S.length-p.length)),e.mounts[u]=f,e.watching&&Promise.resolve(YD(f,i,u)).then(p=>{e.unwatch[u]=p}).catch(console.error),a},async unmount(u,f=!0){u=h0(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u](),delete e.unwatch[u]),f&&await JD(e.mounts[u]),e.mountpoints=e.mountpoints.filter(p=>p!==u),delete e.mounts[u])},getMount(u=""){u=An(u)+":";let f=r(u);return{driver:f.driver,base:f.base}},getMounts(u="",f={}){return u=An(u),n(u,f.parents).map(S=>({driver:S.driver,base:S.mountpoint}))},keys:(u,f={})=>a.getKeys(u,f),get:(u,f={})=>a.getItem(u,f),set:(u,f,p={})=>a.setItem(u,f,p),has:(u,f={})=>a.hasItem(u,f),del:(u,f={})=>a.removeItem(u,f),remove:(u,f={})=>a.removeItem(u,f)};return a}function YD(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function JD(t){typeof t.dispose=="function"&&await Dr(t.dispose)}var soe,ooe,ZD=pe(()=>{h();zD();$D();soe="memory",ooe=()=>{let t=new Map;return{name:soe,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}}});function Jc(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function m6(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=Jc(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function p0(){return g6||(g6=m6("keyval-store","keyval")),g6}function y6(t,e=p0()){return e("readonly",r=>Jc(r.get(t)))}function e9(t,e,r=p0()){return r("readwrite",n=>(n.put(e,t),Jc(n.transaction)))}function t9(t,e=p0()){return e("readwrite",r=>(r.delete(t),Jc(r.transaction)))}function r9(t=p0()){return t("readwrite",e=>(e.clear(),Jc(e.transaction)))}function aoe(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Jc(t.transaction)}function n9(t=p0()){return t("readonly",e=>{if(e.getAllKeys)return Jc(e.getAllKeys());let r=[];return aoe(e,n=>r.push(n.key)).then(()=>r)})}var g6,i9=pe(()=>{h()});var s9={};Zt(s9,{safeJsonParse:()=>Ra,safeJsonStringify:()=>ns});function Ra(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return uoe(t)}catch{return t}}function ns(t){return typeof t=="string"?t:coe(t)||""}var coe,uoe,vf=pe(()=>{h();coe=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),uoe=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var a9={};Zt(a9,{KeyValueStorage:()=>A6,default:()=>A6});function poe(t){var e;return[t[0],Ra((e=t[1])!=null?e:"")]}var loe,foe,doe,hoe,b6,v6,Qy,w6,goe,o9,moe,yoe,A6,c9=pe(()=>{h();ZD();i9();vf();loe="idb-keyval",foe=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=m6(t.dbName,t.storeName)),{name:loe,options:t,async hasItem(i){return!(typeof await y6(r(i),n)>"u")},async getItem(i){return await y6(r(i),n)??null},setItem(i,s){return e9(r(i),s,n)},removeItem(i){return t9(r(i),n)},getKeys(){return n9(n)},clear(){return r9(n)}}},doe="WALLET_CONNECT_V2_INDEXED_DB",hoe="keyvaluestorage",b6=class{constructor(){this.indexedDb=XD({driver:foe({dbName:doe,storeName:hoe})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,ns(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},v6=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Qy={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof v6<"u"&&v6.localStorage?Qy.exports=v6.localStorage:typeof window<"u"&&window.localStorage?Qy.exports=window.localStorage:Qy.exports=new e})();w6=class{constructor(){this.localStorage=Qy.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(poe)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Ra(r)}async setItem(e,r){this.localStorage.setItem(e,ns(r))}async removeItem(e){this.localStorage.removeItem(e)}},goe="wc_storage_version",o9=1,moe=async(t,e,r)=>{let n=goe,i=await e.getItem(n);if(i&&i>=o9){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let c=s.shift();if(!c)continue;let a=c.toLowerCase();if(a.includes("wc@")||a.includes("walletconnect")||a.includes("wc_")||a.includes("wallet_connect")){let u=await t.getItem(c);await e.setItem(c,u),o.push(c)}}await e.setItem(n,o9),r(e),yoe(t,o)},yoe=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},A6=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new w6;this.storage=e;try{let r=new b6;moe(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var l9=L((y5e,u9)=>{"use strict";h();function voe(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}u9.exports=boe;function boe(t,e,r){var n=r&&r.stringify||voe,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var c=1;c-1?p:0,t.charCodeAt(I+1)){case 100:case 102:if(f>=a||e[f]==null)break;p=a||e[f]==null)break;p=a||e[f]===void 0)break;p",p=I+2,I++;break}u+=n(e[f]),p=I+2,I++;break;case 115:if(f>=a)break;p{"use strict";h();var f9=l9();p9.exports=Vs;var g0=Noe().console||{},woe={mapHttpRequest:Ky,mapHttpResponse:Ky,wrapRequestSerializer:E6,wrapResponseSerializer:E6,wrapErrorSerializer:E6,req:Ky,res:Ky,err:Toe};function Aoe(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Vs(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||g0;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=Aoe(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let c=t.level||"info",a=Object.create(r);a.log||(a.log=m0),Object.defineProperty(a,"levelVal",{get:f}),Object.defineProperty(a,"level",{get:p,set:S});let u={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:Ioe(t)};a.levels=Vs.levels,a.level=c,a.setMaxListeners=a.getMaxListeners=a.emit=a.addListener=a.on=a.prependListener=a.once=a.prependOnceListener=a.removeListener=a.removeAllListeners=a.listeners=a.listenerCount=a.eventNames=a.write=a.flush=m0,a.serializers=n,a._serialize=i,a._stdErrSerialize=s,a.child=I,e&&(a._logEvent=S6());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function p(){return this._level}function S(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,bf(u,a,"error","log"),bf(u,a,"fatal","error"),bf(u,a,"warn","error"),bf(u,a,"info","log"),bf(u,a,"debug","log"),bf(u,a,"trace","log")}function I(N,R){if(!N)throw new Error("missing bindings for child Pino");R=R||{},i&&N.serializers&&(R.serializers=N.serializers);let D=R.serializers;if(i&&D){var U=Object.assign({},n,D),k=t.browser.serialize===!0?Object.keys(U):i;delete N.serializers,Wy([N],k,U,this._stdErrSerialize)}function z(H){this._childLevel=(H._childLevel|0)+1,this.error=wf(H,N,"error"),this.fatal=wf(H,N,"fatal"),this.warn=wf(H,N,"warn"),this.info=wf(H,N,"info"),this.debug=wf(H,N,"debug"),this.trace=wf(H,N,"trace"),U&&(this.serializers=U,this._serialize=k),e&&(this._logEvent=S6([].concat(H._logEvent.bindings,N)))}return z.prototype=this,new z(this)}return a}Vs.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"}};Vs.stdSerializers=woe;Vs.stdTimeFunctions=Object.assign({},{nullTime:d9,epochTime:h9,unixTime:Coe,isoTime:xoe});function bf(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?m0:i[r]?i[r]:g0[r]||g0[n]||m0,Eoe(t,e,r)}function Eoe(t,e,r){!t.transmit&&e[r]===m0||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===g0?g0:this;for(var a=0;a-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function wf(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;iZy,PINO_CUSTOM_CONTEXT_KEY:()=>Af,PINO_LOGGER_DEFAULTS:()=>v9,formatChildLoggerContext:()=>E9,generateChildLogger:()=>Loe,generateClientLogger:()=>S9,generatePlatformLogger:()=>Foe,generateServerLogger:()=>_9,getBrowserLoggerContext:()=>b9,getDefaultLoggerOptions:()=>Boe,getLoggerContext:()=>A9,pino:()=>y9.default,setBrowserLoggerContext:()=>w9});function Boe(t){return Xy(Jy({},t),{level:t?.level||v9.level})}function b9(t,e=Af){return t[e]||""}function w9(t,e,r=Af){return t[r]=e,t}function A9(t,e=Af){let r="";return typeof t.bindings>"u"?r=b9(t,e):r=t.bindings().context||"",r}function E9(t,e,r=Af){let n=A9(t,r);return n.trim()?`${n}/${e}`:e}function Loe(t,e,r=Af){let n=E9(t,e,r),i=t.child({context:n});return w9(i,n,r)}function S9(t){var e,r;let n=new I6((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Ro.default)(Xy(Jy({},t.opts),{level:"trace",browser:Xy(Jy({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function _9(t){var e;let r=new C6((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:(0,Ro.default)(Xy(Jy({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function Foe(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?S9(t):_9(t)}var Ro,y9,v9,Af,Zy,T6,$y,Yy,I6,C6,Ooe,Poe,Roe,g9,Moe,Doe,m9,Jy,Xy,N6=pe(()=>{h();Ro=ge(_6()),y9=ge(_6());vf();v9={level:"info"},Af="custom_context",Zy=1e3*1024,T6=class{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},$y=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let r=new T6(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};let r=e.value;return e=e.next,{done:!1,value:r}}}}},Yy=class{constructor(e,r=Zy){this.level=e??"error",this.levelValue=Ro.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new $y(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Ro.levels.values.error?console.error(e):r===Ro.levels.values.warn?console.warn(e):r===Ro.levels.values.debug?console.debug(e):r===Ro.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(ns({timestamp:new Date().toISOString(),log:e}));let r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new $y(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let r=this.getLogArray();return r.push(ns({extraMetadata:e})),new Blob(r,{type:"application/json"})}},I6=class{constructor(e,r=Zy){this.baseChunkLogger=new Yy(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){let r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},C6=class{constructor(e,r=Zy){this.baseChunkLogger=new Yy(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}},Ooe=Object.defineProperty,Poe=Object.defineProperties,Roe=Object.getOwnPropertyDescriptors,g9=Object.getOwnPropertySymbols,Moe=Object.prototype.hasOwnProperty,Doe=Object.prototype.propertyIsEnumerable,m9=(t,e,r)=>e in t?Ooe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jy=(t,e)=>{for(var r in e||(e={}))Moe.call(e,r)&&m9(t,r,e[r]);if(g9)for(var r of g9(e))Doe.call(e,r)&&m9(t,r,e[r]);return t},Xy=(t,e)=>Poe(t,Roe(e))});var $6=L(Tr=>{"use strict";h();Object.defineProperty(Tr,"__esModule",{value:!0});var Ef=(f6(),qe(UD)),T9=_o();function qoe(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var Uoe=qoe(T9),O6=class extends Ef.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},P6=class{constructor(e,r,n){this.core=e,this.logger=r}},R6=class extends Ef.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},M6=class{constructor(e,r){this.logger=e,this.core=r}},D6=class extends Ef.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},B6=class extends Ef.IEvents{constructor(e){super()}},L6=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},F6=class{constructor(){this.map=new Map}},q6=class extends Ef.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},U6=class{constructor(e,r){this.core=e,this.logger=r}},k6=class extends Ef.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},V6=class{constructor(e,r){this.logger=e,this.core=r}},H6=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},G6=class{constructor(e,r){this.projectId=e,this.logger=r}},z6=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},j6=class extends Uoe.default{constructor(){super()}},Q6=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},K6=class extends T9.EventEmitter{constructor(){super()}},W6=class{constructor(e){this.client=e}};Tr.ICore=O6,Tr.ICrypto=P6,Tr.IEchoClient=G6,Tr.IEngine=W6,Tr.IEngineEvents=K6,Tr.IEventClient=z6,Tr.IExpirer=k6,Tr.IJsonRpcHistory=R6,Tr.IKeyChain=U6,Tr.IMessageTracker=M6,Tr.IPairing=V6,Tr.IPublisher=D6,Tr.IRelayer=B6,Tr.ISignClient=Q6,Tr.ISignClientEvents=j6,Tr.IStore=L6,Tr.ISubscriber=q6,Tr.ISubscriberTopicMap=F6,Tr.IVerify=H6});var C9=L(ev=>{"use strict";h();Object.defineProperty(ev,"__esModule",{value:!0});ev.BrowserRandomSource=void 0;var I9=65536,Y6=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";h();Object.defineProperty(J6,"__esModule",{value:!0});function koe(t){for(var e=0;e{h()});var x9=L(tv=>{"use strict";h();Object.defineProperty(tv,"__esModule",{value:!0});tv.NodeRandomSource=void 0;var Voe=Ci(),Z6=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Mp<"u"){let e=X6();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";h();Object.defineProperty(rv,"__esModule",{value:!0});rv.SystemRandomSource=void 0;var Hoe=C9(),Goe=x9(),eT=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Hoe.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Goe.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)}};rv.SystemRandomSource=eT});var O9=L(Jn=>{"use strict";h();Object.defineProperty(Jn,"__esModule",{value:!0});function zoe(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}Jn.mul=Math.imul||zoe;function joe(t,e){return t+e|0}Jn.add=joe;function Qoe(t,e){return t-e|0}Jn.sub=Qoe;function Koe(t,e){return t<>>32-e}Jn.rotl=Koe;function Woe(t,e){return t<<32-e|t>>>e}Jn.rotr=Woe;function $oe(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Jn.isInteger=Number.isInteger||$oe;Jn.MAX_SAFE_INTEGER=9007199254740991;Jn.isSafeInteger=function(t){return Jn.isInteger(t)&&t>=-Jn.MAX_SAFE_INTEGER&&t<=Jn.MAX_SAFE_INTEGER}});var Sf=L(We=>{"use strict";h();Object.defineProperty(We,"__esModule",{value:!0});var P9=O9();function Yoe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}We.readInt16BE=Yoe;function Joe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}We.readUint16BE=Joe;function Xoe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}We.readInt16LE=Xoe;function Zoe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}We.readUint16LE=Zoe;function R9(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}We.writeUint16BE=R9;We.writeInt16BE=R9;function M9(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}We.writeUint16LE=M9;We.writeInt16LE=M9;function tT(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}We.readInt32BE=tT;function rT(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}We.readUint32BE=rT;function nT(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}We.readInt32LE=nT;function iT(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}We.readUint32LE=iT;function nv(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}We.writeUint32BE=nv;We.writeInt32BE=nv;function iv(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}We.writeUint32LE=iv;We.writeInt32LE=iv;function eae(t,e){e===void 0&&(e=0);var r=tT(t,e),n=tT(t,e+4);return r*4294967296+n-(n>>31)*4294967296}We.readInt64BE=eae;function tae(t,e){e===void 0&&(e=0);var r=rT(t,e),n=rT(t,e+4);return r*4294967296+n}We.readUint64BE=tae;function rae(t,e){e===void 0&&(e=0);var r=nT(t,e),n=nT(t,e+4);return n*4294967296+r-(r>>31)*4294967296}We.readInt64LE=rae;function nae(t,e){e===void 0&&(e=0);var r=iT(t,e),n=iT(t,e+4);return n*4294967296+r}We.readUint64LE=nae;function D9(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),nv(t/4294967296>>>0,e,r),nv(t>>>0,e,r+4),e}We.writeUint64BE=D9;We.writeInt64BE=D9;function B9(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),iv(t>>>0,e,r),iv(t/4294967296>>>0,e,r+4),e}We.writeUint64LE=B9;We.writeInt64LE=B9;function iae(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}We.readUintBE=iae;function sae(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}We.writeUintBE=oae;function aae(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!P9.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";h();Object.defineProperty(hn,"__esModule",{value:!0});hn.randomStringForEntropy=hn.randomString=hn.randomUint32=hn.randomBytes=hn.defaultRandomSource=void 0;var mae=N9(),yae=Sf(),L9=Ci();hn.defaultRandomSource=new mae.SystemRandomSource;function sT(t,e=hn.defaultRandomSource){return e.randomBytes(t)}hn.randomBytes=sT;function vae(t=hn.defaultRandomSource){let e=sT(4,t),r=(0,yae.readUint32LE)(e);return(0,L9.wipe)(e),r}hn.randomUint32=vae;var F9="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function q9(t,e=F9,r=hn.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=sT(Math.ceil(t*256/s),r);for(let c=0;c0;c++){let a=o[c];a{"use strict";h();Object.defineProperty(Mo,"__esModule",{value:!0});var Tf=Sf(),_f=Ci();Mo.DIGEST_LENGTH=64;Mo.BLOCK_SIZE=128;var k9=function(){function t(){this.digestLength=Mo.DIGEST_LENGTH,this.blockSize=Mo.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){_f.wipe(this._buffer),_f.wipe(this._tempHi),_f.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(oT(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=oT(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){_f.wipe(e.stateHi),_f.wipe(e.stateLo),e.buffer&&_f.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Mo.SHA512=k9;var U9=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 oT(t,e,r,n,i,s,o){for(var c=r[0],a=r[1],u=r[2],f=r[3],p=r[4],S=r[5],I=r[6],N=r[7],R=n[0],D=n[1],U=n[2],k=n[3],z=n[4],H=n[5],F=n[6],V=n[7],q,C,B,x,g,v,l,d;o>=128;){for(var m=0;m<16;m++){var w=8*m+s;t[m]=Tf.readUint32BE(i,w),e[m]=Tf.readUint32BE(i,w+4)}for(var m=0;m<80;m++){var _=c,A=a,y=u,T=f,E=p,M=S,W=I,Y=N,P=R,G=D,Q=U,$=k,ee=z,ie=H,X=F,re=V;if(q=N,C=V,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=(p>>>14|z<<18)^(p>>>18|z<<14)^(z>>>9|p<<23),C=(z>>>14|p<<18)^(z>>>18|p<<14)^(p>>>9|z<<23),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=p&S^~p&I,C=z&H^~z&F,g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=U9[m*2],C=U9[m*2+1],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=t[m%16],C=e[m%16],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,B=l&65535|d<<16,x=g&65535|v<<16,q=B,C=x,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=(c>>>28|R<<4)^(R>>>2|c<<30)^(R>>>7|c<<25),C=(R>>>28|c<<4)^(c>>>2|R<<30)^(c>>>7|R<<25),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,q=c&a^c&u^a&u,C=R&D^R&U^D&U,g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,Y=l&65535|d<<16,re=g&65535|v<<16,q=T,C=$,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=B,C=x,g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,T=l&65535|d<<16,$=g&65535|v<<16,a=_,u=A,f=y,p=T,S=E,I=M,N=W,c=Y,D=P,U=G,k=Q,z=$,H=ee,F=ie,V=X,R=re,m%16===15)for(var w=0;w<16;w++)q=t[w],C=e[w],g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=t[(w+9)%16],C=e[(w+9)%16],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,B=t[(w+1)%16],x=e[(w+1)%16],q=(B>>>1|x<<31)^(B>>>8|x<<24)^B>>>7,C=(x>>>1|B<<31)^(x>>>8|B<<24)^(x>>>7|B<<25),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,B=t[(w+14)%16],x=e[(w+14)%16],q=(B>>>19|x<<13)^(x>>>29|B<<3)^B>>>6,C=(x>>>19|B<<13)^(B>>>29|x<<3)^(x>>>6|B<<26),g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,t[w]=l&65535|d<<16,e[w]=g&65535|v<<16}q=c,C=R,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[0],C=n[0],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[0]=c=l&65535|d<<16,n[0]=R=g&65535|v<<16,q=a,C=D,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[1],C=n[1],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[1]=a=l&65535|d<<16,n[1]=D=g&65535|v<<16,q=u,C=U,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[2],C=n[2],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[2]=u=l&65535|d<<16,n[2]=U=g&65535|v<<16,q=f,C=k,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[3],C=n[3],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[3]=f=l&65535|d<<16,n[3]=k=g&65535|v<<16,q=p,C=z,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[4],C=n[4],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[4]=p=l&65535|d<<16,n[4]=z=g&65535|v<<16,q=S,C=H,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[5],C=n[5],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[5]=S=l&65535|d<<16,n[5]=H=g&65535|v<<16,q=I,C=F,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[6],C=n[6],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[6]=I=l&65535|d<<16,n[6]=F=g&65535|v<<16,q=N,C=V,g=C&65535,v=C>>>16,l=q&65535,d=q>>>16,q=r[7],C=n[7],g+=C&65535,v+=C>>>16,l+=q&65535,d+=q>>>16,v+=g>>>16,l+=v>>>16,d+=l>>>16,r[7]=N=l&65535|d<<16,n[7]=V=g&65535|v<<16,s+=128,o-=128}return s}function wae(t){var e=new k9;e.update(t);var r=e.digest();return e.clean(),r}Mo.hash=wae});var tB=L(kt=>{"use strict";h();Object.defineProperty(kt,"__esModule",{value:!0});kt.convertSecretKeyToX25519=kt.convertPublicKeyToX25519=kt.verify=kt.sign=kt.extractPublicKeyFromSecretKey=kt.generateKeyPair=kt.generateKeyPairFromSeed=kt.SEED_LENGTH=kt.SECRET_KEY_LENGTH=kt.PUBLIC_KEY_LENGTH=kt.SIGNATURE_LENGTH=void 0;var Aae=y0(),v0=V9(),Q9=Ci();kt.SIGNATURE_LENGTH=64;kt.PUBLIC_KEY_LENGTH=32;kt.SECRET_KEY_LENGTH=64;kt.SEED_LENGTH=32;function Ae(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,K9(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function W9(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function z9(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return b0(r,t),b0(n,e),W9(r,n)}function $9(t){let e=new Uint8Array(32);return b0(e,t),e[0]&1}function Iae(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Xc(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function eu(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function $t(t,e,r){let n,i,s=0,o=0,c=0,a=0,u=0,f=0,p=0,S=0,I=0,N=0,R=0,D=0,U=0,k=0,z=0,H=0,F=0,V=0,q=0,C=0,B=0,x=0,g=0,v=0,l=0,d=0,m=0,w=0,_=0,A=0,y=0,T=r[0],E=r[1],M=r[2],W=r[3],Y=r[4],P=r[5],G=r[6],Q=r[7],$=r[8],ee=r[9],ie=r[10],X=r[11],re=r[12],ae=r[13],Z=r[14],oe=r[15];n=e[0],s+=n*T,o+=n*E,c+=n*M,a+=n*W,u+=n*Y,f+=n*P,p+=n*G,S+=n*Q,I+=n*$,N+=n*ee,R+=n*ie,D+=n*X,U+=n*re,k+=n*ae,z+=n*Z,H+=n*oe,n=e[1],o+=n*T,c+=n*E,a+=n*M,u+=n*W,f+=n*Y,p+=n*P,S+=n*G,I+=n*Q,N+=n*$,R+=n*ee,D+=n*ie,U+=n*X,k+=n*re,z+=n*ae,H+=n*Z,F+=n*oe,n=e[2],c+=n*T,a+=n*E,u+=n*M,f+=n*W,p+=n*Y,S+=n*P,I+=n*G,N+=n*Q,R+=n*$,D+=n*ee,U+=n*ie,k+=n*X,z+=n*re,H+=n*ae,F+=n*Z,V+=n*oe,n=e[3],a+=n*T,u+=n*E,f+=n*M,p+=n*W,S+=n*Y,I+=n*P,N+=n*G,R+=n*Q,D+=n*$,U+=n*ee,k+=n*ie,z+=n*X,H+=n*re,F+=n*ae,V+=n*Z,q+=n*oe,n=e[4],u+=n*T,f+=n*E,p+=n*M,S+=n*W,I+=n*Y,N+=n*P,R+=n*G,D+=n*Q,U+=n*$,k+=n*ee,z+=n*ie,H+=n*X,F+=n*re,V+=n*ae,q+=n*Z,C+=n*oe,n=e[5],f+=n*T,p+=n*E,S+=n*M,I+=n*W,N+=n*Y,R+=n*P,D+=n*G,U+=n*Q,k+=n*$,z+=n*ee,H+=n*ie,F+=n*X,V+=n*re,q+=n*ae,C+=n*Z,B+=n*oe,n=e[6],p+=n*T,S+=n*E,I+=n*M,N+=n*W,R+=n*Y,D+=n*P,U+=n*G,k+=n*Q,z+=n*$,H+=n*ee,F+=n*ie,V+=n*X,q+=n*re,C+=n*ae,B+=n*Z,x+=n*oe,n=e[7],S+=n*T,I+=n*E,N+=n*M,R+=n*W,D+=n*Y,U+=n*P,k+=n*G,z+=n*Q,H+=n*$,F+=n*ee,V+=n*ie,q+=n*X,C+=n*re,B+=n*ae,x+=n*Z,g+=n*oe,n=e[8],I+=n*T,N+=n*E,R+=n*M,D+=n*W,U+=n*Y,k+=n*P,z+=n*G,H+=n*Q,F+=n*$,V+=n*ee,q+=n*ie,C+=n*X,B+=n*re,x+=n*ae,g+=n*Z,v+=n*oe,n=e[9],N+=n*T,R+=n*E,D+=n*M,U+=n*W,k+=n*Y,z+=n*P,H+=n*G,F+=n*Q,V+=n*$,q+=n*ee,C+=n*ie,B+=n*X,x+=n*re,g+=n*ae,v+=n*Z,l+=n*oe,n=e[10],R+=n*T,D+=n*E,U+=n*M,k+=n*W,z+=n*Y,H+=n*P,F+=n*G,V+=n*Q,q+=n*$,C+=n*ee,B+=n*ie,x+=n*X,g+=n*re,v+=n*ae,l+=n*Z,d+=n*oe,n=e[11],D+=n*T,U+=n*E,k+=n*M,z+=n*W,H+=n*Y,F+=n*P,V+=n*G,q+=n*Q,C+=n*$,B+=n*ee,x+=n*ie,g+=n*X,v+=n*re,l+=n*ae,d+=n*Z,m+=n*oe,n=e[12],U+=n*T,k+=n*E,z+=n*M,H+=n*W,F+=n*Y,V+=n*P,q+=n*G,C+=n*Q,B+=n*$,x+=n*ee,g+=n*ie,v+=n*X,l+=n*re,d+=n*ae,m+=n*Z,w+=n*oe,n=e[13],k+=n*T,z+=n*E,H+=n*M,F+=n*W,V+=n*Y,q+=n*P,C+=n*G,B+=n*Q,x+=n*$,g+=n*ee,v+=n*ie,l+=n*X,d+=n*re,m+=n*ae,w+=n*Z,_+=n*oe,n=e[14],z+=n*T,H+=n*E,F+=n*M,V+=n*W,q+=n*Y,C+=n*P,B+=n*G,x+=n*Q,g+=n*$,v+=n*ee,l+=n*ie,d+=n*X,m+=n*re,w+=n*ae,_+=n*Z,A+=n*oe,n=e[15],H+=n*T,F+=n*E,V+=n*M,q+=n*W,C+=n*Y,B+=n*P,x+=n*G,g+=n*Q,v+=n*$,l+=n*ee,d+=n*ie,m+=n*X,w+=n*re,_+=n*ae,A+=n*Z,y+=n*oe,s+=38*F,o+=38*V,c+=38*q,a+=38*C,u+=38*B,f+=38*x,p+=38*g,S+=38*v,I+=38*l,N+=38*d,R+=38*m,D+=38*w,U+=38*_,k+=38*A,z+=38*y,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=c,t[3]=a,t[4]=u,t[5]=f,t[6]=p,t[7]=S,t[8]=I,t[9]=N,t[10]=R,t[11]=D,t[12]=U,t[13]=k,t[14]=z,t[15]=H}function Zc(t,e){$t(t,e,e)}function Y9(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Zc(r,r),n!==2&&n!==4&&$t(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function Cae(t,e){let r=Ae(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Zc(r,r),n!==1&&$t(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function lT(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),c=Ae(),a=Ae(),u=Ae(),f=Ae();eu(r,t[1],t[0]),eu(f,e[1],e[0]),$t(r,r,f),Xc(n,t[0],t[1]),Xc(f,e[0],e[1]),$t(n,n,f),$t(i,t[3],e[3]),$t(i,i,_ae),$t(s,t[2],e[2]),Xc(s,s,s),eu(o,n,r),eu(c,s,i),Xc(a,s,i),Xc(u,n,r),$t(t[0],o,c),$t(t[1],u,a),$t(t[2],a,c),$t(t[3],o,u)}function j9(t,e,r){for(let n=0;n<4;n++)K9(t[n],e[n],r)}function dT(t,e){let r=Ae(),n=Ae(),i=Ae();Y9(i,e[2]),$t(r,e[0],i),$t(n,e[1],i),b0(t,n),t[31]^=$9(r)<<7}function J9(t,e,r){Ma(t[0],uT),Ma(t[1],If),Ma(t[2],If),Ma(t[3],uT);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;j9(t,e,i),lT(e,t),lT(t,t),j9(t,e,i)}}function hT(t,e){let r=[Ae(),Ae(),Ae(),Ae()];Ma(r[0],H9),Ma(r[1],G9),Ma(r[2],If),$t(r[3],H9,G9),J9(t,r,e)}function X9(t){if(t.length!==kt.SEED_LENGTH)throw new Error(`ed25519: seed must be ${kt.SEED_LENGTH} bytes`);let e=(0,v0.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ae(),Ae(),Ae(),Ae()];hT(n,e),dT(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}kt.generateKeyPairFromSeed=X9;function xae(t){let e=(0,Aae.randomBytes)(32,t),r=X9(e);return(0,Q9.wipe)(e),r}kt.generateKeyPair=xae;function Nae(t){if(t.length!==kt.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${kt.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}kt.extractPublicKeyFromSecretKey=Nae;var cT=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 Z9(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*cT[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*cT[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function fT(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;Z9(t,e)}function Oae(t,e){let r=new Float64Array(64),n=[Ae(),Ae(),Ae(),Ae()],i=(0,v0.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new v0.SHA512;o.update(s.subarray(32)),o.update(e);let c=o.digest();o.clean(),fT(c),hT(n,c),dT(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let a=o.digest();fT(a);for(let u=0;u<32;u++)r[u]=c[u];for(let u=0;u<32;u++)for(let f=0;f<32;f++)r[u+f]+=a[u]*i[f];return Z9(s.subarray(32),r),s}kt.sign=Oae;function eB(t,e){let r=Ae(),n=Ae(),i=Ae(),s=Ae(),o=Ae(),c=Ae(),a=Ae();return Ma(t[2],If),Iae(t[1],e),Zc(i,t[1]),$t(s,i,Sae),eu(i,i,t[2]),Xc(s,t[2],s),Zc(o,s),Zc(c,o),$t(a,c,o),$t(r,a,i),$t(r,r,s),Cae(r,r),$t(r,r,i),$t(r,r,s),$t(r,r,s),$t(t[0],r,s),Zc(n,t[0]),$t(n,n,s),z9(n,i)&&$t(t[0],t[0],Tae),Zc(n,t[0]),$t(n,n,s),z9(n,i)?-1:($9(t[0])===e[31]>>7&&eu(t[0],uT,t[0]),$t(t[3],t[0],t[1]),0)}function Pae(t,e,r){let n=new Uint8Array(32),i=[Ae(),Ae(),Ae(),Ae()],s=[Ae(),Ae(),Ae(),Ae()];if(r.length!==kt.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${kt.SIGNATURE_LENGTH} bytes`);if(eB(s,t))return!1;let o=new v0.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let c=o.digest();return fT(c),J9(i,s,c),hT(s,r.subarray(32)),lT(i,s),dT(n,i),!W9(r,n)}kt.verify=Pae;function Rae(t){let e=[Ae(),Ae(),Ae(),Ae()];if(eB(e,t))throw new Error("Ed25519: invalid public key");let r=Ae(),n=Ae(),i=e[1];Xc(r,If,i),eu(n,If,i),Y9(n,n),$t(r,r,n);let s=new Uint8Array(32);return b0(s,r),s}kt.convertPublicKeyToX25519=Rae;function Mae(t){let e=(0,v0.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,Q9.wipe)(e),r}kt.convertSecretKeyToX25519=Mae});var sv,ov,tu,Cf,av,w0,cv,uv,lv,xf,fv,dv,rB,nB,hv=pe(()=>{h();sv="EdDSA",ov="JWT",tu=".",Cf="base64url",av="utf8",w0="utf8",cv=":",uv="did",lv="key",xf="base58btc",fv="z",dv="K36",rB=32,nB=32});function Nf(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}var pv=pe(()=>{h()});function gv(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Nf(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var pT=pe(()=>{h();pv()});function Dae(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,H=new Uint8Array(z);U!==k;){for(var F=N[U],V=0,q=z-1;(F!==0||V>>0,H[q]=F%c>>>0,F=F/c>>>0;if(F!==0)throw new Error("Non-zero carry");D=V,U++}for(var C=z-D;C!==z&&H[C]===0;)C++;for(var B=a.repeat(R);C>>0,z=new Uint8Array(k);N[R];){var H=r[N.charCodeAt(R)];if(H===255)return;for(var F=0,V=k-1;(H!==0||F>>0,z[V]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");U=F,R++}if(N[R]!==" "){for(var q=k-U;q!==k&&z[q]===0;)q++;for(var C=new Uint8Array(D+(k-q)),B=D;q!==k;)C[B++]=z[q++];return C}}}function I(N){var R=S(N);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:S,decode:I}}var Bae,Lae,iB,sB=pe(()=>{h();Bae=Dae,Lae=Bae,iB=Lae});var rCe,oB,Do,aB,cB,Da=pe(()=>{h();rCe=new Uint8Array(0),oB=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aB=t=>new TextEncoder().encode(t),cB=t=>new TextDecoder().decode(t)});var gT,mT,yT,lB,vT,Of,Ba,Fae,qae,gr,is=pe(()=>{h();sB();Da();gT=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},mT=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return lB(this,e)}},yT=class{constructor(e){this.decoders=e}or(e){return lB(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},lB=(t,e)=>new yT({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),vT=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new gT(e,r,n),this.decoder=new mT(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Of=({name:t,prefix:e,encode:r,decode:n})=>new vT(t,e,r,n),Ba=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=iB(r,e);return Of({prefix:t,name:e,encode:n,decode:s=>Do(i(s))})},Fae=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(c-=8,o[u++]=255&a>>c)}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return o},qae=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&c>>o];if(o&&(s+=e[i&c<Of({prefix:e,name:t,encode(i){return qae(i,n,r)},decode(i){return Fae(i,n,r,t)}})});var bT={};Zt(bT,{identity:()=>Uae});var Uae,fB=pe(()=>{h();is();Da();Uae=Of({prefix:"\0",name:"identity",encode:t=>cB(t),decode:t=>aB(t)})});var wT={};Zt(wT,{base2:()=>kae});var kae,dB=pe(()=>{h();is();kae=gr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var AT={};Zt(AT,{base8:()=>Vae});var Vae,hB=pe(()=>{h();is();Vae=gr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var ET={};Zt(ET,{base10:()=>Hae});var Hae,pB=pe(()=>{h();is();Hae=Ba({prefix:"9",name:"base10",alphabet:"0123456789"})});var ST={};Zt(ST,{base16:()=>Gae,base16upper:()=>zae});var Gae,zae,gB=pe(()=>{h();is();Gae=gr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),zae=gr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var _T={};Zt(_T,{base32:()=>Pf,base32hex:()=>Wae,base32hexpad:()=>Yae,base32hexpadupper:()=>Jae,base32hexupper:()=>$ae,base32pad:()=>Qae,base32padupper:()=>Kae,base32upper:()=>jae,base32z:()=>Xae});var Pf,jae,Qae,Kae,Wae,$ae,Yae,Jae,Xae,TT=pe(()=>{h();is();Pf=gr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),jae=gr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Qae=gr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Kae=gr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Wae=gr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$ae=gr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Yae=gr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Jae=gr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Xae=gr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var IT={};Zt(IT,{base36:()=>Zae,base36upper:()=>ece});var Zae,ece,mB=pe(()=>{h();is();Zae=Ba({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ece=Ba({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var CT={};Zt(CT,{base58btc:()=>Hs,base58flickr:()=>tce});var Hs,tce,xT=pe(()=>{h();is();Hs=Ba({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),tce=Ba({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var NT={};Zt(NT,{base64:()=>rce,base64pad:()=>nce,base64url:()=>ice,base64urlpad:()=>sce});var rce,nce,ice,sce,yB=pe(()=>{h();is();rce=gr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),nce=gr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ice=gr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),sce=gr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var OT={};Zt(OT,{base256emoji:()=>lce});function cce(t){return t.reduce((e,r)=>(e+=oce[r],e),"")}function uce(t){let e=[];for(let r of t){let n=ace[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var vB,oce,ace,lce,bB=pe(()=>{h();is();vB=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}"),oce=vB.reduce((t,e,r)=>(t[r]=e,t),[]),ace=vB.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);lce=Of({prefix:"\u{1F680}",name:"base256emoji",encode:cce,decode:uce})});function EB(t,e,r){e=e||[],r=r||0;for(var n=r;t>=pce;)e[r++]=t&255|wB,t/=128;for(;t&hce;)e[r++]=t&255|wB,t>>>=7;return e[r]=t|0,EB.bytes=r-n+1,e}function PT(t,n){var r=0,n=n||0,i=0,s=n,o,c=t.length;do{if(s>=c)throw PT.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&AB)<=mce);return PT.bytes=s-n,r}var fce,wB,dce,hce,pce,gce,mce,AB,yce,vce,bce,wce,Ace,Ece,Sce,_ce,Tce,Ice,Cce,xce,A0,SB=pe(()=>{h();fce=EB,wB=128,dce=127,hce=~dce,pce=Math.pow(2,31);gce=PT,mce=128,AB=127;yce=Math.pow(2,7),vce=Math.pow(2,14),bce=Math.pow(2,21),wce=Math.pow(2,28),Ace=Math.pow(2,35),Ece=Math.pow(2,42),Sce=Math.pow(2,49),_ce=Math.pow(2,56),Tce=Math.pow(2,63),Ice=function(t){return t{h();SB();E0=(t,e=0)=>[A0.decode(t,e),A0.decode.bytes],Rf=(t,e,r=0)=>(A0.encode(t,e,r),e),Mf=t=>A0.encodingLength(t)});var ru,_B,TB,Df,_0=pe(()=>{h();Da();yv();ru=(t,e)=>{let r=e.byteLength,n=Mf(t),i=n+Mf(r),s=new Uint8Array(i+r);return Rf(t,s,0),Rf(r,s,n),s.set(e,i),new Df(t,r,e,s)},_B=t=>{let e=Do(t),[r,n]=E0(e),[i,s]=E0(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Df(r,i,o,e)},TB=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&oB(t.bytes,e.bytes),Df=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var MT,RT,DT=pe(()=>{h();_0();MT=({name:t,code:e,encode:r})=>new RT(t,e,r),RT=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ru(this.code,r):r.then(n=>ru(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var BT={};Zt(BT,{sha256:()=>Nce,sha512:()=>Oce});var CB,Nce,Oce,xB=pe(()=>{h();DT();CB=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Nce=MT({name:"sha2-256",code:18,encode:CB("SHA-256")}),Oce=MT({name:"sha2-512",code:19,encode:CB("SHA-512")})});var LT={};Zt(LT,{identity:()=>Mce});var NB,Pce,OB,Rce,Mce,PB=pe(()=>{h();Da();_0();NB=0,Pce="identity",OB=Do,Rce=t=>ru(NB,OB(t)),Mce={code:NB,name:Pce,encode:OB,digest:Rce}});var RB=pe(()=>{h();Da()});var HCe,GCe,MB=pe(()=>{h();HCe=new TextEncoder,GCe=new TextDecoder});var wv,Lce,Fce,qce,T0,Uce,DB,BB,vv,bv,kce,Vce,Hce,LB=pe(()=>{h();yv();_0();xT();TT();Da();wv=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:bv,byteLength:bv,code:vv,version:vv,multihash:vv,bytes:vv,_baseCache:bv,asCID:bv})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==T0)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Uce)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ru(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&TB(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return Fce(r,i,e||Hs.encoder);default:return qce(r,i,e||Pf.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 Vce(/^0\.0/,Hce),!!(e&&(e[BB]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||DB(r,n,i.bytes))}else if(e!=null&&e[BB]===!0){let{version:r,multihash:n,code:i}=e,s=_B(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==T0)throw new Error(`Version 0 CID must use dag-pb (code: ${T0}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=DB(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,T0,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Do(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Df(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[p,S]=E0(e.subarray(r));return r+=S,p},i=n(),s=T0;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,c=n(),a=n(),u=r+a,f=u-o;return{version:i,codec:s,multihashCode:c,digestSize:a,multihashSize:f,size:u}}static parse(e,r){let[n,i]=Lce(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Lce=(t,e)=>{switch(t[0]){case"Q":{let r=e||Hs;return[Hs.prefix,r.decode(`${Hs.prefix}${t}`)]}case Hs.prefix:{let r=e||Hs;return[Hs.prefix,r.decode(t)]}case Pf.prefix:{let r=e||Pf;return[Pf.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Fce=(t,e,r)=>{let{prefix:n}=r;if(n!==Hs.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},qce=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},T0=112,Uce=18,DB=(t,e,r)=>{let n=Mf(t),i=n+Mf(e),s=new Uint8Array(i+r.byteLength);return Rf(t,s,0),Rf(e,s,n),s.set(r,i),s},BB=Symbol.for("@ipld/js-cid/CID"),vv={writable:!1,configurable:!1,enumerable:!0},bv={writable:!1,enumerable:!1,configurable:!1},kce="0.0.0-dev",Vce=(t,e)=>{if(t.test(kce))console.warn(e);else throw new Error(e)},Hce=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -34,31 +39,26 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var ZR=de(()=>{h();XR();_m();Bo();PI();Sh()});var MI,Obe,eB=de(()=>{h();CR();NR();xR();OR();DR();SI();PR();TI();RR();MR();jR();KR();WR();$R();ZR();MI={...yI,...wI,...vI,...AI,...EI,...bI,...II,..._I,...CI,...NI},Obe={...RI,...BI}});function rB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var tB,LI,UZ,xm,FI=de(()=>{h();eB();bm();tB=rB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),LI=rB("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=zc(t.length);for(let r=0;r{h();FI()});function ns(t,e="utf8"){let r=xm[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}var qI=de(()=>{h();FI()});function _h(t){return Po(Vs(ns(t,Gc),pm))}function Th(t){return Vs(ns(Si(t),pm),Gc)}function VI(t){let e=ns(Am,jc),r=vm+Vs(Sm([e,t]),jc);return[ym,wm,r].join(mm)}function kI(t){let[e,r,n]=t.split(mm);if(e!==ym||r!==wm)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==vm)throw new Error("Issuer must be a key in mulicodec format");let s=ns(n.slice(1),jc);if(Vs(s.slice(0,2),jc)!==Am)throw new Error('Issuer must be a public key with type "Ed25519"');let u=s.slice(2);if(u.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return u}function nB(t){return Vs(t,Gc)}function iB(t){return ns(t,Gc)}function HI(t){return ns([Th(t.header),Th(t.payload)].join(Ka),vh)}function qZ(t){let e=Vs(t,vh).split(Ka),r=_h(e[0]),n=_h(e[1]);return{header:r,payload:n}}function GI(t){return[Th(t.header),Th(t.payload),nB(t.signature)].join(Ka)}function jI(t){let e=t.split(Ka),r=_h(e[0]),n=_h(e[1]),i=iB(e[2]),s=ns(e.slice(0,2).join(Ka),vh);return{header:r,payload:n,signature:i,data:s}}var zI=de(()=>{h();hI();UI();qI();Nc();Em()});function VZ(t=(0,sB.randomBytes)(32)){return Jc.generateKeyPairFromSeed(t)}async function kZ(t,e,r,n,i=(0,oB.fromMiliseconds)(Date.now())){let s={alg:dm,typ:gm},o=VI(n.publicKey),u=i+r,a={iss:o,sub:t,aud:e,iat:i,exp:u},c=HI({header:s,payload:a}),f=Jc.sign(n.secretKey,c);return GI({header:s,payload:a,signature:f})}async function HZ(t){let{header:e,payload:r,data:n,signature:i}=jI(t);if(e.alg!==dm||e.typ!==gm)throw new Error("JWT must use EdDSA algorithm");let s=kI(r.iss);return Jc.verify(s,n,i)}var Jc,sB,oB,aB=de(()=>{h();Jc=ge(yR()),sB=ge(mh()),oB=ge(Bc());Em();zI()});var uB=de(()=>{h()});var cB={};Ot(cB,{DATA_ENCODING:()=>vh,DID_DELIMITER:()=>mm,DID_METHOD:()=>wm,DID_PREFIX:()=>ym,JSON_ENCODING:()=>pm,JWT_DELIMITER:()=>Ka,JWT_ENCODING:()=>Gc,JWT_IRIDIUM_ALG:()=>dm,JWT_IRIDIUM_TYP:()=>gm,KEY_PAIR_SEED_LENGTH:()=>vR,MULTICODEC_ED25519_BASE:()=>vm,MULTICODEC_ED25519_ENCODING:()=>jc,MULTICODEC_ED25519_HEADER:()=>Am,MULTICODEC_ED25519_LENGTH:()=>wR,decodeData:()=>qZ,decodeIss:()=>kI,decodeJSON:()=>_h,decodeJWT:()=>jI,decodeSig:()=>iB,encodeData:()=>HI,encodeIss:()=>VI,encodeJSON:()=>Th,encodeJWT:()=>GI,encodeSig:()=>nB,generateKeyPair:()=>VZ,signJWT:()=>kZ,verifyJWT:()=>HZ});var lB=de(()=>{h();aB();Em();uB();zI()});var bB=D(qt=>{"use strict";h();var fB=qt&&qt.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new wB:typeof navigator<"u"?QI(navigator.userAgent):EB()}qt.detect=QZ;function vB(t){return t!==""&&zZ.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function KZ(t){var e=vB(t);return e?e[0]:null}qt.browserName=KZ;function QI(t){var e=vB(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new yB;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";h();Object.defineProperty(Rt,"__esModule",{value:!0});Rt.getLocalStorage=Rt.getLocalStorageOrThrow=Rt.getCrypto=Rt.getCryptoOrThrow=Rt.getLocation=Rt.getLocationOrThrow=Rt.getNavigator=Rt.getNavigatorOrThrow=Rt.getDocument=Rt.getDocumentOrThrow=Rt.getFromWindowOrThrow=Rt.getFromWindow=void 0;function $a(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Rt.getFromWindow=$a;function Xc(t){let e=$a(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Rt.getFromWindowOrThrow=Xc;function $Z(){return Xc("document")}Rt.getDocumentOrThrow=$Z;function YZ(){return $a("document")}Rt.getDocument=YZ;function JZ(){return Xc("navigator")}Rt.getNavigatorOrThrow=JZ;function XZ(){return $a("navigator")}Rt.getNavigator=XZ;function ZZ(){return Xc("location")}Rt.getLocationOrThrow=ZZ;function eee(){return $a("location")}Rt.getLocation=eee;function tee(){return Xc("crypto")}Rt.getCryptoOrThrow=tee;function ree(){return $a("crypto")}Rt.getCrypto=ree;function nee(){return Xc("localStorage")}Rt.getLocalStorageOrThrow=nee;function iee(){return $a("localStorage")}Rt.getLocalStorage=iee});var IB=D(Om=>{"use strict";h();Object.defineProperty(Om,"__esModule",{value:!0});Om.getWindowMetadata=void 0;var SB=KI();function see(){let t,e;try{t=SB.getDocumentOrThrow(),e=SB.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),w=[];for(let A=0;A-1){let P=_.getAttribute("href");if(P)if(P.toLowerCase().indexOf("https:")===-1&&P.toLowerCase().indexOf("http:")===-1&&P.indexOf("//")!==0){let V=e.protocol+"//"+e.host;if(P.indexOf("/")===0)V+=P;else{let U=e.pathname.split("/");U.pop();let Q=U.join("/");V+=Q+"/"+P}w.push(V)}else if(P.indexOf("//")===0){let V=e.protocol+P;w.push(V)}else w.push(P)}}return w}function n(...d){let w=t.getElementsByTagName("meta");for(let A=0;A_.getAttribute(P)).filter(P=>P?d.includes(P):!1);if(N.length&&N){let P=_.getAttribute("content");if(P)return P}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),u=s(),a=e.origin,c=r();return{description:u,url:a,icons:c,name:o}}Om.getWindowMetadata=see});var TB=D((hSe,_B)=>{"use strict";h();_B.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var DB=D((gSe,OB)=>{"use strict";h();var xB="%[a-f0-9]{2}",CB=new RegExp("("+xB+")|([^%]+?)","gi"),NB=new RegExp("("+xB+")+","gi");function WI(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],WI(r),WI(n))}function oee(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(CB)||[],r=1;r{"use strict";h();PB.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var MB=D((wSe,BB)=>{"use strict";h();BB.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";h();var uee=TB(),cee=DB(),FB=RB(),lee=MB(),fee=t=>t==null,$I=Symbol("encodeFragmentIdentifier");function hee(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[er(e,t),"[",i,"]"].join("")]:[...r,[er(e,t),"[",er(i,t),"]=",er(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[er(e,t),"[]"].join("")]:[...r,[er(e,t),"[]=",er(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[er(e,t),":list="].join("")]:[...r,[er(e,t),":list=",er(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[er(r,t),e,er(i,t)].join("")]:[[n,er(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,er(e,t)]:[...r,[er(e,t),"=",er(n,t)].join("")]}}function dee(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&ks(n,t).includes(t.arrayFormatSeparator);n=o?ks(n,t):n;let u=s||o?n.split(t.arrayFormatSeparator).map(a=>ks(a,t)):n===null?n:ks(n,t);i[r]=u};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ks(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(u=>ks(u,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function UB(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function er(t,e){return e.encode?e.strict?uee(t):encodeURIComponent(t):t}function ks(t,e){return e.decode?cee(t):t}function qB(t){return Array.isArray(t)?t.sort():typeof t=="object"?qB(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function VB(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function gee(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function kB(t){t=VB(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function LB(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function HB(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),UB(e.arrayFormatSeparator);let r=dee(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=FB(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ks(o,e),r(ks(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=LB(s[o],e);else n[i]=LB(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=qB(o):i[s]=o,i},Object.create(null))}sn.extract=kB;sn.parse=HB;sn.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),UB(e.arrayFormatSeparator);let r=o=>e.skipNull&&fee(t[o])||e.skipEmptyString&&t[o]==="",n=hee(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let u=t[o];return u===void 0?"":u===null?er(o,e):Array.isArray(u)?u.length===0&&e.arrayFormat==="bracket-separator"?er(o,e)+"[]":u.reduce(n(o),[]).join("&"):er(o,e)+"="+er(u,e)}).filter(o=>o.length>0).join("&")};sn.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=FB(t,"#");return Object.assign({url:r.split("?")[0]||"",query:HB(kB(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ks(n,e)}:{})};sn.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[$I]:!0},e);let r=VB(t.url).split("?")[0]||"",n=sn.extract(t.url),i=sn.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=sn.stringify(s,e);o&&(o=`?${o}`);let u=gee(t.url);return t.fragmentIdentifier&&(u=`#${e[$I]?er(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${u}`};sn.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[$I]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=sn.parseUrl(t,r);return sn.stringifyUrl({url:n,query:lee(i,e),fragmentIdentifier:s},r)};sn.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return sn.pick(t,n,r)}});var zB=D(Dm=>{"use strict";h();Object.defineProperty(Dm,"__esModule",{value:!0});var Lr=qc(),YI=Wn(),pee=20;function mee(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,u=r[3]<<24|r[2]<<16|r[1]<<8|r[0],a=r[7]<<24|r[6]<<16|r[5]<<8|r[4],c=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],w=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],_=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],P=e[7]<<24|e[6]<<16|e[5]<<8|e[4],V=e[11]<<24|e[10]<<16|e[9]<<8|e[8],U=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Q=n,L=i,k=s,H=o,q=u,v=a,C=c,R=f,F=d,B=w,l=A,g=_,y=N,E=P,I=V,T=U,M=0;M>>16|y<<16,F=F+y|0,q^=F,q=q>>>20|q<<12,L=L+v|0,E^=L,E=E>>>16|E<<16,B=B+E|0,v^=B,v=v>>>20|v<<12,k=k+C|0,I^=k,I=I>>>16|I<<16,l=l+I|0,C^=l,C=C>>>20|C<<12,H=H+R|0,T^=H,T=T>>>16|T<<16,g=g+T|0,R^=g,R=R>>>20|R<<12,k=k+C|0,I^=k,I=I>>>24|I<<8,l=l+I|0,C^=l,C=C>>>25|C<<7,H=H+R|0,T^=H,T=T>>>24|T<<8,g=g+T|0,R^=g,R=R>>>25|R<<7,L=L+v|0,E^=L,E=E>>>24|E<<8,B=B+E|0,v^=B,v=v>>>25|v<<7,Q=Q+q|0,y^=Q,y=y>>>24|y<<8,F=F+y|0,q^=F,q=q>>>25|q<<7,Q=Q+v|0,T^=Q,T=T>>>16|T<<16,l=l+T|0,v^=l,v=v>>>20|v<<12,L=L+C|0,y^=L,y=y>>>16|y<<16,g=g+y|0,C^=g,C=C>>>20|C<<12,k=k+R|0,E^=k,E=E>>>16|E<<16,F=F+E|0,R^=F,R=R>>>20|R<<12,H=H+q|0,I^=H,I=I>>>16|I<<16,B=B+I|0,q^=B,q=q>>>20|q<<12,k=k+R|0,E^=k,E=E>>>24|E<<8,F=F+E|0,R^=F,R=R>>>25|R<<7,H=H+q|0,I^=H,I=I>>>24|I<<8,B=B+I|0,q^=B,q=q>>>25|q<<7,L=L+C|0,y^=L,y=y>>>24|y<<8,g=g+y|0,C^=g,C=C>>>25|C<<7,Q=Q+v|0,T^=Q,T=T>>>24|T<<8,l=l+T|0,v^=l,v=v>>>25|v<<7;Lr.writeUint32LE(Q+n|0,t,0),Lr.writeUint32LE(L+i|0,t,4),Lr.writeUint32LE(k+s|0,t,8),Lr.writeUint32LE(H+o|0,t,12),Lr.writeUint32LE(q+u|0,t,16),Lr.writeUint32LE(v+a|0,t,20),Lr.writeUint32LE(C+c|0,t,24),Lr.writeUint32LE(R+f|0,t,28),Lr.writeUint32LE(F+d|0,t,32),Lr.writeUint32LE(B+w|0,t,36),Lr.writeUint32LE(l+A|0,t,40),Lr.writeUint32LE(g+_|0,t,44),Lr.writeUint32LE(y+N|0,t,48),Lr.writeUint32LE(E+P|0,t,52),Lr.writeUint32LE(I+V|0,t,56),Lr.writeUint32LE(T+U|0,t,60)}function jB(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var Pm=D(Zc=>{"use strict";h();Object.defineProperty(Zc,"__esModule",{value:!0});function vee(t,e,r){return~(t-1)&e|t-1&r}Zc.select=vee;function Aee(t,e){return(t|0)-(e|0)-1>>>31&1}Zc.lessOrEqual=Aee;function QB(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Zc.compare=QB;function Eee(t,e){return t.length===0||e.length===0?!1:QB(t,e)!==0}Zc.equal=Eee});var WB=D(Hs=>{"use strict";h();Object.defineProperty(Hs,"__esModule",{value:!0});var bee=Pm(),Rm=Wn();Hs.DIGEST_LENGTH=16;var KB=function(){function t(e){this.digestLength=Hs.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var u=e[10]|e[11]<<8;this._r[6]=(o>>>14|u<<2)&8191;var a=e[12]|e[13]<<8;this._r[7]=(u>>>11|a<<5)&8065;var c=e[14]|e[15]<<8;this._r[8]=(a>>>8|c<<8)&8191,this._r[9]=c>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],u=this._h[2],a=this._h[3],c=this._h[4],f=this._h[5],d=this._h[6],w=this._h[7],A=this._h[8],_=this._h[9],N=this._r[0],P=this._r[1],V=this._r[2],U=this._r[3],Q=this._r[4],L=this._r[5],k=this._r[6],H=this._r[7],q=this._r[8],v=this._r[9];n>=16;){var C=e[r+0]|e[r+1]<<8;s+=C&8191;var R=e[r+2]|e[r+3]<<8;o+=(C>>>13|R<<3)&8191;var F=e[r+4]|e[r+5]<<8;u+=(R>>>10|F<<6)&8191;var B=e[r+6]|e[r+7]<<8;a+=(F>>>7|B<<9)&8191;var l=e[r+8]|e[r+9]<<8;c+=(B>>>4|l<<12)&8191,f+=l>>>1&8191;var g=e[r+10]|e[r+11]<<8;d+=(l>>>14|g<<2)&8191;var y=e[r+12]|e[r+13]<<8;w+=(g>>>11|y<<5)&8191;var E=e[r+14]|e[r+15]<<8;A+=(y>>>8|E<<8)&8191,_+=E>>>5|i;var I=0,T=I;T+=s*N,T+=o*(5*v),T+=u*(5*q),T+=a*(5*H),T+=c*(5*k),I=T>>>13,T&=8191,T+=f*(5*L),T+=d*(5*Q),T+=w*(5*U),T+=A*(5*V),T+=_*(5*P),I+=T>>>13,T&=8191;var M=I;M+=s*P,M+=o*N,M+=u*(5*v),M+=a*(5*q),M+=c*(5*H),I=M>>>13,M&=8191,M+=f*(5*k),M+=d*(5*L),M+=w*(5*Q),M+=A*(5*U),M+=_*(5*V),I+=M>>>13,M&=8191;var x=I;x+=s*V,x+=o*P,x+=u*N,x+=a*(5*v),x+=c*(5*q),I=x>>>13,x&=8191,x+=f*(5*H),x+=d*(5*k),x+=w*(5*L),x+=A*(5*Q),x+=_*(5*U),I+=x>>>13,x&=8191;var m=I;m+=s*U,m+=o*V,m+=u*P,m+=a*N,m+=c*(5*v),I=m>>>13,m&=8191,m+=f*(5*q),m+=d*(5*H),m+=w*(5*k),m+=A*(5*L),m+=_*(5*Q),I+=m>>>13,m&=8191;var O=I;O+=s*Q,O+=o*U,O+=u*V,O+=a*P,O+=c*N,I=O>>>13,O&=8191,O+=f*(5*v),O+=d*(5*q),O+=w*(5*H),O+=A*(5*k),O+=_*(5*L),I+=O>>>13,O&=8191;var Y=I;Y+=s*L,Y+=o*Q,Y+=u*U,Y+=a*V,Y+=c*P,I=Y>>>13,Y&=8191,Y+=f*N,Y+=d*(5*v),Y+=w*(5*q),Y+=A*(5*H),Y+=_*(5*k),I+=Y>>>13,Y&=8191;var $=I;$+=s*k,$+=o*L,$+=u*Q,$+=a*U,$+=c*V,I=$>>>13,$&=8191,$+=f*P,$+=d*N,$+=w*(5*v),$+=A*(5*q),$+=_*(5*H),I+=$>>>13,$&=8191;var b=I;b+=s*H,b+=o*k,b+=u*L,b+=a*Q,b+=c*U,I=b>>>13,b&=8191,b+=f*V,b+=d*P,b+=w*N,b+=A*(5*v),b+=_*(5*q),I+=b>>>13,b&=8191;var j=I;j+=s*q,j+=o*H,j+=u*k,j+=a*L,j+=c*Q,I=j>>>13,j&=8191,j+=f*U,j+=d*V,j+=w*P,j+=A*N,j+=_*(5*v),I+=j>>>13,j&=8191;var z=I;z+=s*v,z+=o*q,z+=u*H,z+=a*k,z+=c*L,I=z>>>13,z&=8191,z+=f*Q,z+=d*U,z+=w*V,z+=A*P,z+=_*N,I+=z>>>13,z&=8191,I=(I<<2)+I|0,I=I+T|0,T=I&8191,I=I>>>13,M+=I,s=T,o=M,u=x,a=m,c=O,f=Y,d=$,w=b,A=j,_=z,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=u,this._h[3]=a,this._h[4]=c,this._h[5]=f,this._h[6]=d,this._h[7]=w,this._h[8]=A,this._h[9]=_},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,u;if(this._leftover){for(u=this._leftover,this._buffer[u++]=1;u<16;u++)this._buffer[u]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,u=2;u<10;u++)this._h[u]+=i,i=this._h[u]>>>13,this._h[u]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,u=1;u<10;u++)n[u]=this._h[u]+i,i=n[u]>>>13,n[u]&=8191;for(n[9]-=8192,s=(i^1)-1,u=0;u<10;u++)n[u]&=s;for(s=~s,u=0;u<10;u++)this._h[u]=this._h[u]&s|n[u];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,u=1;u<8;u++)o=(this._h[u]+this._pad[u]|0)+(o>>>16)|0,this._h[u]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";h();Object.defineProperty(Gs,"__esModule",{value:!0});var Bm=zB(),_ee=WB(),Ch=Wn(),$B=qc(),Tee=Pm();Gs.KEY_LENGTH=32;Gs.NONCE_LENGTH=12;Gs.TAG_LENGTH=16;var YB=new Uint8Array(16),Cee=function(){function t(e){if(this.nonceLength=Gs.NONCE_LENGTH,this.tagLength=Gs.TAG_LENGTH,e.length!==Gs.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);Bm.stream(this._key,s,o,4);var u=r.length+this.tagLength,a;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");a=i}else a=new Uint8Array(u);return Bm.streamXOR(this._key,s,r,a,4),this._authenticate(a.subarray(a.length-this.tagLength,a.length),o,a.subarray(0,a.length-this.tagLength),n),Ch.wipe(s),a},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(YB.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(YB.subarray(n.length%16));var o=new Uint8Array(8);i&&$B.writeUint64LE(i.length,o),s.update(o),$B.writeUint64LE(n.length,o),s.update(o);for(var u=s.digest(),a=0;a{"use strict";h();Object.defineProperty(JI,"__esModule",{value:!0});function Nee(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}JI.isSerializableHash=Nee});var eM=D(Nh=>{"use strict";h();Object.defineProperty(Nh,"__esModule",{value:!0});var is=XB(),xee=Pm(),Oee=Wn(),ZB=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";h();Object.defineProperty(XI,"__esModule",{value:!0});var tM=eM(),rM=Wn(),Pee=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=tM.hmac(this._hash,n,r);this._hmac=new tM.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";h();Object.defineProperty(Lo,"__esModule",{value:!0});var Lm=qc(),Mm=Wn();Lo.DIGEST_LENGTH=32;Lo.BLOCK_SIZE=64;var iM=function(){function t(){this.digestLength=Lo.DIGEST_LENGTH,this.blockSize=Lo.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Mm.wipe(this._buffer),Mm.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(ZI(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=ZI(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var u=n+1;u0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Mm.wipe(e.state),e.buffer&&Mm.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Lo.SHA256=iM;var Ree=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 ZI(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],u=e[2],a=e[3],c=e[4],f=e[5],d=e[6],w=e[7],A=0;A<16;A++){var _=n+A*4;t[A]=Lm.readUint32BE(r,_)}for(var A=16;A<64;A++){var N=t[A-2],P=(N>>>17|N<<15)^(N>>>19|N<<13)^N>>>10;N=t[A-15];var V=(N>>>7|N<<25)^(N>>>18|N<<14)^N>>>3;t[A]=(P+t[A-7]|0)+(V+t[A-16]|0)}for(var A=0;A<64;A++){var P=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&d)|0)+(w+(Ree[A]+t[A]|0)|0)|0,V=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&u^o&u)|0;w=d,d=f,f=c,c=a+P|0,a=u,u=o,o=s,s=P+V|0}e[0]+=s,e[1]+=o,e[2]+=u,e[3]+=a,e[4]+=c,e[5]+=f,e[6]+=d,e[7]+=w,n+=64,i-=64}return n}function Bee(t){var e=new iM;e.update(t);var r=e.digest();return e.clean(),r}Lo.hash=Bee});var cM=D(zt=>{"use strict";h();Object.defineProperty(zt,"__esModule",{value:!0});zt.sharedKey=zt.generateKeyPair=zt.generateKeyPairFromSeed=zt.scalarMultBase=zt.scalarMult=zt.SHARED_KEY_LENGTH=zt.SECRET_KEY_LENGTH=zt.PUBLIC_KEY_LENGTH=void 0;var Mee=mh(),Lee=Wn();zt.PUBLIC_KEY_LENGTH=32;zt.SECRET_KEY_LENGTH=32;zt.SHARED_KEY_LENGTH=32;function ss(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,xh(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function qee(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fm(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Um(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function js(t,e,r){let n,i,s=0,o=0,u=0,a=0,c=0,f=0,d=0,w=0,A=0,_=0,N=0,P=0,V=0,U=0,Q=0,L=0,k=0,H=0,q=0,v=0,C=0,R=0,F=0,B=0,l=0,g=0,y=0,E=0,I=0,T=0,M=0,x=r[0],m=r[1],O=r[2],Y=r[3],$=r[4],b=r[5],j=r[6],z=r[7],W=r[8],ie=r[9],te=r[10],ee=r[11],se=r[12],oe=r[13],J=r[14],ue=r[15];n=e[0],s+=n*x,o+=n*m,u+=n*O,a+=n*Y,c+=n*$,f+=n*b,d+=n*j,w+=n*z,A+=n*W,_+=n*ie,N+=n*te,P+=n*ee,V+=n*se,U+=n*oe,Q+=n*J,L+=n*ue,n=e[1],o+=n*x,u+=n*m,a+=n*O,c+=n*Y,f+=n*$,d+=n*b,w+=n*j,A+=n*z,_+=n*W,N+=n*ie,P+=n*te,V+=n*ee,U+=n*se,Q+=n*oe,L+=n*J,k+=n*ue,n=e[2],u+=n*x,a+=n*m,c+=n*O,f+=n*Y,d+=n*$,w+=n*b,A+=n*j,_+=n*z,N+=n*W,P+=n*ie,V+=n*te,U+=n*ee,Q+=n*se,L+=n*oe,k+=n*J,H+=n*ue,n=e[3],a+=n*x,c+=n*m,f+=n*O,d+=n*Y,w+=n*$,A+=n*b,_+=n*j,N+=n*z,P+=n*W,V+=n*ie,U+=n*te,Q+=n*ee,L+=n*se,k+=n*oe,H+=n*J,q+=n*ue,n=e[4],c+=n*x,f+=n*m,d+=n*O,w+=n*Y,A+=n*$,_+=n*b,N+=n*j,P+=n*z,V+=n*W,U+=n*ie,Q+=n*te,L+=n*ee,k+=n*se,H+=n*oe,q+=n*J,v+=n*ue,n=e[5],f+=n*x,d+=n*m,w+=n*O,A+=n*Y,_+=n*$,N+=n*b,P+=n*j,V+=n*z,U+=n*W,Q+=n*ie,L+=n*te,k+=n*ee,H+=n*se,q+=n*oe,v+=n*J,C+=n*ue,n=e[6],d+=n*x,w+=n*m,A+=n*O,_+=n*Y,N+=n*$,P+=n*b,V+=n*j,U+=n*z,Q+=n*W,L+=n*ie,k+=n*te,H+=n*ee,q+=n*se,v+=n*oe,C+=n*J,R+=n*ue,n=e[7],w+=n*x,A+=n*m,_+=n*O,N+=n*Y,P+=n*$,V+=n*b,U+=n*j,Q+=n*z,L+=n*W,k+=n*ie,H+=n*te,q+=n*ee,v+=n*se,C+=n*oe,R+=n*J,F+=n*ue,n=e[8],A+=n*x,_+=n*m,N+=n*O,P+=n*Y,V+=n*$,U+=n*b,Q+=n*j,L+=n*z,k+=n*W,H+=n*ie,q+=n*te,v+=n*ee,C+=n*se,R+=n*oe,F+=n*J,B+=n*ue,n=e[9],_+=n*x,N+=n*m,P+=n*O,V+=n*Y,U+=n*$,Q+=n*b,L+=n*j,k+=n*z,H+=n*W,q+=n*ie,v+=n*te,C+=n*ee,R+=n*se,F+=n*oe,B+=n*J,l+=n*ue,n=e[10],N+=n*x,P+=n*m,V+=n*O,U+=n*Y,Q+=n*$,L+=n*b,k+=n*j,H+=n*z,q+=n*W,v+=n*ie,C+=n*te,R+=n*ee,F+=n*se,B+=n*oe,l+=n*J,g+=n*ue,n=e[11],P+=n*x,V+=n*m,U+=n*O,Q+=n*Y,L+=n*$,k+=n*b,H+=n*j,q+=n*z,v+=n*W,C+=n*ie,R+=n*te,F+=n*ee,B+=n*se,l+=n*oe,g+=n*J,y+=n*ue,n=e[12],V+=n*x,U+=n*m,Q+=n*O,L+=n*Y,k+=n*$,H+=n*b,q+=n*j,v+=n*z,C+=n*W,R+=n*ie,F+=n*te,B+=n*ee,l+=n*se,g+=n*oe,y+=n*J,E+=n*ue,n=e[13],U+=n*x,Q+=n*m,L+=n*O,k+=n*Y,H+=n*$,q+=n*b,v+=n*j,C+=n*z,R+=n*W,F+=n*ie,B+=n*te,l+=n*ee,g+=n*se,y+=n*oe,E+=n*J,I+=n*ue,n=e[14],Q+=n*x,L+=n*m,k+=n*O,H+=n*Y,q+=n*$,v+=n*b,C+=n*j,R+=n*z,F+=n*W,B+=n*ie,l+=n*te,g+=n*ee,y+=n*se,E+=n*oe,I+=n*J,T+=n*ue,n=e[15],L+=n*x,k+=n*m,H+=n*O,q+=n*Y,v+=n*$,C+=n*b,R+=n*j,F+=n*z,B+=n*W,l+=n*ie,g+=n*te,y+=n*ee,E+=n*se,I+=n*oe,T+=n*J,M+=n*ue,s+=38*k,o+=38*H,u+=38*q,a+=38*v,c+=38*C,f+=38*R,d+=38*F,w+=38*B,A+=38*l,_+=38*g,N+=38*y,P+=38*E,V+=38*I,U+=38*T,Q+=38*M,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=P+i+65535,i=Math.floor(n/65536),P=n-i*65536,n=V+i+65535,i=Math.floor(n/65536),V=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=Q+i+65535,i=Math.floor(n/65536),Q=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=u,t[3]=a,t[4]=c,t[5]=f,t[6]=d,t[7]=w,t[8]=A,t[9]=_,t[10]=N,t[11]=P,t[12]=V,t[13]=U,t[14]=Q,t[15]=L}function Oh(t,e){js(t,e,e)}function Vee(t,e){let r=ss();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)Oh(r,r),n!==2&&n!==4&&js(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function t_(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=ss(),s=ss(),o=ss(),u=ss(),a=ss(),c=ss();for(let A=0;A<31;A++)r[A]=t[A];r[31]=t[31]&127|64,r[0]&=248,qee(n,e);for(let A=0;A<16;A++)s[A]=n[A];i[0]=u[0]=1;for(let A=254;A>=0;--A){let _=r[A>>>3]>>>(A&7)&1;xh(i,s,_),xh(o,u,_),Fm(a,i,o),Um(i,i,o),Fm(o,s,u),Um(s,s,u),Oh(u,a),Oh(c,i),js(i,o,i),js(o,s,a),Fm(a,i,o),Um(i,i,o),Oh(s,i),Um(o,u,c),js(i,o,Fee),Fm(i,i,u),js(o,o,i),js(i,u,c),js(u,s,n),Oh(s,a),xh(i,s,_),xh(o,u,_)}for(let A=0;A<16;A++)n[A+16]=i[A],n[A+32]=o[A],n[A+48]=s[A],n[A+64]=u[A];let f=n.subarray(32),d=n.subarray(16);Vee(f,f),js(d,d,f);let w=new Uint8Array(32);return Uee(w,d),w}zt.scalarMult=t_;function aM(t){return t_(t,oM)}zt.scalarMultBase=aM;function uM(t){if(t.length!==zt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${zt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:aM(e),secretKey:e}}zt.generateKeyPairFromSeed=uM;function kee(t){let e=(0,Mee.randomBytes)(32,t),r=uM(e);return(0,Lee.wipe)(e),r}zt.generateKeyPair=kee;function Hee(t,e,r=!1){if(t.length!==zt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==zt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=t_(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{h()});function hM(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{h()});function gM(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=zc(t.length);for(let n=0;n{h();bm()});var r_={};Ot(r_,{compare:()=>lM,concat:()=>Sm,equals:()=>hM,fromString:()=>ns,toString:()=>Vs,xor:()=>gM});var n_=de(()=>{h();fM();hI();dM();qI();UI();pM()});var mM={};Ot(mM,{RELAY_JSONRPC:()=>ete,isPublishMethod:()=>o_,isPublishParams:()=>a_,isPublishRequest:()=>Kee,isSubscribeMethod:()=>i_,isSubscribeParams:()=>s_,isSubscribeRequest:()=>Qee,isSubscriptionMethod:()=>l_,isSubscriptionParams:()=>f_,isSubscriptionRequest:()=>$ee,isUnsubscribeMethod:()=>u_,isUnsubscribeParams:()=>c_,isUnsubscribeRequest:()=>Wee,parsePublishRequest:()=>Jee,parseSubscribeRequest:()=>Yee,parseSubscriptionRequest:()=>Zee,parseUnsubscribeRequest:()=>Xee});function Ya(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function Gee(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function jee(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function zee(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function qm(t,e,r){return(r.length?zee(t,e.length):jee(t,e.length))?Gee(t,e):!1}function Vm(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}function Qee(t){return i_(t.method)&&s_(t.params)}function i_(t){return Vm(t,"subscribe")}function s_(t){return qm(t,["topic"],[])}function Kee(t){return o_(t.method)&&a_(t.params)}function o_(t){return Vm(t,"publish")}function a_(t){return qm(t,["message","topic","ttl"],["prompt","tag"])}function Wee(t){return u_(t.method)&&c_(t.params)}function u_(t){return Vm(t,"unsubscribe")}function c_(t){return qm(t,["id","topic"],[])}function $ee(t){return l_(t.method)&&f_(t.params)}function l_(t){return Vm(t,"subscription")}function f_(t){return qm(t,["id","data"],[])}function Yee(t){if(!i_(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!s_(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Ya(e,"topic"),e}function Jee(t){if(!o_(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!a_(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Ya(e,"topic"),Ya(e,"message"),Ya(e,"ttl","number"),e}function Xee(t){if(!u_(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!c_(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Ya(e,"id"),e}function Zee(t){if(!l_(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!f_(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Ya(e,"id"),Ya(e,"data"),e}var ete,yM=de(()=>{h();ete={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}}});var jh=D(K=>{"use strict";h();Object.defineProperty(K,"__esModule",{value:!0});var tte=bB(),tl=Bc(),sl=KI(),rte=IB(),nte=GB(),JM=JB(),ite=nM(),XM=mh(),U_=sM(),ste=cM(),Vt=(n_(),xe(r_)),ote=(yM(),xe(mM));function ZM(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var $m=ZM(nte),e4=ZM(ste),ny=":";function t4(t){let[e,r]=t.split(ny);return{namespace:e,reference:r}}function r4(t){let{namespace:e,reference:r}=t;return[e,r].join(ny)}function q_(t){let[e,r,n]=t.split(ny);return{namespace:e,reference:r,address:n}}function n4(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(ny)}function V_(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function i4(t){let{address:e}=q_(t);return e}function s4(t){let{namespace:e,reference:r}=q_(t);return r4({namespace:e,reference:r})}function ate(t,e){let{namespace:r,reference:n}=t4(e);return n4({namespace:r,reference:n,address:t})}function ute(t){return V_(t,i4)}function o4(t){return V_(t,s4)}function cte(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function lte(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...o4(i.accounts))}),r}function fte(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...iy(n,i))}),r}function iy(t,e){return t.includes(":")?[t]:e.chains||[]}var hte=Object.defineProperty,wM=Object.getOwnPropertySymbols,dte=Object.prototype.hasOwnProperty,gte=Object.prototype.propertyIsEnumerable,vM=(t,e,r)=>e in t?hte(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AM=(t,e)=>{for(var r in e||(e={}))dte.call(e,r)&&vM(t,r,e[r]);if(wM)for(var r of wM(e))gte.call(e,r)&&vM(t,r,e[r]);return t},a4="ReactNative",zr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Ym=" ",pte=":",u4="/",k_=2,mte=1e3,c4="js";function H_(){return typeof S.default<"u"&&typeof S.default.versions<"u"&&typeof S.default.versions.node<"u"}function ul(){return!sl.getDocument()&&!!sl.getNavigator()&&navigator.product===a4}function Vh(){return!H_()&&!!sl.getNavigator()&&!!sl.getDocument()}function Za(){return ul()?zr.reactNative:H_()?zr.node:Vh()?zr.browser:zr.unknown}function yte(){var t;try{return ul()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function l4(t,e){let r=$m.parse(t);return r=AM(AM({},r),e),t=$m.stringify(r),t}function wte(){return rte.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function vte(t,e){var r;let n=Za(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=sl.getLocation())==null?void 0:r.host)||"unknown"),i}function f4(){if(Za()===zr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=tte.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function h4(){var t;let e=Za();return e===zr.browser?[e,((t=sl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function d4(t,e,r){let n=f4(),i=h4();return[[t,e].join("-"),[c4,r].join("-"),n,i].join("/")}function Ate({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:u}){let a=r.split("?"),c=d4(t,e,n),f={auth:i,ua:c,projectId:s,useOnCloseEvent:o||void 0,origin:u||void 0},d=l4(a[1]||"",f);return a[0]+"?"+d}function Ete(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function bte(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function g4(t,e=k_){return p4(t.split(u4),e)}function Ste(t){return g4(t).join(Ym)}function Vo(t,e){return t.filter(r=>e.includes(r)).length===t.length}function p4(t,e=k_){return t.slice(Math.max(t.length-e,0))}function Ite(t){return Object.fromEntries(t.entries())}function _te(t){return new Map(Object.entries(t))}function Tte(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Cte=t=>t;function m4(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function Nte(t){return t.split(Ym).map(e=>m4(e)).join(Ym)}function xte(t=tl.FIVE_MINUTES,e){let r=tl.toMiliseconds(t||tl.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,u)=>{s=setTimeout(()=>{u(new Error(e))},r),n=o,i=u})}}function Ote(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function G_(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Dte(t){return G_("topic",t)}function Pte(t){return G_("id",t)}function Rte(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Bte(t,e){return tl.fromMiliseconds((e||Date.now())+tl.toMiliseconds(t))}function Mte(t){return Date.now()>=tl.toMiliseconds(t)}function Lte(t,e){return`${t}${e?`:${e}`:""}`}function Ys(t=[],e=[]){return[...new Set([...t,...e])]}async function Fte({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=Za();o===zr.browser?s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===zr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function Ute(t,e){try{return await t.getItem(e)||(Vh()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}function C_(t,e){return t.filter(r=>e.includes(r))}var y4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qte(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var w4={exports:{}};(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof S.default=="object"&&S.default.versions&&S.default.versions.node;o?i=y4:s&&(i=self);var u=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],w=[1,256,65536,16777216],A=[6,1536,393216,100663296],_=[0,8,16,24],N=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],P=[224,256,384,512],V=[128,256],U=["hex","buffer","arrayBuffer","array","digest"],Q={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(b){return Object.prototype.toString.call(b)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(b){return typeof b=="object"&&b.buffer&&b.buffer.constructor===ArrayBuffer});for(var L=function(b,j,z){return function(W){return new O(b,j,b).update(W)[z]()}},k=function(b,j,z){return function(W,ie){return new O(b,j,ie).update(W)[z]()}},H=function(b,j,z){return function(W,ie,te,ee){return g["cshake"+b].update(W,ie,te,ee)[z]()}},q=function(b,j,z){return function(W,ie,te,ee){return g["kmac"+b].update(W,ie,te,ee)[z]()}},v=function(b,j,z,W){for(var ie=0;ie>5,this.byteCount=this.blockCount<<2,this.outputBlocks=z>>5,this.extraBytes=(z&31)>>3;for(var W=0;W<50;++W)this.s[W]=0}O.prototype.update=function(b){if(this.finalized)throw new Error(r);var j,z=typeof b;if(z!=="string"){if(z==="object"){if(b===null)throw new Error(e);if(a&&b.constructor===ArrayBuffer)b=new Uint8Array(b);else if(!Array.isArray(b)&&(!a||!ArrayBuffer.isView(b)))throw new Error(e)}else throw new Error(e);j=!0}for(var W=this.blocks,ie=this.byteCount,te=b.length,ee=this.blockCount,se=0,oe=this.s,J,ue;se>2]|=b[se]<<_[J++&3];else for(J=this.start;se>2]|=ue<<_[J++&3]:ue<2048?(W[J>>2]|=(192|ue>>6)<<_[J++&3],W[J>>2]|=(128|ue&63)<<_[J++&3]):ue<55296||ue>=57344?(W[J>>2]|=(224|ue>>12)<<_[J++&3],W[J>>2]|=(128|ue>>6&63)<<_[J++&3],W[J>>2]|=(128|ue&63)<<_[J++&3]):(ue=65536+((ue&1023)<<10|b.charCodeAt(++se)&1023),W[J>>2]|=(240|ue>>18)<<_[J++&3],W[J>>2]|=(128|ue>>12&63)<<_[J++&3],W[J>>2]|=(128|ue>>6&63)<<_[J++&3],W[J>>2]|=(128|ue&63)<<_[J++&3]);if(this.lastByteIndex=J,J>=ie){for(this.start=J-ie,this.block=W[ee],J=0;J>8,z=b&255;z>0;)ie.unshift(z),b=b>>8,z=b&255,++W;return j?ie.push(W):ie.unshift(W),this.update(ie),ie.length},O.prototype.encodeString=function(b){var j,z=typeof b;if(z!=="string"){if(z==="object"){if(b===null)throw new Error(e);if(a&&b.constructor===ArrayBuffer)b=new Uint8Array(b);else if(!Array.isArray(b)&&(!a||!ArrayBuffer.isView(b)))throw new Error(e)}else throw new Error(e);j=!0}var W=0,ie=b.length;if(j)W=ie;else for(var te=0;te=57344?W+=3:(ee=65536+((ee&1023)<<10|b.charCodeAt(++te)&1023),W+=4)}return W+=this.encode(W*8),this.update(b),W},O.prototype.bytepad=function(b,j){for(var z=this.encode(j),W=0;W>2]|=this.padding[j&3],this.lastByteIndex===this.byteCount)for(b[0]=b[z],j=1;j>4&15]+c[se&15]+c[se>>12&15]+c[se>>8&15]+c[se>>20&15]+c[se>>16&15]+c[se>>28&15]+c[se>>24&15];te%b===0&&($(j),ie=0)}return W&&(se=j[ie],ee+=c[se>>4&15]+c[se&15],W>1&&(ee+=c[se>>12&15]+c[se>>8&15]),W>2&&(ee+=c[se>>20&15]+c[se>>16&15])),ee},O.prototype.arrayBuffer=function(){this.finalize();var b=this.blockCount,j=this.s,z=this.outputBlocks,W=this.extraBytes,ie=0,te=0,ee=this.outputBits>>3,se;W?se=new ArrayBuffer(z+1<<2):se=new ArrayBuffer(ee);for(var oe=new Uint32Array(se);te>8&255,ee[se+2]=oe>>16&255,ee[se+3]=oe>>24&255;te%b===0&&$(j)}return W&&(se=te<<2,oe=j[ie],ee[se]=oe&255,W>1&&(ee[se+1]=oe>>8&255),W>2&&(ee[se+2]=oe>>16&255)),ee};function Y(b,j,z){O.call(this,b,j,z)}Y.prototype=new O,Y.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var $=function(b){var j,z,W,ie,te,ee,se,oe,J,ue,vt,At,Pi,Et,bt,Ri,St,It,Bi,_t,Tt,Mi,Ke,We,si,$e,Ye,oi,Je,Xe,ai,Ze,et,ui,tt,rt,ci,nt,it,li,st,ot,fi,at,ut,hi,ct,lt,di,ft,ht,gi,dt,gt,pi,pt,mt,An,En,bn,Sn,In,_n;for(W=0;W<48;W+=2)ie=b[0]^b[10]^b[20]^b[30]^b[40],te=b[1]^b[11]^b[21]^b[31]^b[41],ee=b[2]^b[12]^b[22]^b[32]^b[42],se=b[3]^b[13]^b[23]^b[33]^b[43],oe=b[4]^b[14]^b[24]^b[34]^b[44],J=b[5]^b[15]^b[25]^b[35]^b[45],ue=b[6]^b[16]^b[26]^b[36]^b[46],vt=b[7]^b[17]^b[27]^b[37]^b[47],At=b[8]^b[18]^b[28]^b[38]^b[48],Pi=b[9]^b[19]^b[29]^b[39]^b[49],j=At^(ee<<1|se>>>31),z=Pi^(se<<1|ee>>>31),b[0]^=j,b[1]^=z,b[10]^=j,b[11]^=z,b[20]^=j,b[21]^=z,b[30]^=j,b[31]^=z,b[40]^=j,b[41]^=z,j=ie^(oe<<1|J>>>31),z=te^(J<<1|oe>>>31),b[2]^=j,b[3]^=z,b[12]^=j,b[13]^=z,b[22]^=j,b[23]^=z,b[32]^=j,b[33]^=z,b[42]^=j,b[43]^=z,j=ee^(ue<<1|vt>>>31),z=se^(vt<<1|ue>>>31),b[4]^=j,b[5]^=z,b[14]^=j,b[15]^=z,b[24]^=j,b[25]^=z,b[34]^=j,b[35]^=z,b[44]^=j,b[45]^=z,j=oe^(At<<1|Pi>>>31),z=J^(Pi<<1|At>>>31),b[6]^=j,b[7]^=z,b[16]^=j,b[17]^=z,b[26]^=j,b[27]^=z,b[36]^=j,b[37]^=z,b[46]^=j,b[47]^=z,j=ue^(ie<<1|te>>>31),z=vt^(te<<1|ie>>>31),b[8]^=j,b[9]^=z,b[18]^=j,b[19]^=z,b[28]^=j,b[29]^=z,b[38]^=j,b[39]^=z,b[48]^=j,b[49]^=z,Et=b[0],bt=b[1],hi=b[11]<<4|b[10]>>>28,ct=b[10]<<4|b[11]>>>28,oi=b[20]<<3|b[21]>>>29,Je=b[21]<<3|b[20]>>>29,bn=b[31]<<9|b[30]>>>23,Sn=b[30]<<9|b[31]>>>23,ot=b[40]<<18|b[41]>>>14,fi=b[41]<<18|b[40]>>>14,ui=b[2]<<1|b[3]>>>31,tt=b[3]<<1|b[2]>>>31,Ri=b[13]<<12|b[12]>>>20,St=b[12]<<12|b[13]>>>20,lt=b[22]<<10|b[23]>>>22,di=b[23]<<10|b[22]>>>22,Xe=b[33]<<13|b[32]>>>19,ai=b[32]<<13|b[33]>>>19,In=b[42]<<2|b[43]>>>30,_n=b[43]<<2|b[42]>>>30,gt=b[5]<<30|b[4]>>>2,pi=b[4]<<30|b[5]>>>2,rt=b[14]<<6|b[15]>>>26,ci=b[15]<<6|b[14]>>>26,It=b[25]<<11|b[24]>>>21,Bi=b[24]<<11|b[25]>>>21,ft=b[34]<<15|b[35]>>>17,ht=b[35]<<15|b[34]>>>17,Ze=b[45]<<29|b[44]>>>3,et=b[44]<<29|b[45]>>>3,We=b[6]<<28|b[7]>>>4,si=b[7]<<28|b[6]>>>4,pt=b[17]<<23|b[16]>>>9,mt=b[16]<<23|b[17]>>>9,nt=b[26]<<25|b[27]>>>7,it=b[27]<<25|b[26]>>>7,_t=b[36]<<21|b[37]>>>11,Tt=b[37]<<21|b[36]>>>11,gi=b[47]<<24|b[46]>>>8,dt=b[46]<<24|b[47]>>>8,at=b[8]<<27|b[9]>>>5,ut=b[9]<<27|b[8]>>>5,$e=b[18]<<20|b[19]>>>12,Ye=b[19]<<20|b[18]>>>12,An=b[29]<<7|b[28]>>>25,En=b[28]<<7|b[29]>>>25,li=b[38]<<8|b[39]>>>24,st=b[39]<<8|b[38]>>>24,Mi=b[48]<<14|b[49]>>>18,Ke=b[49]<<14|b[48]>>>18,b[0]=Et^~Ri&It,b[1]=bt^~St&Bi,b[10]=We^~$e&oi,b[11]=si^~Ye&Je,b[20]=ui^~rt&nt,b[21]=tt^~ci&it,b[30]=at^~hi<,b[31]=ut^~ct&di,b[40]=gt^~pt&An,b[41]=pi^~mt&En,b[2]=Ri^~It&_t,b[3]=St^~Bi&Tt,b[12]=$e^~oi&Xe,b[13]=Ye^~Je&ai,b[22]=rt^~nt&li,b[23]=ci^~it&st,b[32]=hi^~lt&ft,b[33]=ct^~di&ht,b[42]=pt^~An&bn,b[43]=mt^~En&Sn,b[4]=It^~_t&Mi,b[5]=Bi^~Tt&Ke,b[14]=oi^~Xe&Ze,b[15]=Je^~ai&et,b[24]=nt^~li&ot,b[25]=it^~st&fi,b[34]=lt^~ft&gi,b[35]=di^~ht&dt,b[44]=An^~bn&In,b[45]=En^~Sn&_n,b[6]=_t^~Mi&Et,b[7]=Tt^~Ke&bt,b[16]=Xe^~Ze&We,b[17]=ai^~et&si,b[26]=li^~ot&ui,b[27]=st^~fi&tt,b[36]=ft^~gi&at,b[37]=ht^~dt&ut,b[46]=bn^~In>,b[47]=Sn^~_n&pi,b[8]=Mi^~Et&Ri,b[9]=Ke^~bt&St,b[18]=Ze^~We&$e,b[19]=et^~si&Ye,b[28]=ot^~ui&rt,b[29]=fi^~tt&ci,b[38]=gi^~at&hi,b[39]=dt^~ut&ct,b[48]=In^~gt&pt,b[49]=_n^~pi&mt,b[0]^=N[W],b[1]^=N[W+1]};if(u)t.exports=g;else for(E=0;E{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var IM=Hte(),N_;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(N_||(N_={}));var Ti;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ti||(Ti={}));var _M="0123456789abcdef",kt=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let n=e.toLowerCase();Qm[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(SM>Qm[n])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,n){if(bM)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(a=>{let c=n[a];try{if(c instanceof Uint8Array){let f="";for(let d=0;d>4],f+=_M[c[d]&15];i.push(a+"=Uint8Array(0x"+f+")")}else i.push(a+"="+JSON.stringify(c))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);let s=e,o="";switch(r){case Ti.NUMERIC_FAULT:{o="NUMERIC_FAULT";let a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":o+="-"+a;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Ti.CALL_EXCEPTION:case Ti.INSUFFICIENT_FUNDS:case Ti.MISSING_NEW:case Ti.NONCE_EXPIRED:case Ti.REPLACEMENT_UNDERPRICED:case Ti.TRANSACTION_REPLACED:case Ti.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let u=new Error(e);return u.reason=s,u.code=r,Object.keys(n).forEach(function(a){u[a]=n[a]}),u}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){IM&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:IM})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return h_||(h_=new t(kte)),h_}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),EM){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}bM=!!e,EM=!!r}static setLogLevel(e){let r=Qm[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}SM=r}static from(e){return new t(e)}};kt.errors=Ti,kt.levels=N_;var Gte="bytes/5.7.0",tr=new kt(Gte);function v4(t){return!!t.toHexString}function rl(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return rl(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function jte(t){return pn(t)&&!(t.length%2)||cl(t)}function TM(t){return typeof t=="number"&&t==t&&t%1===0}function cl(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!TM(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Qt(t,e){if(e||(e={}),typeof t=="number"){tr.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),rl(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),v4(t)&&(t=t.toHexString()),pn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":tr.throwArgumentError("hex data is odd-length","value",t));let n=[];for(let i=0;iQt(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),rl(n)}function Qte(t,e){t=Qt(t),t.length>e&&tr.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),rl(r)}function pn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var d_="0123456789abcdef";function Gr(t,e){if(e||(e={}),typeof t=="number"){tr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=d_[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),v4(t))return t.toHexString();if(pn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":tr.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(cl(t)){let r="0x";for(let n=0;n>4]+d_[i&15]}return r}return tr.throwArgumentError("invalid hexlify value","value",t)}function Kte(t){if(typeof t!="string")t=Gr(t);else if(!pn(t)||t.length%2)return null;return(t.length-2)/2}function CM(t,e,r){return typeof t!="string"?t=Gr(t):(!pn(t)||t.length%2)&&tr.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function fs(t,e){for(typeof t!="string"?t=Gr(t):pn(t)||tr.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&tr.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function A4(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(jte(t)){let r=Qt(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Gr(r.slice(0,32)),e.s=Gr(r.slice(32,64))):r.length===65?(e.r=Gr(r.slice(0,32)),e.s=Gr(r.slice(32,64)),e.v=r[64]):tr.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:tr.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Gr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let i=Qte(Qt(e._vs),32);e._vs=Gr(i);let s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&tr.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;let o=Gr(i);e.s==null?e.s=o:e.s!==o&&tr.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?tr.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&tr.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pn(e.r)?tr.throwArgumentError("signature missing or invalid r","signature",t):e.r=fs(e.r,32),e.s==null||!pn(e.s)?tr.throwArgumentError("signature missing or invalid s","signature",t):e.s=fs(e.s,32);let r=Qt(e.s);r[0]>=128&&tr.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let n=Gr(r);e._vs&&(pn(e._vs)||tr.throwArgumentError("signature invalid _vs","signature",t),e._vs=fs(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&tr.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function j_(t){return"0x"+Vte.keccak_256(Qt(t))}var E4={exports:{}},Wte={},$te=Object.freeze({__proto__:null,default:Wte}),Yte=qte($te);(function(t){(function(e,r){function n(l,g){if(!l)throw new Error(g||"Assertion failed")}function i(l,g){l.super_=g;var y=function(){};y.prototype=g.prototype,l.prototype=new y,l.prototype.constructor=l}function s(l,g,y){if(s.isBN(l))return l;this.negative=0,this.words=null,this.length=0,this.red=null,l!==null&&((g==="le"||g==="be")&&(y=g,g=10),this._init(l||0,g||10,y||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Yte.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,g){return l.cmp(g)>0?l:g},s.min=function(l,g){return l.cmp(g)<0?l:g},s.prototype._init=function(l,g,y){if(typeof l=="number")return this._initNumber(l,g,y);if(typeof l=="object")return this._initArray(l,g,y);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),l=l.toString().replace(/\s+/g,"");var E=0;l[0]==="-"&&(E++,this.negative=1),E=0;E-=3)T=l[E]|l[E-1]<<8|l[E-2]<<16,this.words[I]|=T<>>26-M&67108863,M+=24,M>=26&&(M-=26,I++);else if(y==="le")for(E=0,I=0;E>>26-M&67108863,M+=24,M>=26&&(M-=26,I++);return this._strip()};function u(l,g){var y=l.charCodeAt(g);if(y>=48&&y<=57)return y-48;if(y>=65&&y<=70)return y-55;if(y>=97&&y<=102)return y-87;n(!1,"Invalid character in "+l)}function a(l,g,y){var E=u(l,y);return y-1>=g&&(E|=u(l,y-1)<<4),E}s.prototype._parseHex=function(l,g,y){this.length=Math.ceil((l.length-g)/6),this.words=new Array(this.length);for(var E=0;E=g;E-=2)M=a(l,g,E)<=18?(I-=18,T+=1,this.words[T]|=M>>>26):I+=8;else{var x=l.length-g;for(E=x%2===0?g+1:g;E=18?(I-=18,T+=1,this.words[T]|=M>>>26):I+=8}this._strip()};function c(l,g,y,E){for(var I=0,T=0,M=Math.min(l.length,y),x=g;x=49?T=m-49+10:m>=17?T=m-17+10:T=m,n(m>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{s.prototype.inspect=d}else s.prototype.inspect=d;function d(){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"],A=[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],_=[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];s.prototype.toString=function(l,g){l=l||10,g=g|0||1;var y;if(l===16||l==="hex"){y="";for(var E=0,I=0,T=0;T>>24-E&16777215,E+=2,E>=26&&(E-=26,T--),I!==0||T!==this.length-1?y=w[6-x.length]+x+y:y=x+y}for(I!==0&&(y=I.toString(16)+y);y.length%g!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(l===(l|0)&&l>=2&&l<=36){var m=A[l],O=_[l];y="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var $=Y.modrn(O).toString(l);Y=Y.idivn(O),Y.isZero()?y=$+y:y=w[m-$.length]+$+y}for(this.isZero()&&(y="0"+y);y.length%g!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(l,g){return this.toArrayLike(o,l,g)}),s.prototype.toArray=function(l,g){return this.toArrayLike(Array,l,g)};var N=function(l,g){return l.allocUnsafe?l.allocUnsafe(g):new l(g)};s.prototype.toArrayLike=function(l,g,y){this._strip();var E=this.byteLength(),I=y||Math.max(1,E);n(E<=I,"byte array longer than desired length"),n(I>0,"Requested array length <= 0");var T=N(l,I),M=g==="le"?"LE":"BE";return this["_toArrayLike"+M](T,E),T},s.prototype._toArrayLikeLE=function(l,g){for(var y=0,E=0,I=0,T=0;I>8&255),y>16&255),T===6?(y>24&255),E=0,T=0):(E=M>>>24,T+=2)}if(y=0&&(l[y--]=M>>8&255),y>=0&&(l[y--]=M>>16&255),T===6?(y>=0&&(l[y--]=M>>24&255),E=0,T=0):(E=M>>>24,T+=2)}if(y>=0)for(l[y--]=E;y>=0;)l[y--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var g=l,y=0;return g>=4096&&(y+=13,g>>>=13),g>=64&&(y+=7,g>>>=7),g>=8&&(y+=4,g>>>=4),g>=2&&(y+=2,g>>>=2),y+g},s.prototype._zeroBits=function(l){if(l===0)return 26;var g=l,y=0;return g&8191||(y+=13,g>>>=13),g&127||(y+=7,g>>>=7),g&15||(y+=4,g>>>=4),g&3||(y+=2,g>>>=2),g&1||y++,y},s.prototype.bitLength=function(){var l=this.words[this.length-1],g=this._countBits(l);return(this.length-1)*26+g};function P(l){for(var g=new Array(l.bitLength()),y=0;y>>I&1}return g}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,g=0;gl.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var g;this.length>l.length?g=l:g=this;for(var y=0;yl.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var g,y;this.length>l.length?(g=this,y=l):(g=l,y=this);for(var E=0;El.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){n(typeof l=="number"&&l>=0);var g=Math.ceil(l/26)|0,y=l%26;this._expand(g),y>0&&g--;for(var E=0;E0&&(this.words[E]=~this.words[E]&67108863>>26-y),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,g){n(typeof l=="number"&&l>=0);var y=l/26|0,E=l%26;return this._expand(y+1),g?this.words[y]=this.words[y]|1<l.length?(y=this,E=l):(y=l,E=this);for(var I=0,T=0;T>>26;for(;I!==0&&T>>26;if(this.length=y.length,I!==0)this.words[this.length]=I,this.length++;else if(y!==this)for(;Tl.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var g=this.iadd(l);return l.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var y=this.cmp(l);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,I;y>0?(E=this,I=l):(E=l,I=this);for(var T=0,M=0;M>26,this.words[M]=g&67108863;for(;T!==0&&M>26,this.words[M]=g&67108863;if(T===0&&M>>26,$=m&67108863,b=Math.min(O,g.length-1),j=Math.max(0,O-l.length+1);j<=b;j++){var z=O-j|0;I=l.words[z]|0,T=g.words[j]|0,M=I*T+$,Y+=M/67108864|0,$=M&67108863}y.words[O]=$|0,m=Y|0}return m!==0?y.words[O]=m|0:y.length--,y._strip()}var U=function(l,g,y){var E=l.words,I=g.words,T=y.words,M=0,x,m,O,Y=E[0]|0,$=Y&8191,b=Y>>>13,j=E[1]|0,z=j&8191,W=j>>>13,ie=E[2]|0,te=ie&8191,ee=ie>>>13,se=E[3]|0,oe=se&8191,J=se>>>13,ue=E[4]|0,vt=ue&8191,At=ue>>>13,Pi=E[5]|0,Et=Pi&8191,bt=Pi>>>13,Ri=E[6]|0,St=Ri&8191,It=Ri>>>13,Bi=E[7]|0,_t=Bi&8191,Tt=Bi>>>13,Mi=E[8]|0,Ke=Mi&8191,We=Mi>>>13,si=E[9]|0,$e=si&8191,Ye=si>>>13,oi=I[0]|0,Je=oi&8191,Xe=oi>>>13,ai=I[1]|0,Ze=ai&8191,et=ai>>>13,ui=I[2]|0,tt=ui&8191,rt=ui>>>13,ci=I[3]|0,nt=ci&8191,it=ci>>>13,li=I[4]|0,st=li&8191,ot=li>>>13,fi=I[5]|0,at=fi&8191,ut=fi>>>13,hi=I[6]|0,ct=hi&8191,lt=hi>>>13,di=I[7]|0,ft=di&8191,ht=di>>>13,gi=I[8]|0,dt=gi&8191,gt=gi>>>13,pi=I[9]|0,pt=pi&8191,mt=pi>>>13;y.negative=l.negative^g.negative,y.length=19,x=Math.imul($,Je),m=Math.imul($,Xe),m=m+Math.imul(b,Je)|0,O=Math.imul(b,Xe);var An=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(An>>>26)|0,An&=67108863,x=Math.imul(z,Je),m=Math.imul(z,Xe),m=m+Math.imul(W,Je)|0,O=Math.imul(W,Xe),x=x+Math.imul($,Ze)|0,m=m+Math.imul($,et)|0,m=m+Math.imul(b,Ze)|0,O=O+Math.imul(b,et)|0;var En=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(En>>>26)|0,En&=67108863,x=Math.imul(te,Je),m=Math.imul(te,Xe),m=m+Math.imul(ee,Je)|0,O=Math.imul(ee,Xe),x=x+Math.imul(z,Ze)|0,m=m+Math.imul(z,et)|0,m=m+Math.imul(W,Ze)|0,O=O+Math.imul(W,et)|0,x=x+Math.imul($,tt)|0,m=m+Math.imul($,rt)|0,m=m+Math.imul(b,tt)|0,O=O+Math.imul(b,rt)|0;var bn=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(bn>>>26)|0,bn&=67108863,x=Math.imul(oe,Je),m=Math.imul(oe,Xe),m=m+Math.imul(J,Je)|0,O=Math.imul(J,Xe),x=x+Math.imul(te,Ze)|0,m=m+Math.imul(te,et)|0,m=m+Math.imul(ee,Ze)|0,O=O+Math.imul(ee,et)|0,x=x+Math.imul(z,tt)|0,m=m+Math.imul(z,rt)|0,m=m+Math.imul(W,tt)|0,O=O+Math.imul(W,rt)|0,x=x+Math.imul($,nt)|0,m=m+Math.imul($,it)|0,m=m+Math.imul(b,nt)|0,O=O+Math.imul(b,it)|0;var Sn=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,x=Math.imul(vt,Je),m=Math.imul(vt,Xe),m=m+Math.imul(At,Je)|0,O=Math.imul(At,Xe),x=x+Math.imul(oe,Ze)|0,m=m+Math.imul(oe,et)|0,m=m+Math.imul(J,Ze)|0,O=O+Math.imul(J,et)|0,x=x+Math.imul(te,tt)|0,m=m+Math.imul(te,rt)|0,m=m+Math.imul(ee,tt)|0,O=O+Math.imul(ee,rt)|0,x=x+Math.imul(z,nt)|0,m=m+Math.imul(z,it)|0,m=m+Math.imul(W,nt)|0,O=O+Math.imul(W,it)|0,x=x+Math.imul($,st)|0,m=m+Math.imul($,ot)|0,m=m+Math.imul(b,st)|0,O=O+Math.imul(b,ot)|0;var In=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(In>>>26)|0,In&=67108863,x=Math.imul(Et,Je),m=Math.imul(Et,Xe),m=m+Math.imul(bt,Je)|0,O=Math.imul(bt,Xe),x=x+Math.imul(vt,Ze)|0,m=m+Math.imul(vt,et)|0,m=m+Math.imul(At,Ze)|0,O=O+Math.imul(At,et)|0,x=x+Math.imul(oe,tt)|0,m=m+Math.imul(oe,rt)|0,m=m+Math.imul(J,tt)|0,O=O+Math.imul(J,rt)|0,x=x+Math.imul(te,nt)|0,m=m+Math.imul(te,it)|0,m=m+Math.imul(ee,nt)|0,O=O+Math.imul(ee,it)|0,x=x+Math.imul(z,st)|0,m=m+Math.imul(z,ot)|0,m=m+Math.imul(W,st)|0,O=O+Math.imul(W,ot)|0,x=x+Math.imul($,at)|0,m=m+Math.imul($,ut)|0,m=m+Math.imul(b,at)|0,O=O+Math.imul(b,ut)|0;var _n=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(_n>>>26)|0,_n&=67108863,x=Math.imul(St,Je),m=Math.imul(St,Xe),m=m+Math.imul(It,Je)|0,O=Math.imul(It,Xe),x=x+Math.imul(Et,Ze)|0,m=m+Math.imul(Et,et)|0,m=m+Math.imul(bt,Ze)|0,O=O+Math.imul(bt,et)|0,x=x+Math.imul(vt,tt)|0,m=m+Math.imul(vt,rt)|0,m=m+Math.imul(At,tt)|0,O=O+Math.imul(At,rt)|0,x=x+Math.imul(oe,nt)|0,m=m+Math.imul(oe,it)|0,m=m+Math.imul(J,nt)|0,O=O+Math.imul(J,it)|0,x=x+Math.imul(te,st)|0,m=m+Math.imul(te,ot)|0,m=m+Math.imul(ee,st)|0,O=O+Math.imul(ee,ot)|0,x=x+Math.imul(z,at)|0,m=m+Math.imul(z,ut)|0,m=m+Math.imul(W,at)|0,O=O+Math.imul(W,ut)|0,x=x+Math.imul($,ct)|0,m=m+Math.imul($,lt)|0,m=m+Math.imul(b,ct)|0,O=O+Math.imul(b,lt)|0;var la=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(la>>>26)|0,la&=67108863,x=Math.imul(_t,Je),m=Math.imul(_t,Xe),m=m+Math.imul(Tt,Je)|0,O=Math.imul(Tt,Xe),x=x+Math.imul(St,Ze)|0,m=m+Math.imul(St,et)|0,m=m+Math.imul(It,Ze)|0,O=O+Math.imul(It,et)|0,x=x+Math.imul(Et,tt)|0,m=m+Math.imul(Et,rt)|0,m=m+Math.imul(bt,tt)|0,O=O+Math.imul(bt,rt)|0,x=x+Math.imul(vt,nt)|0,m=m+Math.imul(vt,it)|0,m=m+Math.imul(At,nt)|0,O=O+Math.imul(At,it)|0,x=x+Math.imul(oe,st)|0,m=m+Math.imul(oe,ot)|0,m=m+Math.imul(J,st)|0,O=O+Math.imul(J,ot)|0,x=x+Math.imul(te,at)|0,m=m+Math.imul(te,ut)|0,m=m+Math.imul(ee,at)|0,O=O+Math.imul(ee,ut)|0,x=x+Math.imul(z,ct)|0,m=m+Math.imul(z,lt)|0,m=m+Math.imul(W,ct)|0,O=O+Math.imul(W,lt)|0,x=x+Math.imul($,ft)|0,m=m+Math.imul($,ht)|0,m=m+Math.imul(b,ft)|0,O=O+Math.imul(b,ht)|0;var fa=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(fa>>>26)|0,fa&=67108863,x=Math.imul(Ke,Je),m=Math.imul(Ke,Xe),m=m+Math.imul(We,Je)|0,O=Math.imul(We,Xe),x=x+Math.imul(_t,Ze)|0,m=m+Math.imul(_t,et)|0,m=m+Math.imul(Tt,Ze)|0,O=O+Math.imul(Tt,et)|0,x=x+Math.imul(St,tt)|0,m=m+Math.imul(St,rt)|0,m=m+Math.imul(It,tt)|0,O=O+Math.imul(It,rt)|0,x=x+Math.imul(Et,nt)|0,m=m+Math.imul(Et,it)|0,m=m+Math.imul(bt,nt)|0,O=O+Math.imul(bt,it)|0,x=x+Math.imul(vt,st)|0,m=m+Math.imul(vt,ot)|0,m=m+Math.imul(At,st)|0,O=O+Math.imul(At,ot)|0,x=x+Math.imul(oe,at)|0,m=m+Math.imul(oe,ut)|0,m=m+Math.imul(J,at)|0,O=O+Math.imul(J,ut)|0,x=x+Math.imul(te,ct)|0,m=m+Math.imul(te,lt)|0,m=m+Math.imul(ee,ct)|0,O=O+Math.imul(ee,lt)|0,x=x+Math.imul(z,ft)|0,m=m+Math.imul(z,ht)|0,m=m+Math.imul(W,ft)|0,O=O+Math.imul(W,ht)|0,x=x+Math.imul($,dt)|0,m=m+Math.imul($,gt)|0,m=m+Math.imul(b,dt)|0,O=O+Math.imul(b,gt)|0;var ha=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ha>>>26)|0,ha&=67108863,x=Math.imul($e,Je),m=Math.imul($e,Xe),m=m+Math.imul(Ye,Je)|0,O=Math.imul(Ye,Xe),x=x+Math.imul(Ke,Ze)|0,m=m+Math.imul(Ke,et)|0,m=m+Math.imul(We,Ze)|0,O=O+Math.imul(We,et)|0,x=x+Math.imul(_t,tt)|0,m=m+Math.imul(_t,rt)|0,m=m+Math.imul(Tt,tt)|0,O=O+Math.imul(Tt,rt)|0,x=x+Math.imul(St,nt)|0,m=m+Math.imul(St,it)|0,m=m+Math.imul(It,nt)|0,O=O+Math.imul(It,it)|0,x=x+Math.imul(Et,st)|0,m=m+Math.imul(Et,ot)|0,m=m+Math.imul(bt,st)|0,O=O+Math.imul(bt,ot)|0,x=x+Math.imul(vt,at)|0,m=m+Math.imul(vt,ut)|0,m=m+Math.imul(At,at)|0,O=O+Math.imul(At,ut)|0,x=x+Math.imul(oe,ct)|0,m=m+Math.imul(oe,lt)|0,m=m+Math.imul(J,ct)|0,O=O+Math.imul(J,lt)|0,x=x+Math.imul(te,ft)|0,m=m+Math.imul(te,ht)|0,m=m+Math.imul(ee,ft)|0,O=O+Math.imul(ee,ht)|0,x=x+Math.imul(z,dt)|0,m=m+Math.imul(z,gt)|0,m=m+Math.imul(W,dt)|0,O=O+Math.imul(W,gt)|0,x=x+Math.imul($,pt)|0,m=m+Math.imul($,mt)|0,m=m+Math.imul(b,pt)|0,O=O+Math.imul(b,mt)|0;var da=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(da>>>26)|0,da&=67108863,x=Math.imul($e,Ze),m=Math.imul($e,et),m=m+Math.imul(Ye,Ze)|0,O=Math.imul(Ye,et),x=x+Math.imul(Ke,tt)|0,m=m+Math.imul(Ke,rt)|0,m=m+Math.imul(We,tt)|0,O=O+Math.imul(We,rt)|0,x=x+Math.imul(_t,nt)|0,m=m+Math.imul(_t,it)|0,m=m+Math.imul(Tt,nt)|0,O=O+Math.imul(Tt,it)|0,x=x+Math.imul(St,st)|0,m=m+Math.imul(St,ot)|0,m=m+Math.imul(It,st)|0,O=O+Math.imul(It,ot)|0,x=x+Math.imul(Et,at)|0,m=m+Math.imul(Et,ut)|0,m=m+Math.imul(bt,at)|0,O=O+Math.imul(bt,ut)|0,x=x+Math.imul(vt,ct)|0,m=m+Math.imul(vt,lt)|0,m=m+Math.imul(At,ct)|0,O=O+Math.imul(At,lt)|0,x=x+Math.imul(oe,ft)|0,m=m+Math.imul(oe,ht)|0,m=m+Math.imul(J,ft)|0,O=O+Math.imul(J,ht)|0,x=x+Math.imul(te,dt)|0,m=m+Math.imul(te,gt)|0,m=m+Math.imul(ee,dt)|0,O=O+Math.imul(ee,gt)|0,x=x+Math.imul(z,pt)|0,m=m+Math.imul(z,mt)|0,m=m+Math.imul(W,pt)|0,O=O+Math.imul(W,mt)|0;var ga=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ga>>>26)|0,ga&=67108863,x=Math.imul($e,tt),m=Math.imul($e,rt),m=m+Math.imul(Ye,tt)|0,O=Math.imul(Ye,rt),x=x+Math.imul(Ke,nt)|0,m=m+Math.imul(Ke,it)|0,m=m+Math.imul(We,nt)|0,O=O+Math.imul(We,it)|0,x=x+Math.imul(_t,st)|0,m=m+Math.imul(_t,ot)|0,m=m+Math.imul(Tt,st)|0,O=O+Math.imul(Tt,ot)|0,x=x+Math.imul(St,at)|0,m=m+Math.imul(St,ut)|0,m=m+Math.imul(It,at)|0,O=O+Math.imul(It,ut)|0,x=x+Math.imul(Et,ct)|0,m=m+Math.imul(Et,lt)|0,m=m+Math.imul(bt,ct)|0,O=O+Math.imul(bt,lt)|0,x=x+Math.imul(vt,ft)|0,m=m+Math.imul(vt,ht)|0,m=m+Math.imul(At,ft)|0,O=O+Math.imul(At,ht)|0,x=x+Math.imul(oe,dt)|0,m=m+Math.imul(oe,gt)|0,m=m+Math.imul(J,dt)|0,O=O+Math.imul(J,gt)|0,x=x+Math.imul(te,pt)|0,m=m+Math.imul(te,mt)|0,m=m+Math.imul(ee,pt)|0,O=O+Math.imul(ee,mt)|0;var pa=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(pa>>>26)|0,pa&=67108863,x=Math.imul($e,nt),m=Math.imul($e,it),m=m+Math.imul(Ye,nt)|0,O=Math.imul(Ye,it),x=x+Math.imul(Ke,st)|0,m=m+Math.imul(Ke,ot)|0,m=m+Math.imul(We,st)|0,O=O+Math.imul(We,ot)|0,x=x+Math.imul(_t,at)|0,m=m+Math.imul(_t,ut)|0,m=m+Math.imul(Tt,at)|0,O=O+Math.imul(Tt,ut)|0,x=x+Math.imul(St,ct)|0,m=m+Math.imul(St,lt)|0,m=m+Math.imul(It,ct)|0,O=O+Math.imul(It,lt)|0,x=x+Math.imul(Et,ft)|0,m=m+Math.imul(Et,ht)|0,m=m+Math.imul(bt,ft)|0,O=O+Math.imul(bt,ht)|0,x=x+Math.imul(vt,dt)|0,m=m+Math.imul(vt,gt)|0,m=m+Math.imul(At,dt)|0,O=O+Math.imul(At,gt)|0,x=x+Math.imul(oe,pt)|0,m=m+Math.imul(oe,mt)|0,m=m+Math.imul(J,pt)|0,O=O+Math.imul(J,mt)|0;var ma=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ma>>>26)|0,ma&=67108863,x=Math.imul($e,st),m=Math.imul($e,ot),m=m+Math.imul(Ye,st)|0,O=Math.imul(Ye,ot),x=x+Math.imul(Ke,at)|0,m=m+Math.imul(Ke,ut)|0,m=m+Math.imul(We,at)|0,O=O+Math.imul(We,ut)|0,x=x+Math.imul(_t,ct)|0,m=m+Math.imul(_t,lt)|0,m=m+Math.imul(Tt,ct)|0,O=O+Math.imul(Tt,lt)|0,x=x+Math.imul(St,ft)|0,m=m+Math.imul(St,ht)|0,m=m+Math.imul(It,ft)|0,O=O+Math.imul(It,ht)|0,x=x+Math.imul(Et,dt)|0,m=m+Math.imul(Et,gt)|0,m=m+Math.imul(bt,dt)|0,O=O+Math.imul(bt,gt)|0,x=x+Math.imul(vt,pt)|0,m=m+Math.imul(vt,mt)|0,m=m+Math.imul(At,pt)|0,O=O+Math.imul(At,mt)|0;var ya=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ya>>>26)|0,ya&=67108863,x=Math.imul($e,at),m=Math.imul($e,ut),m=m+Math.imul(Ye,at)|0,O=Math.imul(Ye,ut),x=x+Math.imul(Ke,ct)|0,m=m+Math.imul(Ke,lt)|0,m=m+Math.imul(We,ct)|0,O=O+Math.imul(We,lt)|0,x=x+Math.imul(_t,ft)|0,m=m+Math.imul(_t,ht)|0,m=m+Math.imul(Tt,ft)|0,O=O+Math.imul(Tt,ht)|0,x=x+Math.imul(St,dt)|0,m=m+Math.imul(St,gt)|0,m=m+Math.imul(It,dt)|0,O=O+Math.imul(It,gt)|0,x=x+Math.imul(Et,pt)|0,m=m+Math.imul(Et,mt)|0,m=m+Math.imul(bt,pt)|0,O=O+Math.imul(bt,mt)|0;var wa=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(wa>>>26)|0,wa&=67108863,x=Math.imul($e,ct),m=Math.imul($e,lt),m=m+Math.imul(Ye,ct)|0,O=Math.imul(Ye,lt),x=x+Math.imul(Ke,ft)|0,m=m+Math.imul(Ke,ht)|0,m=m+Math.imul(We,ft)|0,O=O+Math.imul(We,ht)|0,x=x+Math.imul(_t,dt)|0,m=m+Math.imul(_t,gt)|0,m=m+Math.imul(Tt,dt)|0,O=O+Math.imul(Tt,gt)|0,x=x+Math.imul(St,pt)|0,m=m+Math.imul(St,mt)|0,m=m+Math.imul(It,pt)|0,O=O+Math.imul(It,mt)|0;var ww=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(ww>>>26)|0,ww&=67108863,x=Math.imul($e,ft),m=Math.imul($e,ht),m=m+Math.imul(Ye,ft)|0,O=Math.imul(Ye,ht),x=x+Math.imul(Ke,dt)|0,m=m+Math.imul(Ke,gt)|0,m=m+Math.imul(We,dt)|0,O=O+Math.imul(We,gt)|0,x=x+Math.imul(_t,pt)|0,m=m+Math.imul(_t,mt)|0,m=m+Math.imul(Tt,pt)|0,O=O+Math.imul(Tt,mt)|0;var vw=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(vw>>>26)|0,vw&=67108863,x=Math.imul($e,dt),m=Math.imul($e,gt),m=m+Math.imul(Ye,dt)|0,O=Math.imul(Ye,gt),x=x+Math.imul(Ke,pt)|0,m=m+Math.imul(Ke,mt)|0,m=m+Math.imul(We,pt)|0,O=O+Math.imul(We,mt)|0;var Aw=(M+x|0)+((m&8191)<<13)|0;M=(O+(m>>>13)|0)+(Aw>>>26)|0,Aw&=67108863,x=Math.imul($e,pt),m=Math.imul($e,mt),m=m+Math.imul(Ye,pt)|0,O=Math.imul(Ye,mt);var Ew=(M+x|0)+((m&8191)<<13)|0;return M=(O+(m>>>13)|0)+(Ew>>>26)|0,Ew&=67108863,T[0]=An,T[1]=En,T[2]=bn,T[3]=Sn,T[4]=In,T[5]=_n,T[6]=la,T[7]=fa,T[8]=ha,T[9]=da,T[10]=ga,T[11]=pa,T[12]=ma,T[13]=ya,T[14]=wa,T[15]=ww,T[16]=vw,T[17]=Aw,T[18]=Ew,M!==0&&(T[19]=M,y.length++),y};Math.imul||(U=V);function Q(l,g,y){y.negative=g.negative^l.negative,y.length=l.length+g.length;for(var E=0,I=0,T=0;T>>26)|0,I+=M>>>26,M&=67108863}y.words[T]=x,E=M,M=I}return E!==0?y.words[T]=E:y.length--,y._strip()}function L(l,g,y){return Q(l,g,y)}s.prototype.mulTo=function(l,g){var y,E=this.length+l.length;return this.length===10&&l.length===10?y=U(this,l,g):E<63?y=V(this,l,g):E<1024?y=Q(this,l,g):y=L(this,l,g),y},s.prototype.mul=function(l){var g=new s(null);return g.words=new Array(this.length+l.length),this.mulTo(l,g)},s.prototype.mulf=function(l){var g=new s(null);return g.words=new Array(this.length+l.length),L(this,l,g)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var g=l<0;g&&(l=-l),n(typeof l=="number"),n(l<67108864);for(var y=0,E=0;E>=26,y+=I/67108864|0,y+=T>>>26,this.words[E]=T&67108863}return y!==0&&(this.words[E]=y,this.length++),g?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var g=P(l);if(g.length===0)return new s(1);for(var y=this,E=0;E=0);var g=l%26,y=(l-g)/26,E=67108863>>>26-g<<26-g,I;if(g!==0){var T=0;for(I=0;I>>26-g}T&&(this.words[I]=T,this.length++)}if(y!==0){for(I=this.length-1;I>=0;I--)this.words[I+y]=this.words[I];for(I=0;I=0);var E;g?E=(g-g%26)/26:E=0;var I=l%26,T=Math.min((l-I)/26,this.length),M=67108863^67108863>>>I<T)for(this.length-=T,m=0;m=0&&(O!==0||m>=E);m--){var Y=this.words[m]|0;this.words[m]=O<<26-I|Y>>>I,O=Y&M}return x&&O!==0&&(x.words[x.length++]=O),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,g,y){return n(this.negative===0),this.iushrn(l,g,y)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){n(typeof l=="number"&&l>=0);var g=l%26,y=(l-g)/26,E=1<=0);var g=l%26,y=(l-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(g!==0&&y++,this.length=Math.min(y,this.length),g!==0){var E=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(l){if(n(typeof l=="number"),n(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(x/67108864|0),this.words[I+y]=T&67108863}for(;I>26,this.words[I+y]=T&67108863;if(M===0)return this._strip();for(n(M===-1),M=0,I=0;I>26,this.words[I]=T&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,g){var y=this.length-l.length,E=this.clone(),I=l,T=I.words[I.length-1]|0,M=this._countBits(T);y=26-M,y!==0&&(I=I.ushln(y),E.iushln(y),T=I.words[I.length-1]|0);var x=E.length-I.length,m;if(g!=="mod"){m=new s(null),m.length=x+1,m.words=new Array(m.length);for(var O=0;O=0;$--){var b=(E.words[I.length+$]|0)*67108864+(E.words[I.length+$-1]|0);for(b=Math.min(b/T|0,67108863),E._ishlnsubmul(I,b,$);E.negative!==0;)b--,E.negative=0,E._ishlnsubmul(I,1,$),E.isZero()||(E.negative^=1);m&&(m.words[$]=b)}return m&&m._strip(),E._strip(),g!=="div"&&y!==0&&E.iushrn(y),{div:m||null,mod:E}},s.prototype.divmod=function(l,g,y){if(n(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var E,I,T;return this.negative!==0&&l.negative===0?(T=this.neg().divmod(l,g),g!=="mod"&&(E=T.div.neg()),g!=="div"&&(I=T.mod.neg(),y&&I.negative!==0&&I.iadd(l)),{div:E,mod:I}):this.negative===0&&l.negative!==0?(T=this.divmod(l.neg(),g),g!=="mod"&&(E=T.div.neg()),{div:E,mod:T.mod}):this.negative&l.negative?(T=this.neg().divmod(l.neg(),g),g!=="div"&&(I=T.mod.neg(),y&&I.negative!==0&&I.isub(l)),{div:T.div,mod:I}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?g==="div"?{div:this.divn(l.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,g)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var g=this.divmod(l);if(g.mod.isZero())return g.div;var y=g.div.negative!==0?g.mod.isub(l):g.mod,E=l.ushrn(1),I=l.andln(1),T=y.cmp(E);return T<0||I===1&&T===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(l){var g=l<0;g&&(l=-l),n(l<=67108863);for(var y=(1<<26)%l,E=0,I=this.length-1;I>=0;I--)E=(y*E+(this.words[I]|0))%l;return g?-E:E},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var g=l<0;g&&(l=-l),n(l<=67108863);for(var y=0,E=this.length-1;E>=0;E--){var I=(this.words[E]|0)+y*67108864;this.words[E]=I/l|0,y=I%l}return this._strip(),g?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){n(l.negative===0),n(!l.isZero());var g=this,y=l.clone();g.negative!==0?g=g.umod(l):g=g.clone();for(var E=new s(1),I=new s(0),T=new s(0),M=new s(1),x=0;g.isEven()&&y.isEven();)g.iushrn(1),y.iushrn(1),++x;for(var m=y.clone(),O=g.clone();!g.isZero();){for(var Y=0,$=1;!(g.words[0]&$)&&Y<26;++Y,$<<=1);if(Y>0)for(g.iushrn(Y);Y-- >0;)(E.isOdd()||I.isOdd())&&(E.iadd(m),I.isub(O)),E.iushrn(1),I.iushrn(1);for(var b=0,j=1;!(y.words[0]&j)&&b<26;++b,j<<=1);if(b>0)for(y.iushrn(b);b-- >0;)(T.isOdd()||M.isOdd())&&(T.iadd(m),M.isub(O)),T.iushrn(1),M.iushrn(1);g.cmp(y)>=0?(g.isub(y),E.isub(T),I.isub(M)):(y.isub(g),T.isub(E),M.isub(I))}return{a:T,b:M,gcd:y.iushln(x)}},s.prototype._invmp=function(l){n(l.negative===0),n(!l.isZero());var g=this,y=l.clone();g.negative!==0?g=g.umod(l):g=g.clone();for(var E=new s(1),I=new s(0),T=y.clone();g.cmpn(1)>0&&y.cmpn(1)>0;){for(var M=0,x=1;!(g.words[0]&x)&&M<26;++M,x<<=1);if(M>0)for(g.iushrn(M);M-- >0;)E.isOdd()&&E.iadd(T),E.iushrn(1);for(var m=0,O=1;!(y.words[0]&O)&&m<26;++m,O<<=1);if(m>0)for(y.iushrn(m);m-- >0;)I.isOdd()&&I.iadd(T),I.iushrn(1);g.cmp(y)>=0?(g.isub(y),E.isub(I)):(y.isub(g),I.isub(E))}var Y;return g.cmpn(1)===0?Y=E:Y=I,Y.cmpn(0)<0&&Y.iadd(l),Y},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var g=this.clone(),y=l.clone();g.negative=0,y.negative=0;for(var E=0;g.isEven()&&y.isEven();E++)g.iushrn(1),y.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;y.isEven();)y.iushrn(1);var I=g.cmp(y);if(I<0){var T=g;g=y,y=T}else if(I===0||y.cmpn(1)===0)break;g.isub(y)}while(!0);return y.iushln(E)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){n(typeof l=="number");var g=l%26,y=(l-g)/26,E=1<>>26,M&=67108863,this.words[T]=M}return I!==0&&(this.words[T]=I,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var g=l<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var y;if(this.length>1)y=1;else{g&&(l=-l),n(l<=67108863,"Number is too big");var E=this.words[0]|0;y=E===l?0:El.length)return 1;if(this.length=0;y--){var E=this.words[y]|0,I=l.words[y]|0;if(E!==I){EI&&(g=1);break}}return g},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new F(l)},s.prototype.toRed=function(l){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return n(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return n(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var k={k256:null,p224:null,p192:null,p25519:null};function H(l,g){this.name=l,this.p=new s(g,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}H.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},H.prototype.ireduce=function(l){var g=l,y;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),y=g.bitLength();while(y>this.n);var E=y0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},H.prototype.split=function(l,g){l.iushrn(this.n,0,g)},H.prototype.imulK=function(l){return l.imul(this.k)};function q(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,H),q.prototype.split=function(l,g){for(var y=4194303,E=Math.min(l.length,9),I=0;I>>22,T=M}T>>>=22,l.words[I-10]=T,T===0&&l.length>10?l.length-=10:l.length-=9},q.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var g=0,y=0;y>>=26,l.words[y]=I,g=E}return g!==0&&(l.words[l.length++]=g),l},s._prime=function(l){if(k[l])return k[l];var g;if(l==="k256")g=new q;else if(l==="p224")g=new v;else if(l==="p192")g=new C;else if(l==="p25519")g=new R;else throw new Error("Unknown prime "+l);return k[l]=g,g};function F(l){if(typeof l=="string"){var g=s._prime(l);this.m=g.p,this.prime=g}else n(l.gtn(1),"modulus must be greater than 1"),this.m=l,this.prime=null}F.prototype._verify1=function(l){n(l.negative===0,"red works only with positives"),n(l.red,"red works only with red numbers")},F.prototype._verify2=function(l,g){n((l.negative|g.negative)===0,"red works only with positives"),n(l.red&&l.red===g.red,"red works only with red numbers")},F.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(f(l,l.umod(this.m)._forceRed(this)),l)},F.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},F.prototype.add=function(l,g){this._verify2(l,g);var y=l.add(g);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},F.prototype.iadd=function(l,g){this._verify2(l,g);var y=l.iadd(g);return y.cmp(this.m)>=0&&y.isub(this.m),y},F.prototype.sub=function(l,g){this._verify2(l,g);var y=l.sub(g);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},F.prototype.isub=function(l,g){this._verify2(l,g);var y=l.isub(g);return y.cmpn(0)<0&&y.iadd(this.m),y},F.prototype.shl=function(l,g){return this._verify1(l),this.imod(l.ushln(g))},F.prototype.imul=function(l,g){return this._verify2(l,g),this.imod(l.imul(g))},F.prototype.mul=function(l,g){return this._verify2(l,g),this.imod(l.mul(g))},F.prototype.isqr=function(l){return this.imul(l,l.clone())},F.prototype.sqr=function(l){return this.mul(l,l)},F.prototype.sqrt=function(l){if(l.isZero())return l.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var y=this.m.add(new s(1)).iushrn(2);return this.pow(l,y)}for(var E=this.m.subn(1),I=0;!E.isZero()&&E.andln(1)===0;)I++,E.iushrn(1);n(!E.isZero());var T=new s(1).toRed(this),M=T.redNeg(),x=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new s(2*m*m).toRed(this);this.pow(m,x).cmp(M)!==0;)m.redIAdd(M);for(var O=this.pow(m,E),Y=this.pow(l,E.addn(1).iushrn(1)),$=this.pow(l,E),b=I;$.cmp(T)!==0;){for(var j=$,z=0;j.cmp(T)!==0;z++)j=j.redSqr();n(z=0;I--){for(var O=g.words[I],Y=m-1;Y>=0;Y--){var $=O>>Y&1;if(T!==E[0]&&(T=this.sqr(T)),$===0&&M===0){x=0;continue}M<<=1,M|=$,x++,!(x!==y&&(I!==0||Y!==0))&&(T=this.mul(T,E[M]),x=0,M=0)}m=26}return T},F.prototype.convertTo=function(l){var g=l.umod(this.m);return g===l?g.clone():g},F.prototype.convertFrom=function(l){var g=l.clone();return g.red=null,g},s.mont=function(l){return new B(l)};function B(l){F.call(this,l),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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(B,F),B.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},B.prototype.convertFrom=function(l){var g=this.imod(l.mul(this.rinv));return g.red=null,g},B.prototype.imul=function(l,g){if(l.isZero()||g.isZero())return l.words[0]=0,l.length=1,l;var y=l.imul(g),E=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=y.isub(E).iushrn(this.shift),T=I;return I.cmp(this.m)>=0?T=I.isub(this.m):I.cmpn(0)<0&&(T=I.iadd(this.m)),T._forceRed(this)},B.prototype.mul=function(l,g){if(l.isZero()||g.isZero())return new s(0)._forceRed(this);var y=l.mul(g),E=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),I=y.isub(E).iushrn(this.shift),T=I;return I.cmp(this.m)>=0?T=I.isub(this.m):I.cmpn(0)<0&&(T=I.iadd(this.m)),T._forceRed(this)},B.prototype.invm=function(l){var g=this.imod(l._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,y4)})(E4);var Se=E4.exports,b4="bignumber/5.7.0",Jm=Se.BN,Qs=new kt(b4),g_={},NM=9007199254740991;function Jte(t){return t!=null&&(Nr.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||pn(t)||typeof t=="bigint"||cl(t))}var xM=!1,Nr=class t{constructor(e,r){e!==g_&&Qs.throwError("cannot call constructor directly; use BigNumber.from",kt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return on(De(this).fromTwos(e))}toTwos(e){return on(De(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return on(De(this).add(De(e)))}sub(e){return on(De(this).sub(De(e)))}div(e){return t.from(e).isZero()&&$n("division-by-zero","div"),on(De(this).div(De(e)))}mul(e){return on(De(this).mul(De(e)))}mod(e){let r=De(e);return r.isNeg()&&$n("division-by-zero","mod"),on(De(this).umod(r))}pow(e){let r=De(e);return r.isNeg()&&$n("negative-power","pow"),on(De(this).pow(r))}and(e){let r=De(e);return(this.isNegative()||r.isNeg())&&$n("unbound-bitwise-result","and"),on(De(this).and(r))}or(e){let r=De(e);return(this.isNegative()||r.isNeg())&&$n("unbound-bitwise-result","or"),on(De(this).or(r))}xor(e){let r=De(e);return(this.isNegative()||r.isNeg())&&$n("unbound-bitwise-result","xor"),on(De(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&$n("negative-width","mask"),on(De(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&$n("negative-width","shl"),on(De(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&$n("negative-width","shr"),on(De(this).shrn(e))}eq(e){return De(this).eq(De(e))}lt(e){return De(this).lt(De(e))}lte(e){return De(this).lte(De(e))}gt(e){return De(this).gt(De(e))}gte(e){return De(this).gte(De(e))}isNegative(){return this._hex[0]==="-"}isZero(){return De(this).isZero()}toNumber(){try{return De(this).toNumber()}catch{$n("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Qs.throwError("this platform does not support BigInt",kt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?xM||(xM=!0,Qs.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Qs.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",kt.errors.UNEXPECTED_ARGUMENT,{}):Qs.throwError("BigNumber.toString does not accept parameters",kt.errors.UNEXPECTED_ARGUMENT,{})),De(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(g_,Uh(e)):e.match(/^-?[0-9]+$/)?new t(g_,Uh(new Jm(e))):Qs.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&$n("underflow","BigNumber.from",e),(e>=NM||e<=-NM)&&$n("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(cl(r))return t.from(Gr(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return t.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pn(n)||n[0]==="-"&&pn(n.substring(1))))return t.from(n)}return Qs.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function Uh(t){if(typeof t!="string")return Uh(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Qs.throwArgumentError("invalid hex","value",t),t=Uh(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function on(t){return Nr.from(Uh(t))}function De(t){let e=Nr.from(t).toHexString();return e[0]==="-"?new Jm("-"+e.substring(3),16):new Jm(e.substring(2),16)}function $n(t,e,r){let n={fault:t,operation:e};return r!=null&&(n.value=r),Qs.throwError(t,kt.errors.NUMERIC_FAULT,n)}function Xte(t){return new Jm(t,36).toString(16)}var jr=new kt(b4),Mh={},S4=Nr.from(0),I4=Nr.from(-1);function _4(t,e,r,n){let i={fault:e,operation:r};return n!==void 0&&(i.value=n),jr.throwError(t,kt.errors.NUMERIC_FAULT,i)}var Lh="0";for(;Lh.length<256;)Lh+=Lh;function z_(t){if(typeof t!="number")try{t=Nr.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Lh.substring(0,t):jr.throwArgumentError("invalid decimal size","decimals",t)}function p_(t,e){e==null&&(e=0);let r=z_(e);t=Nr.from(t);let n=t.lt(S4);n&&(t=t.mul(I4));let i=t.mod(r).toString();for(;i.length2&&jr.throwArgumentError("too many decimal points","value",t);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&_4("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.lengthe[o]==null?a:(typeof e[o]!==u&&jr.throwArgumentError("invalid fixed format ("+o+" not "+u+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&jr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&jr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(Mh,r,n,i)}},Xm=class t{constructor(e,r,n,i){e!==Mh&&jr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",kt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&jr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);let r=zs(this._value,this.format.decimals),n=zs(e._value,e.format.decimals);return t.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(OM.toFormat(r.format))),r}ceiling(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(OM.toFormat(r.format))),r}round(e){e==null&&(e=0);let r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&jr.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;let n=t.from("1"+Lh.substring(0,e),this.format),i=Zte.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&jr.throwArgumentError("invalid byte width","width",e);let r=Nr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return fs(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return t.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!Jte(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),t.fromString(p_(e,r),Fh.from(n))}static fromString(e,r){r==null&&(r="fixed");let n=Fh.from(r),i=zs(e,n.decimals);!n.signed&&i.lt(S4)&&_4("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=fs(s,n.width/8));let o=p_(i,n.decimals);return new t(Mh,s,o,n)}static fromBytes(e,r){r==null&&(r="fixed");let n=Fh.from(r);if(Qt(e).length>n.width/8)throw new Error("overflow");let i=Nr.from(e);n.signed&&(i=i.fromTwos(n.width));let s=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=p_(i,n.decimals);return new t(Mh,s,o,n)}static from(e,r){if(typeof e=="string")return t.fromString(e,r);if(cl(e))return t.fromBytes(e,r);try{return t.fromValue(e,0,r)}catch(n){if(n.code!==kt.errors.INVALID_ARGUMENT)throw n}return jr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}},OM=Xm.from(1),Zte=Xm.from("0.5"),ere="strings/5.7.0",T4=new kt(ere),Zm;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Zm||(Zm={}));var nl;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(nl||(nl={}));function tre(t,e,r,n,i){return T4.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function C4(t,e,r,n,i){if(t===nl.BAD_PREFIX||t===nl.UNEXPECTED_CONTINUE){let s=0;for(let o=e+1;o>6===2;o++)s++;return s}return t===nl.OVERRUN?r.length-e-1:0}function rre(t,e,r,n,i){return t===nl.OVERLONG?(n.push(i),0):(n.push(65533),C4(t,e,r))}Object.freeze({error:tre,ignore:C4,replace:rre});function m_(t,e=Zm.current){e!=Zm.current&&(T4.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;let s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return Qt(r)}function nre(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function DM(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}DM("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),y_("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),y_("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),y_("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",nre),DM("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");var N4="hash/5.7.0";function ire(t){t=atob(t);let e=[];for(let r=0;r0&&Array.isArray(u)?i(u,o-1):r.push(u)})};return i(t,e),r}function sre(t){let e={};for(let r=0;r>--a&1}let d=31,w=Math.pow(2,d),A=w>>>1,_=A>>1,N=w-1,P=0;for(let k=0;k1;){let R=H+q>>>1;k>>1|f(),v=v<<1^A,C=(C^A)<<1|A|1;U=v,Q=1+C-v}let L=n-4;return V.map(k=>{switch(k-L){case 3:return L+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return L+256+(t[u++]<<8|t[u++]);case 1:return L+t[u++];default:return k-1}})}function are(t){let e=0;return()=>t[e++]}function ure(t){return are(ore(t))}function cre(t){return t&1?~t>>1:t>>1}function lre(t,e){let r=Array(t);for(let n=0;ne[o]):r}function hre(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(gre(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(pre(r,t))}return sre(x4(e))}function dre(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function O4(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[o].push(s));return n}function gre(t,e){let r=1+e(),n=e(),i=dre(e),s=O4(i.length,1+t,e);return x4(s.map((o,u)=>{let a=o[0],c=o.slice(1);return Array(i[u]).fill(void 0).map((f,d)=>{let w=d*n;return[a+d*r,c.map(A=>A+w)]})}))}function pre(t,e){let r=1+e();return O4(r,1+t,e).map(n=>[n[0],n.slice(1)])}function mre(t){let e=ey(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let c=ey(t,e);if(c.length==0)break;n.push({set:new Set(c),node:r()})}n.sort((c,f)=>f.set.size-c.set.size);let i=t(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let u=i==1,a=i==2;return{branches:n,valid:s,fe0f:o,save:u,check:a}}}function yre(){return ure(ire("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}var km=yre();new Set(ey(km)),new Set(ey(km)),hre(km),mre(km),new kt(N4);var wre=new Uint8Array(32);wre.fill(0);var vre=`Ethereum Signed Message: -`;function D4(t){return typeof t=="string"&&(t=m_(t)),j_(zte([m_(vre),m_(String(t.length)),t]))}var Are="rlp/5.7.0";new kt(Are);var Ere="address/5.7.0",Bh=new kt(Ere);function RM(t){pn(t,20)||Bh.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);let n=Qt(j_(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}var bre=9007199254740991;function Sre(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var Q_={};for(let t=0;t<10;t++)Q_[String(t)]=String(t);for(let t=0;t<26;t++)Q_[String.fromCharCode(65+t)]=String(10+t);var BM=Math.floor(Sre(bre));function Ire(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Q_[n]).join("");for(;e.length>=BM;){let n=e.substring(0,BM);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function _re(t){let e=null;if(typeof t!="string"&&Bh.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=RM(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Bh.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Ire(t)&&Bh.throwArgumentError("bad icap checksum","address",t),e=Xte(t.substring(4));e.length<40;)e="0"+e;e=RM("0x"+e)}else Bh.throwArgumentError("invalid address","address",t);return e}var Tre="properties/5.7.0";new kt(Tre);function Dh(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new kt(N4);var Cre=new Uint8Array(32);Cre.fill(0),Nr.from(-1);var Nre=Nr.from(0),xre=Nr.from(1);Nr.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),fs(xre.toHexString(),32),fs(Nre.toHexString(),32);var os={},Pe={},kh=P4;function P4(t,e){if(!t)throw new Error(e||"Assertion failed")}P4.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var x_={exports:{}};typeof Object.create=="function"?x_.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:x_.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var Ore=kh,Dre=x_.exports;Pe.inherits=Dre;function Pre(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function Rre(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):Pre(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Pe.htonl=R4;function Mre(t,e){for(var r="",n=0;n>>0}return s}Pe.join32=Lre;function Fre(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Pe.split32=Fre;function Ure(t,e){return t>>>e|t<<32-e}Pe.rotr32=Ure;function qre(t,e){return t<>>32-e}Pe.rotl32=qre;function Vre(t,e){return t+e>>>0}Pe.sum32=Vre;function kre(t,e,r){return t+e+r>>>0}Pe.sum32_3=kre;function Hre(t,e,r,n){return t+e+r+n>>>0}Pe.sum32_4=Hre;function Gre(t,e,r,n,i){return t+e+r+n+i>>>0}Pe.sum32_5=Gre;function jre(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,u=(o>>0,t[e+1]=o}Pe.sum64=jre;function zre(t,e,r,n){var i=e+n>>>0,s=(i>>0}Pe.sum64_hi=zre;function Qre(t,e,r,n){var i=e+n;return i>>>0}Pe.sum64_lo=Qre;function Kre(t,e,r,n,i,s,o,u){var a=0,c=e;c=c+n>>>0,a+=c>>0,a+=c>>0,a+=c>>0}Pe.sum64_4_hi=Kre;function Wre(t,e,r,n,i,s,o,u){var a=e+n+s+u;return a>>>0}Pe.sum64_4_lo=Wre;function $re(t,e,r,n,i,s,o,u,a,c){var f=0,d=e;d=d+n>>>0,f+=d>>0,f+=d>>0,f+=d>>0,f+=d>>0}Pe.sum64_5_hi=$re;function Yre(t,e,r,n,i,s,o,u,a,c){var f=e+n+s+u+c;return f>>>0}Pe.sum64_5_lo=Yre;function Jre(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Pe.rotr64_hi=Jre;function Xre(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pe.rotr64_lo=Xre;function Zre(t,e,r){return t>>>r}Pe.shr64_hi=Zre;function ene(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pe.shr64_lo=ene;var ll={},MM=Pe,tne=kh;function Hm(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}ll.BlockHash=Hm,Hm.prototype.update=function(t,e){if(t=MM.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=MM.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s>>3}ms.g0_256=one;function ane(t){return hs(t,17)^hs(t,19)^t>>>10}ms.g1_256=ane;var ol=Pe,une=ll,cne=ms,w_=ol.rotl32,Ph=ol.sum32,lne=ol.sum32_5,fne=cne.ft_1,q4=une.BlockHash,hne=[1518500249,1859775393,2400959708,3395469782];function us(){if(!(this instanceof us))return new us;q4.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ol.inherits(us,q4);var dne=us;us.blockSize=512,us.outSize=160,us.hmacStrength=80,us.padLength=64,us.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=new this.Hash().update(t).digest()),eie(t.length<=this.blockSize);for(var e=t.length;e>8,w=f&255;d?a.push(d,w):a.push(w)}return a}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var u="",a=0;a(w>>1)-1?N=(w>>1)-P:N=P,A.isubn(N)):N=0,d[_]=N,A.iushrn(1)}return d}r.getNAF=n;function i(a,c){var f=[[],[]];a=a.clone(),c=c.clone();for(var d=0,w=0,A;a.cmpn(-d)>0||c.cmpn(-w)>0;){var _=a.andln(3)+d&3,N=c.andln(3)+w&3;_===3&&(_=-1),N===3&&(N=-1);var P;_&1?(A=a.andln(7)+d&7,(A===3||A===5)&&N===2?P=-_:P=_):P=0,f[0].push(P);var V;N&1?(A=c.andln(7)+w&7,(A===3||A===5)&&_===2?V=-N:V=N):V=0,f[1].push(V),2*d===P+1&&(d=1-d),2*w===V+1&&(w=1-w),a.iushrn(1),c.iushrn(1)}return f}r.getJSF=i;function s(a,c,f){var d="_"+c;a.prototype[c]=function(){return this[d]!==void 0?this[d]:this[d]=f.call(this)}}r.cachedProperty=s;function o(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=o;function u(a){return new Se(a,"hex","le")}r.intFromLE=u}),jm=mn.getNAF,nie=mn.getJSF,ty=mn.assert;function Uo(t,e){this.type=t,this.p=new Se(e.p,16),this.red=e.prime?Se.red(e.prime):Se.mont(this.p),this.zero=new Se(0).toRed(this.red),this.one=new Se(1).toRed(this.red),this.two=new Se(2).toRed(this.red),this.n=e.n&&new Se(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var eu=Uo;Uo.prototype.point=function(){throw new Error("Not implemented")},Uo.prototype.validate=function(){throw new Error("Not implemented")},Uo.prototype._fixedNafMul=function(t,e){ty(t.precomputed);var r=t._getDoubles(),n=jm(e,1,this._bitLength),i=(1<=o;a--)u=(u<<1)+n[a];s.push(u)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;u--){for(var a=0;u>=0&&s[u]===0;u--)a++;if(u>=0&&a++,o=o.dblp(a),u<0)break;var c=s[u];ty(c!==0),t.type==="affine"?c>0?o=o.mixedAdd(i[c-1>>1]):o=o.mixedAdd(i[-c-1>>1].neg()):c>0?o=o.add(i[c-1>>1]):o=o.add(i[-c-1>>1].neg())}return t.type==="affine"?o.toP():o},Uo.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,o=this._wnafT2,u=this._wnafT3,a=0,c,f,d;for(c=0;c=1;c-=2){var A=c-1,_=c;if(s[A]!==1||s[_]!==1){u[A]=jm(r[A],s[A],this._bitLength),u[_]=jm(r[_],s[_],this._bitLength),a=Math.max(u[A].length,a),a=Math.max(u[_].length,a);continue}var N=[e[A],null,null,e[_]];e[A].y.cmp(e[_].y)===0?(N[1]=e[A].add(e[_]),N[2]=e[A].toJ().mixedAdd(e[_].neg())):e[A].y.cmp(e[_].y.redNeg())===0?(N[1]=e[A].toJ().mixedAdd(e[_]),N[2]=e[A].add(e[_].neg())):(N[1]=e[A].toJ().mixedAdd(e[_]),N[2]=e[A].toJ().mixedAdd(e[_].neg()));var P=[-3,-1,-5,-7,0,7,5,1,3],V=nie(r[A],r[_]);for(a=Math.max(V[0].length,a),u[A]=new Array(a),u[_]=new Array(a),f=0;f=0;c--){for(var H=0;c>=0;){var q=!0;for(f=0;f=0&&H++,L=L.dblp(H),c<0)break;for(f=0;f0?d=o[f][v-1>>1]:v<0&&(d=o[f][-v-1>>1].neg()),d.type==="affine"?L=L.mixedAdd(d):L=L.add(d))}}for(c=0;c=Math.ceil((t.bitLength()+1)/e.step):!1},Yn.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(w=a,A=c),f.negative&&(f=f.neg(),d=d.neg()),w.negative&&(w=w.neg(),A=A.neg()),[{a:f,b:d},{a:w,b:A}]},Xn.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),u=s.mul(n.a),a=i.mul(r.b),c=s.mul(n.b),f=t.sub(o).sub(u),d=a.add(c).neg();return{k1:f,k2:d}},Xn.prototype.pointFromX=function(t,e){t=new Se(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Xn.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Xn.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},Er.prototype.isInfinity=function(){return this.inf},Er.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Er.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},Er.prototype.getX=function(){return this.x.fromRed()},Er.prototype.getY=function(){return this.y.fromRed()},Er.prototype.mul=function(t){return t=new Se(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Er.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Er.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Er.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},Er.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},Er.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Cr(t,e,r,n){eu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Se(0)):(this.x=new Se(e,16),this.y=new Se(r,16),this.z=new Se(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}W_(Cr,eu.BasePoint),Xn.prototype.jpoint=function(t,e,r){return new Cr(this,t,e,r)},Cr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Cr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Cr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),u=n.redSub(i),a=s.redSub(o);if(u.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=u.redSqr(),f=c.redMul(u),d=n.redMul(c),w=a.redSqr().redIAdd(f).redISub(d).redISub(d),A=a.redMul(d.redISub(w)).redISub(s.redMul(f)),_=this.z.redMul(t.z).redMul(u);return this.curve.jpoint(w,A,_)},Cr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),u=i.redSub(s);if(o.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var a=o.redSqr(),c=a.redMul(o),f=r.redMul(a),d=u.redSqr().redIAdd(c).redISub(f).redISub(f),w=u.redMul(f.redISub(d)).redISub(i.redMul(c)),A=this.z.redMul(o);return this.curve.jpoint(d,w,A)},Cr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Cr.prototype.inspect=function(){return this.isInfinity()?"":""},Cr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Km=hl(function(t,e){var r=e;r.base=eu,r.short=sie,r.mont=null,r.edwards=null}),Wm=hl(function(t,e){var r=e,n=mn.assert;function i(u){u.type==="short"?this.curve=new Km.short(u):u.type==="edwards"?this.curve=new Km.edwards(u):this.curve=new Km.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(u,a){Object.defineProperty(r,u,{configurable:!0,enumerable:!0,get:function(){var c=new i(a);return Object.defineProperty(r,u,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:os.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:os.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:os.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:os.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:os.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:os.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:os.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:os.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function qo(t){if(!(this instanceof qo))return new qo(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ni.toArray(t.entropy,t.entropyEnc||"hex"),r=Ni.toArray(t.nonce,t.nonceEnc||"hex"),n=Ni.toArray(t.pers,t.persEnc||"hex");K_(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var qM=qo;qo.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},qo.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=Ni.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var oie=mn.assert;function sy(t,e){if(t instanceof sy)return t;this._importDER(t,e)||(oie(t.r&&t.s,"Signature without r or s"),this.r=new Se(t.r,16),this.s=new Se(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var zm=sy;function aie(){this.place=0}function S_(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function VM(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}sy.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=VM(e),r=VM(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];I_(n,e.length),n=n.concat(e),n.push(2),I_(n,r.length);var i=n.concat(r),s=[48];return I_(s,i.length),s=s.concat(i),mn.encode(s,t)};var uie=function(){throw new Error("unsupported")},J4=mn.assert;function Jn(t){if(!(this instanceof Jn))return new Jn(t);typeof t=="string"&&(J4(Object.prototype.hasOwnProperty.call(Wm,t),"Unknown curve "+t),t=Wm[t]),t instanceof Wm.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var cie=Jn;Jn.prototype.keyPair=function(t){return new b_(this,t)},Jn.prototype.keyFromPrivate=function(t,e){return b_.fromPrivate(this,t,e)},Jn.prototype.keyFromPublic=function(t,e){return b_.fromPublic(this,t,e)},Jn.prototype.genKeyPair=function(t){t||(t={});for(var e=new qM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||uie(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Se(2));;){var i=new Se(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Jn.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Jn.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new Se(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),o=t.toArray("be",i),u=new qM({hash:this.hash,entropy:s,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),a=this.n.sub(new Se(1)),c=0;;c++){var f=n.k?n.k(c):new Se(u.generate(this.n.byteLength()));if(f=this._truncateToN(f,!0),!(f.cmpn(1)<=0||f.cmp(a)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var w=d.getX(),A=w.umod(this.n);if(A.cmpn(0)!==0){var _=f.invm(this.n).mul(A.mul(e.getPrivate()).iadd(t));if(_=_.umod(this.n),_.cmpn(0)!==0){var N=(d.getY().isOdd()?1:0)|(w.cmp(A)!==0?2:0);return n.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),N^=1),new zm({r:A,s:_,recoveryParam:N})}}}}}},Jn.prototype.verify=function(t,e,r,n){t=this._truncateToN(new Se(t,16)),r=this.keyFromPublic(r,n),e=new zm(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o=s.invm(this.n),u=o.mul(t).umod(this.n),a=o.mul(i).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(u,r.getPublic(),a),c.isInfinity()?!1:c.eqXToP(i)):(c=this.g.mulAdd(u,r.getPublic(),a),c.isInfinity()?!1:c.getX().umod(this.n).cmp(i)===0)},Jn.prototype.recoverPubKey=function(t,e,r,n){J4((3&r)===r,"The recovery param is more than two bits"),e=new zm(e,n);var i=this.n,s=new Se(t),o=e.r,u=e.s,a=r&1,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),a):o=this.curve.pointFromX(o,a);var f=e.r.invm(i),d=i.sub(s).mul(f).umod(i),w=u.mul(f).umod(i);return this.g.mulAdd(d,o,w)},Jn.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new zm(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var lie=hl(function(t,e){var r=e;r.version="6.5.4",r.utils=mn,r.rand=function(){throw new Error("unsupported")},r.curve=Km,r.curves=Wm,r.ec=cie,r.eddsa=null}),fie=lie.ec,hie="signing-key/5.7.0",P_=new kt(hie),__=null;function ls(){return __||(__=new fie("secp256k1")),__}var R_=class{constructor(e){Dh(this,"curve","secp256k1"),Dh(this,"privateKey",Gr(e)),Kte(this.privateKey)!==32&&P_.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let r=ls().keyFromPrivate(Qt(this.privateKey));Dh(this,"publicKey","0x"+r.getPublic(!1,"hex")),Dh(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),Dh(this,"_isSigningKey",!0)}_addPoint(e){let r=ls().keyFromPublic(Qt(this.publicKey)),n=ls().keyFromPublic(Qt(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){let r=ls().keyFromPrivate(Qt(this.privateKey)),n=Qt(e);n.length!==32&&P_.throwArgumentError("bad digest length","digest",e);let i=r.sign(n,{canonical:!0});return A4({recoveryParam:i.recoveryParam,r:fs("0x"+i.r.toString(16),32),s:fs("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let r=ls().keyFromPrivate(Qt(this.privateKey)),n=ls().keyFromPublic(Qt(X4(e)));return fs("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};function die(t,e){let r=A4(e),n={r:Qt(r.r),s:Qt(r.s)};return"0x"+ls().recoverPubKey(Qt(t),n,r.recoveryParam).encode("hex",!1)}function X4(t,e){let r=Qt(t);if(r.length===32){let n=new R_(r);return e?"0x"+ls().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?Gr(r):"0x"+ls().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+ls().keyFromPublic(r).getPublic(!0,"hex"):Gr(r)}return P_.throwArgumentError("invalid public or private key","key","[REDACTED]")}var gie="transactions/5.7.0";new kt(gie);var kM;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(kM||(kM={}));function pie(t){let e=X4(t);return _re(CM(j_(CM(e,1)),12))}function mie(t,e){return pie(die(Qt(t),e))}var yie="https://rpc.walletconnect.com/v1";async function Z4(t,e,r,n,i,s){switch(r.t){case"eip191":return e5(t,e,r.s);case"eip1271":return await t5(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function e5(t,e,r){return mie(D4(e),r).toLowerCase()===t.toLowerCase()}async function t5(t,e,r,n,i,s){try{let o="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",c=r.substring(2),f=D4(e).substring(2),d=o+f+u+a+c,w=await fetch(`${s||yie}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:wie(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:d},"latest"]})}),{result:A}=await w.json();return A?A.slice(0,o.length).toLowerCase()===o.toLowerCase():!1}catch(o){return console.error("isValidEip1271Signature: ",o),!1}}function wie(){return Date.now()+Math.floor(Math.random()*1e3)}var vie=Object.defineProperty,Aie=Object.defineProperties,Eie=Object.getOwnPropertyDescriptors,HM=Object.getOwnPropertySymbols,bie=Object.prototype.hasOwnProperty,Sie=Object.prototype.propertyIsEnumerable,GM=(t,e,r)=>e in t?vie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$_=(t,e)=>{for(var r in e||(e={}))bie.call(e,r)&&GM(t,r,e[r]);if(HM)for(var r of HM(e))Sie.call(e,r)&&GM(t,r,e[r]);return t},r5=(t,e)=>Aie(t,Eie(e)),Iie="did:pkh:",oy=t=>t?.split(":"),Y_=t=>{let e=t&&oy(t);if(e)return t.includes(Iie)?e[3]:e[1]},_ie=t=>{let e=t&&oy(t);if(e)return e[2]+":"+e[3]},J_=t=>{let e=t&&oy(t);if(e)return e.pop()};async function Tie(t){let{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=n5(i,i.iss),o=J_(i.iss);return await Z4(o,s,n,Y_(i.iss),r)}var n5=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=J_(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0,s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,u=`Chain ID: ${Y_(e)}`,a=`Nonce: ${t.nonce}`,c=`Issued At: ${t.iat}`,f=t.resources?`Resources:${t.resources.map(w=>` -- ${w}`).join("")}`:void 0,d=uy(t.resources);if(d){let w=Ho(d);i=eT(i,w)}return[r,n,"",i,"",s,o,u,a,c,f].filter(w=>w!=null).join(` -`)};function Cie(t,e,r){return r.includes("did:pkh:")||(r=`did:pkh:${r}`),{h:{t:"caip122"},p:{iss:r,domain:t.domain,aud:t.aud,version:t.version,nonce:t.nonce,iat:t.iat,statement:t.statement,requestId:t.requestId,resources:t.resources,nbf:t.nbf,exp:t.exp},s:e}}function Nie(t){var e;let{authPayload:r,chains:n,methods:i}=t,s=r.statement||"";if(!(n!=null&&n.length))return r;let o=r.chains,u=C_(o,n);if(!(u!=null&&u.length))throw new Error("No supported chains");let a=i5(r.resources);if(!a)return r;ps(a);let c=s5(a,"eip155"),f=r?.resources||[];if(c!=null&&c.length){let d=o5(c),w=C_(d,i);if(!(w!=null&&w.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(d)}, supported: ${JSON.stringify(i)}`);let A=X_("request",w,{chains:u}),_=l5(a,"eip155",A);f=((e=r?.resources)==null?void 0:e.slice(0,-1))||[],f.push(ay(_))}return r5($_({},r),{statement:h5(s,uy(f)),chains:u,resources:r!=null&&r.resources||f.length>0?f:void 0})}function i5(t){let e=uy(t);if(e&&Z_(e))return Ho(e)}function xie(t,e){var r;return(r=t?.att)==null?void 0:r.hasOwnProperty(e)}function s5(t,e){var r,n;return(r=t?.att)!=null&&r[e]?Object.keys((n=t?.att)==null?void 0:n[e]):[]}function Oie(t){return t?.map(e=>Object.keys(e))||[]}function o5(t){return t?.map(e=>{var r;return(r=e.split("/"))==null?void 0:r[1]})||[]}function a5(t){return p.Buffer.from(JSON.stringify(t)).toString("base64")}function u5(t){return JSON.parse(p.Buffer.from(t,"base64").toString("utf-8"))}function ps(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");let e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{let n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{let s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function c5(t,e,r,n={}){return r?.sort((i,s)=>i.localeCompare(s)),{att:{[t]:X_(e,r,n)}}}function l5(t,e,r){var n;return t.att[e]=$_({},r),((n=Object.keys(t.att))==null?void 0:n.sort((i,s)=>i.localeCompare(s))).reduce((i,s)=>(i.att[s]=t.att[s],i),{att:{}})}function X_(t,e,r={}){e=e?.sort((i,s)=>i.localeCompare(s));let n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function ay(t){return ps(t),`urn:recap:${a5(t).replace(/=/g,"")}`}function Ho(t){let e=u5(t.replace("urn:recap:",""));return ps(e),e}function Die(t,e,r){let n=c5(t,e,r);return ay(n)}function Z_(t){return t&&t.includes("urn:recap:")}function Pie(t,e){let r=Ho(t),n=Ho(e),i=f5(r,n);return ay(i)}function f5(t,e){ps(t),ps(e);let r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((u,a)=>u.localeCompare(a)).forEach(u=>{var a,c;n.att[i]=r5($_({},n.att[i]),{[u]:((a=t.att[i])==null?void 0:a[u])||((c=e.att[i])==null?void 0:c[u])})})}),n}function eT(t="",e){ps(e);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;let n=[],i=0;Object.keys(e.att).forEach(u=>{let a=Object.keys(e.att[u]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));a.sort((d,w)=>d.action.localeCompare(w.action));let c={};a.forEach(d=>{c[d.ability]||(c[d.ability]=[]),c[d.ability].push(d.action)});let f=Object.keys(c).map(d=>(i++,`(${i}) '${d}': '${c[d].join("', '")}' for '${u}'.`));n.push(f.join(", ").replace(".,","."))});let s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function Rie(t){var e;let r=Ho(t);ps(r);let n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function Bie(t){let e=Ho(t);ps(e);let r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function h5(t,e){if(!e)return t;let r=Ho(e);return ps(r),eT(t,r)}function uy(t){if(!t)return;let e=t?.[t.length-1];return Z_(e)?e:void 0}var tT="base10",Qr="base16",ry="base64pad",cy="utf8",rT=0,dl=1,Mie=0,jM=1,B_=12,nT=32;function Lie(){let t=e4.generateKeyPair();return{privateKey:Vt.toString(t.secretKey,Qr),publicKey:Vt.toString(t.publicKey,Qr)}}function Fie(){let t=XM.randomBytes(nT);return Vt.toString(t,Qr)}function Uie(t,e){let r=e4.sharedKey(Vt.fromString(t,Qr),Vt.fromString(e,Qr),!0),n=new ite.HKDF(U_.SHA256,r).expand(nT);return Vt.toString(n,Qr)}function qie(t){let e=U_.hash(Vt.fromString(t,Qr));return Vt.toString(e,Qr)}function Vie(t){let e=U_.hash(Vt.fromString(t,cy));return Vt.toString(e,Qr)}function d5(t){return Vt.fromString(`${t}`,tT)}function Hh(t){return Number(Vt.toString(t,tT))}function kie(t){let e=d5(typeof t.type<"u"?t.type:rT);if(Hh(e)===dl&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?Vt.fromString(t.senderPublicKey,Qr):void 0,n=typeof t.iv<"u"?Vt.fromString(t.iv,Qr):XM.randomBytes(B_),i=new JM.ChaCha20Poly1305(Vt.fromString(t.symKey,Qr)).seal(n,Vt.fromString(t.message,cy));return g5({type:e,sealed:i,iv:n,senderPublicKey:r})}function Hie(t){let e=new JM.ChaCha20Poly1305(Vt.fromString(t.symKey,Qr)),{sealed:r,iv:n}=iT(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Vt.toString(i,cy)}function g5(t){if(Hh(t.type)===dl){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Vt.toString(Vt.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),ry)}return Vt.toString(Vt.concat([t.type,t.iv,t.sealed]),ry)}function iT(t){let e=Vt.fromString(t,ry),r=e.slice(Mie,jM),n=jM;if(Hh(r)===dl){let u=n+nT,a=u+B_,c=e.slice(n,u),f=e.slice(u,a),d=e.slice(a);return{type:r,sealed:d,iv:f,senderPublicKey:c}}let i=n+B_,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function Gie(t,e){let r=iT(t);return p5({type:Hh(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Vt.toString(r.senderPublicKey,Qr):void 0,receiverPublicKey:e?.receiverPublicKey})}function p5(t){let e=t?.type||rT;if(e===dl){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function jie(t){return t.type===dl&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var m5="irn";function zie(t){return t?.relay||{protocol:m5}}function Qie(t){let e=ote.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Kie=Object.defineProperty,Wie=Object.defineProperties,$ie=Object.getOwnPropertyDescriptors,zM=Object.getOwnPropertySymbols,Yie=Object.prototype.hasOwnProperty,Jie=Object.prototype.propertyIsEnumerable,QM=(t,e,r)=>e in t?Kie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KM=(t,e)=>{for(var r in e||(e={}))Yie.call(e,r)&&QM(t,r,e[r]);if(zM)for(var r of zM(e))Jie.call(e,r)&&QM(t,r,e[r]);return t},Xie=(t,e)=>Wie(t,$ie(e));function y5(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function Zie(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=$m.parse(s),u=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:w5(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:y5(o),methods:u,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function w5(t){return t.startsWith("//")?t.substring(2):t}function v5(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function ese(t){return`${t.protocol}:${t.topic}@${t.version}?`+$m.stringify(KM(Xie(KM({symKey:t.symKey},v5(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}var tse=Object.defineProperty,rse=Object.defineProperties,nse=Object.getOwnPropertyDescriptors,WM=Object.getOwnPropertySymbols,ise=Object.prototype.hasOwnProperty,sse=Object.prototype.propertyIsEnumerable,$M=(t,e,r)=>e in t?tse(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ose=(t,e)=>{for(var r in e||(e={}))ise.call(e,r)&&$M(t,r,e[r]);if(WM)for(var r of WM(e))sse.call(e,r)&&$M(t,r,e[r]);return t},ase=(t,e)=>rse(t,nse(e));function tu(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function A5(t){let e=[];return Object.values(t).forEach(r=>{e.push(...tu(r.accounts))}),e}function E5(t,e){let r=[];return Object.values(t).forEach(n=>{tu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function b5(t,e){let r=[];return Object.values(t).forEach(n=>{tu(n.accounts).includes(e)&&r.push(...n.events)}),r}function use(t,e){let r=R5(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function cse(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=M_(e),s=M_(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,d=n[c].methods,w=n[c].events,A=n[c].accounts;f.forEach(_=>{if(!A.some(N=>N.includes(_)))throw new Error(`No accounts provided for chain ${_} in namespace ${c}`)}),o[c]={chains:f,methods:d,events:w,accounts:A}});let u=M5(e,o,"approve()");if(u)throw new Error(u.message);let a={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(_=>{var N,P;return(P=(N=i[c])==null?void 0:N.chains)==null?void 0:P.includes(_)}),d=n[c].methods.filter(_=>{var N,P;return(P=(N=i[c])==null?void 0:N.methods)==null?void 0:P.includes(_)}),w=n[c].events.filter(_=>{var N,P;return(P=(N=i[c])==null?void 0:N.events)==null?void 0:P.includes(_)}),A=f.map(_=>n[c].accounts.filter(N=>N.includes(`${_}:`))).flat();a[c]={chains:f,methods:d,events:w,accounts:A}}),Object.keys(s).forEach(c=>{var f,d,w,A,_,N;if(!n[c])return;let P=(d=(f=s[c])==null?void 0:f.chains)==null?void 0:d.filter(L=>n[c].chains.includes(L)),V=n[c].methods.filter(L=>{var k,H;return(H=(k=s[c])==null?void 0:k.methods)==null?void 0:H.includes(L)}),U=n[c].events.filter(L=>{var k,H;return(H=(k=s[c])==null?void 0:k.events)==null?void 0:H.includes(L)}),Q=P?.map(L=>n[c].accounts.filter(k=>k.includes(`${L}:`))).flat();a[c]={chains:Ys((w=a[c])==null?void 0:w.chains,P),methods:Ys((A=a[c])==null?void 0:A.methods,V),events:Ys((_=a[c])==null?void 0:_.events,U),accounts:Ys((N=a[c])==null?void 0:N.accounts,Q)}}),a)}function sT(t){return t.includes(":")}function S5(t){return sT(t)?t.split(":")[0]:t}function M_(t){var e,r,n;let i={};if(!ly(t))return i;for(let[s,o]of Object.entries(t)){let u=sT(s)?[s]:o.chains,a=o.methods||[],c=o.events||[],f=S5(s);i[f]=ase(ose({},i[f]),{chains:Ys(u,(e=i[f])==null?void 0:e.chains),methods:Ys(a,(r=i[f])==null?void 0:r.methods),events:Ys(c,(n=i[f])==null?void 0:n.events)})}return i}function I5(t){let e={};return t?.forEach(r=>{let[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function lse(t,e){e=e.map(n=>n.replace("did:pkh:",""));let r=I5(e);for(let[n,i]of Object.entries(r))i.methods?i.methods=Ys(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}var _5={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}},T5={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 $s(t,e){let{message:r,code:n}=T5[t];return{message:e?`${r} ${e}`:r,code:n}}function Xa(t,e){let{message:r,code:n}=_5[t];return{message:e?`${r} ${e}`:r,code:n}}function Gh(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function ly(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function ko(t){return typeof t>"u"}function yn(t,e){return e&&ko(t)?!0:typeof t=="string"&&!!t.trim().length}function fy(t,e){return e&&ko(t)?!0:typeof t=="number"&&!isNaN(t)}function fse(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Vo(i,n)?(n.forEach(o=>{let{accounts:u,methods:a,events:c}=t.namespaces[o],f=tu(u),d=r[o];(!Vo(iy(o,d),f)||!Vo(d.methods,a)||!Vo(d.events,c))&&(s=!1)}),s):!1}function qh(t){return yn(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function C5(t){if(yn(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&qh(r)}}return!1}function hse(t){if(yn(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function dse(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function gse(t){return t?.topic}function pse(t,e){let r=null;return yn(t?.publicKey,!1)||(r=$s("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function L_(t){let e=!0;return Gh(t)?t.length&&(e=t.every(r=>yn(r,!1))):e=!1,e}function N5(t,e,r){let n=null;return Gh(e)&&e.length?e.forEach(i=>{n||qh(i)||(n=Xa("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):qh(t)||(n=Xa("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function x5(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=N5(i,iy(i,s),`${e} ${r}`);o&&(n=o)}),n}function O5(t,e){let r=null;return Gh(t)?t.forEach(n=>{r||C5(n)||(r=Xa("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Xa("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function D5(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=O5(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function P5(t,e){let r=null;return L_(t?.methods)?L_(t?.events)||(r=Xa("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Xa("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function oT(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=P5(n,`${e}, namespace`);i&&(r=i)}),r}function mse(t,e,r){let n=null;if(t&&ly(t)){let i=oT(t,e);i&&(n=i);let s=x5(t,e,r);s&&(n=s)}else n=$s("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function R5(t,e){let r=null;if(t&&ly(t)){let n=oT(t,e);n&&(r=n);let i=D5(t,e);i&&(r=i)}else r=$s("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function B5(t){return yn(t.protocol,!0)}function yse(t,e){let r=!1;return e&&!t?r=!0:t&&Gh(t)&&t.length&&t.forEach(n=>{r=B5(n)}),r}function wse(t){return typeof t=="number"}function vse(t){return typeof t<"u"&&typeof t!==null}function Ase(t){return!(!t||typeof t!="object"||!t.code||!fy(t.code,!1)||!t.message||!yn(t.message,!1))}function Ese(t){return!(ko(t)||!yn(t.method,!1))}function bse(t){return!(ko(t)||ko(t.result)&&ko(t.error)||!fy(t.id,!1)||!yn(t.jsonrpc,!1))}function Sse(t){return!(ko(t)||!yn(t.name,!1))}function Ise(t,e){return!(!qh(e)||!A5(t).includes(e))}function _se(t,e,r){return yn(r,!1)?E5(t,e).includes(r):!1}function Tse(t,e,r){return yn(r,!1)?b5(t,e).includes(r):!1}function M5(t,e,r){let n=null,i=Cse(t),s=Nse(e),o=Object.keys(i),u=Object.keys(s),a=YM(Object.keys(t)),c=YM(Object.keys(e)),f=a.filter(d=>!c.includes(d));return f.length&&(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`});var FB=pe(()=>{h();LB();yv();Da();DT();_0()});var FT,exe,qB=pe(()=>{h();fB();dB();hB();pB();gB();TT();mB();xT();yB();bB();xB();PB();RB();MB();FB();FT={...bT,...wT,...AT,...ET,...ST,..._T,...IT,...CT,...NT,...OT},exe={...BT,...LT}});function kB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var UB,qT,Gce,Av,UT=pe(()=>{h();qB();pv();UB=kB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),qT=kB("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Nf(t.length);for(let r=0;r{h();UT()});function Gs(t,e="utf8"){let r=Av[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}var VT=pe(()=>{h();UT()});function I0(t){return Ra(Bo(Gs(t,Cf),av))}function C0(t){return Bo(Gs(ns(t),av),Cf)}function HT(t){let e=Gs(dv,xf),r=fv+Bo(gv([e,t]),xf);return[uv,lv,r].join(cv)}function GT(t){let[e,r,n]=t.split(cv);if(e!==uv||r!==lv)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==fv)throw new Error("Issuer must be a key in mulicodec format");let s=Gs(n.slice(1),xf);if(Bo(s.slice(0,2),xf)!==dv)throw new Error('Issuer must be a public key with type "Ed25519"');let c=s.slice(2);if(c.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return c}function VB(t){return Bo(t,Cf)}function HB(t){return Gs(t,Cf)}function zT(t){return Gs([C0(t.header),C0(t.payload)].join(tu),w0)}function zce(t){let e=Bo(t,w0).split(tu),r=I0(e[0]),n=I0(e[1]);return{header:r,payload:n}}function jT(t){return[C0(t.header),C0(t.payload),VB(t.signature)].join(tu)}function QT(t){let e=t.split(tu),r=I0(e[0]),n=I0(e[1]),i=HB(e[2]),s=Gs(e.slice(0,2).join(tu),w0);return{header:r,payload:n,signature:i,data:s}}var KT=pe(()=>{h();pT();kT();VT();vf();hv()});function jce(t=(0,GB.randomBytes)(32)){return Bf.generateKeyPairFromSeed(t)}async function Qce(t,e,r,n,i=(0,zB.fromMiliseconds)(Date.now())){let s={alg:sv,typ:ov},o=HT(n.publicKey),c=i+r,a={iss:o,sub:t,aud:e,iat:i,exp:c},u=zT({header:s,payload:a}),f=Bf.sign(n.secretKey,u);return jT({header:s,payload:a,signature:f})}async function Kce(t){let{header:e,payload:r,data:n,signature:i}=QT(t);if(e.alg!==sv||e.typ!==ov)throw new Error("JWT must use EdDSA algorithm");let s=GT(r.iss);return Bf.verify(s,n,i)}var Bf,GB,zB,jB=pe(()=>{h();Bf=ge(tB()),GB=ge(y0()),zB=ge(yf());hv();KT()});var QB=pe(()=>{h()});var WT={};Zt(WT,{DATA_ENCODING:()=>w0,DID_DELIMITER:()=>cv,DID_METHOD:()=>lv,DID_PREFIX:()=>uv,JSON_ENCODING:()=>av,JWT_DELIMITER:()=>tu,JWT_ENCODING:()=>Cf,JWT_IRIDIUM_ALG:()=>sv,JWT_IRIDIUM_TYP:()=>ov,KEY_PAIR_SEED_LENGTH:()=>nB,MULTICODEC_ED25519_BASE:()=>fv,MULTICODEC_ED25519_ENCODING:()=>xf,MULTICODEC_ED25519_HEADER:()=>dv,MULTICODEC_ED25519_LENGTH:()=>rB,decodeData:()=>zce,decodeIss:()=>GT,decodeJSON:()=>I0,decodeJWT:()=>QT,decodeSig:()=>HB,encodeData:()=>zT,encodeIss:()=>HT,encodeJSON:()=>C0,encodeJWT:()=>jT,encodeSig:()=>VB,generateKeyPair:()=>jce,signJWT:()=>Qce,verifyJWT:()=>Kce});var $T=pe(()=>{h();jB();hv();QB();KT()});var iL=L(ur=>{"use strict";h();var KB=ur&&ur.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new eL:typeof navigator<"u"?YT(navigator.userAgent):nL()}ur.detect=Jce;function tL(t){return t!==""&&Yce.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Xce(t){var e=tL(t);return e?e[0]:null}ur.browserName=Xce;function YT(t){var e=tL(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new ZB;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";h();Object.defineProperty(rr,"__esModule",{value:!0});rr.getLocalStorage=rr.getLocalStorageOrThrow=rr.getCrypto=rr.getCryptoOrThrow=rr.getLocation=rr.getLocationOrThrow=rr.getNavigator=rr.getNavigatorOrThrow=rr.getDocument=rr.getDocumentOrThrow=rr.getFromWindowOrThrow=rr.getFromWindow=void 0;function nu(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}rr.getFromWindow=nu;function Lf(t){let e=nu(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}rr.getFromWindowOrThrow=Lf;function eue(){return Lf("document")}rr.getDocumentOrThrow=eue;function tue(){return nu("document")}rr.getDocument=tue;function rue(){return Lf("navigator")}rr.getNavigatorOrThrow=rue;function nue(){return nu("navigator")}rr.getNavigator=nue;function iue(){return Lf("location")}rr.getLocationOrThrow=iue;function sue(){return nu("location")}rr.getLocation=sue;function oue(){return Lf("crypto")}rr.getCryptoOrThrow=oue;function aue(){return nu("crypto")}rr.getCrypto=aue;function cue(){return Lf("localStorage")}rr.getLocalStorageOrThrow=cue;function uue(){return nu("localStorage")}rr.getLocalStorage=uue});var oL=L(Ev=>{"use strict";h();Object.defineProperty(Ev,"__esModule",{value:!0});Ev.getWindowMetadata=void 0;var sL=JT();function lue(){let t,e;try{t=sL.getDocumentOrThrow(),e=sL.getLocationOrThrow()}catch{return null}function r(){let p=t.getElementsByTagName("link"),S=[];for(let I=0;I-1){let D=N.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let U=e.protocol+"//"+e.host;if(D.indexOf("/")===0)U+=D;else{let k=e.pathname.split("/");k.pop();let z=k.join("/");U+=z+"/"+D}S.push(U)}else if(D.indexOf("//")===0){let U=e.protocol+D;S.push(U)}else S.push(D)}}return S}function n(...p){let S=t.getElementsByTagName("meta");for(let I=0;IN.getAttribute(D)).filter(D=>D?p.includes(D):!1);if(R.length&&R){let D=N.getAttribute("content");if(D)return D}}return""}function i(){let p=n("name","og:site_name","og:title","twitter:title");return p||(p=t.title),p}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),c=s(),a=e.origin,u=r();return{description:c,url:a,icons:u,name:o}}Ev.getWindowMetadata=lue});var cL=L((Lxe,aL)=>{"use strict";h();aL.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var hL=L((qxe,dL)=>{"use strict";h();var fL="%[a-f0-9]{2}",uL=new RegExp("("+fL+")|([^%]+?)","gi"),lL=new RegExp("("+fL+")+","gi");function XT(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],XT(r),XT(n))}function fue(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(uL)||[],r=1;r{"use strict";h();pL.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var yL=L((Hxe,mL)=>{"use strict";h();mL.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";h();var hue=cL(),pue=hL(),bL=gL(),gue=yL(),mue=t=>t==null,ZT=Symbol("encodeFragmentIdentifier");function yue(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Ir(e,t),"[",i,"]"].join("")]:[...r,[Ir(e,t),"[",Ir(i,t),"]=",Ir(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Ir(e,t),"[]"].join("")]:[...r,[Ir(e,t),"[]=",Ir(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Ir(e,t),":list="].join("")]:[...r,[Ir(e,t),":list=",Ir(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Ir(r,t),e,Ir(i,t)].join("")]:[[n,Ir(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,Ir(e,t)]:[...r,[Ir(e,t),"=",Ir(n,t)].join("")]}}function vue(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&Lo(n,t).includes(t.arrayFormatSeparator);n=o?Lo(n,t):n;let c=s||o?n.split(t.arrayFormatSeparator).map(a=>Lo(a,t)):n===null?n:Lo(n,t);i[r]=c};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Lo(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(c=>Lo(c,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function wL(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Ir(t,e){return e.encode?e.strict?hue(t):encodeURIComponent(t):t}function Lo(t,e){return e.decode?pue(t):t}function AL(t){return Array.isArray(t)?t.sort():typeof t=="object"?AL(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function EL(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function bue(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function SL(t){t=EL(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function vL(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function _L(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),wL(e.arrayFormatSeparator);let r=vue(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=bL(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Lo(o,e),r(Lo(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=vL(s[o],e);else n[i]=vL(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=AL(o):i[s]=o,i},Object.create(null))}Un.extract=SL;Un.parse=_L;Un.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),wL(e.arrayFormatSeparator);let r=o=>e.skipNull&&mue(t[o])||e.skipEmptyString&&t[o]==="",n=yue(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let c=t[o];return c===void 0?"":c===null?Ir(o,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?Ir(o,e)+"[]":c.reduce(n(o),[]).join("&"):Ir(o,e)+"="+Ir(c,e)}).filter(o=>o.length>0).join("&")};Un.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=bL(t,"#");return Object.assign({url:r.split("?")[0]||"",query:_L(SL(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Lo(n,e)}:{})};Un.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[ZT]:!0},e);let r=EL(t.url).split("?")[0]||"",n=Un.extract(t.url),i=Un.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=Un.stringify(s,e);o&&(o=`?${o}`);let c=bue(t.url);return t.fragmentIdentifier&&(c=`#${e[ZT]?Ir(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${c}`};Un.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[ZT]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=Un.parseUrl(t,r);return Un.stringifyUrl({url:n,query:gue(i,e),fragmentIdentifier:s},r)};Un.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return Un.pick(t,n,r)}});var CL=L(Sv=>{"use strict";h();Object.defineProperty(Sv,"__esModule",{value:!0});var pn=Sf(),eI=Ci(),wue=20;function Aue(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],a=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],p=r[19]<<24|r[18]<<16|r[17]<<8|r[16],S=r[23]<<24|r[22]<<16|r[21]<<8|r[20],I=r[27]<<24|r[26]<<16|r[25]<<8|r[24],N=r[31]<<24|r[30]<<16|r[29]<<8|r[28],R=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],U=e[11]<<24|e[10]<<16|e[9]<<8|e[8],k=e[15]<<24|e[14]<<16|e[13]<<8|e[12],z=n,H=i,F=s,V=o,q=c,C=a,B=u,x=f,g=p,v=S,l=I,d=N,m=R,w=D,_=U,A=k,y=0;y>>16|m<<16,g=g+m|0,q^=g,q=q>>>20|q<<12,H=H+C|0,w^=H,w=w>>>16|w<<16,v=v+w|0,C^=v,C=C>>>20|C<<12,F=F+B|0,_^=F,_=_>>>16|_<<16,l=l+_|0,B^=l,B=B>>>20|B<<12,V=V+x|0,A^=V,A=A>>>16|A<<16,d=d+A|0,x^=d,x=x>>>20|x<<12,F=F+B|0,_^=F,_=_>>>24|_<<8,l=l+_|0,B^=l,B=B>>>25|B<<7,V=V+x|0,A^=V,A=A>>>24|A<<8,d=d+A|0,x^=d,x=x>>>25|x<<7,H=H+C|0,w^=H,w=w>>>24|w<<8,v=v+w|0,C^=v,C=C>>>25|C<<7,z=z+q|0,m^=z,m=m>>>24|m<<8,g=g+m|0,q^=g,q=q>>>25|q<<7,z=z+C|0,A^=z,A=A>>>16|A<<16,l=l+A|0,C^=l,C=C>>>20|C<<12,H=H+B|0,m^=H,m=m>>>16|m<<16,d=d+m|0,B^=d,B=B>>>20|B<<12,F=F+x|0,w^=F,w=w>>>16|w<<16,g=g+w|0,x^=g,x=x>>>20|x<<12,V=V+q|0,_^=V,_=_>>>16|_<<16,v=v+_|0,q^=v,q=q>>>20|q<<12,F=F+x|0,w^=F,w=w>>>24|w<<8,g=g+w|0,x^=g,x=x>>>25|x<<7,V=V+q|0,_^=V,_=_>>>24|_<<8,v=v+_|0,q^=v,q=q>>>25|q<<7,H=H+B|0,m^=H,m=m>>>24|m<<8,d=d+m|0,B^=d,B=B>>>25|B<<7,z=z+C|0,A^=z,A=A>>>24|A<<8,l=l+A|0,C^=l,C=C>>>25|C<<7;pn.writeUint32LE(z+n|0,t,0),pn.writeUint32LE(H+i|0,t,4),pn.writeUint32LE(F+s|0,t,8),pn.writeUint32LE(V+o|0,t,12),pn.writeUint32LE(q+c|0,t,16),pn.writeUint32LE(C+a|0,t,20),pn.writeUint32LE(B+u|0,t,24),pn.writeUint32LE(x+f|0,t,28),pn.writeUint32LE(g+p|0,t,32),pn.writeUint32LE(v+S|0,t,36),pn.writeUint32LE(l+I|0,t,40),pn.writeUint32LE(d+N|0,t,44),pn.writeUint32LE(m+R|0,t,48),pn.writeUint32LE(w+D|0,t,52),pn.writeUint32LE(_+U|0,t,56),pn.writeUint32LE(A+k|0,t,60)}function IL(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var _v=L(Ff=>{"use strict";h();Object.defineProperty(Ff,"__esModule",{value:!0});function _ue(t,e,r){return~(t-1)&e|t-1&r}Ff.select=_ue;function Tue(t,e){return(t|0)-(e|0)-1>>>31&1}Ff.lessOrEqual=Tue;function xL(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Ff.compare=xL;function Iue(t,e){return t.length===0||e.length===0?!1:xL(t,e)!==0}Ff.equal=Iue});var OL=L(Fo=>{"use strict";h();Object.defineProperty(Fo,"__esModule",{value:!0});var Cue=_v(),Tv=Ci();Fo.DIGEST_LENGTH=16;var NL=function(){function t(e){this.digestLength=Fo.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var c=e[10]|e[11]<<8;this._r[6]=(o>>>14|c<<2)&8191;var a=e[12]|e[13]<<8;this._r[7]=(c>>>11|a<<5)&8065;var u=e[14]|e[15]<<8;this._r[8]=(a>>>8|u<<8)&8191,this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],c=this._h[2],a=this._h[3],u=this._h[4],f=this._h[5],p=this._h[6],S=this._h[7],I=this._h[8],N=this._h[9],R=this._r[0],D=this._r[1],U=this._r[2],k=this._r[3],z=this._r[4],H=this._r[5],F=this._r[6],V=this._r[7],q=this._r[8],C=this._r[9];n>=16;){var B=e[r+0]|e[r+1]<<8;s+=B&8191;var x=e[r+2]|e[r+3]<<8;o+=(B>>>13|x<<3)&8191;var g=e[r+4]|e[r+5]<<8;c+=(x>>>10|g<<6)&8191;var v=e[r+6]|e[r+7]<<8;a+=(g>>>7|v<<9)&8191;var l=e[r+8]|e[r+9]<<8;u+=(v>>>4|l<<12)&8191,f+=l>>>1&8191;var d=e[r+10]|e[r+11]<<8;p+=(l>>>14|d<<2)&8191;var m=e[r+12]|e[r+13]<<8;S+=(d>>>11|m<<5)&8191;var w=e[r+14]|e[r+15]<<8;I+=(m>>>8|w<<8)&8191,N+=w>>>5|i;var _=0,A=_;A+=s*R,A+=o*(5*C),A+=c*(5*q),A+=a*(5*V),A+=u*(5*F),_=A>>>13,A&=8191,A+=f*(5*H),A+=p*(5*z),A+=S*(5*k),A+=I*(5*U),A+=N*(5*D),_+=A>>>13,A&=8191;var y=_;y+=s*D,y+=o*R,y+=c*(5*C),y+=a*(5*q),y+=u*(5*V),_=y>>>13,y&=8191,y+=f*(5*F),y+=p*(5*H),y+=S*(5*z),y+=I*(5*k),y+=N*(5*U),_+=y>>>13,y&=8191;var T=_;T+=s*U,T+=o*D,T+=c*R,T+=a*(5*C),T+=u*(5*q),_=T>>>13,T&=8191,T+=f*(5*V),T+=p*(5*F),T+=S*(5*H),T+=I*(5*z),T+=N*(5*k),_+=T>>>13,T&=8191;var E=_;E+=s*k,E+=o*U,E+=c*D,E+=a*R,E+=u*(5*C),_=E>>>13,E&=8191,E+=f*(5*q),E+=p*(5*V),E+=S*(5*F),E+=I*(5*H),E+=N*(5*z),_+=E>>>13,E&=8191;var M=_;M+=s*z,M+=o*k,M+=c*U,M+=a*D,M+=u*R,_=M>>>13,M&=8191,M+=f*(5*C),M+=p*(5*q),M+=S*(5*V),M+=I*(5*F),M+=N*(5*H),_+=M>>>13,M&=8191;var W=_;W+=s*H,W+=o*z,W+=c*k,W+=a*U,W+=u*D,_=W>>>13,W&=8191,W+=f*R,W+=p*(5*C),W+=S*(5*q),W+=I*(5*V),W+=N*(5*F),_+=W>>>13,W&=8191;var Y=_;Y+=s*F,Y+=o*H,Y+=c*z,Y+=a*k,Y+=u*U,_=Y>>>13,Y&=8191,Y+=f*D,Y+=p*R,Y+=S*(5*C),Y+=I*(5*q),Y+=N*(5*V),_+=Y>>>13,Y&=8191;var P=_;P+=s*V,P+=o*F,P+=c*H,P+=a*z,P+=u*k,_=P>>>13,P&=8191,P+=f*U,P+=p*D,P+=S*R,P+=I*(5*C),P+=N*(5*q),_+=P>>>13,P&=8191;var G=_;G+=s*q,G+=o*V,G+=c*F,G+=a*H,G+=u*z,_=G>>>13,G&=8191,G+=f*k,G+=p*U,G+=S*D,G+=I*R,G+=N*(5*C),_+=G>>>13,G&=8191;var Q=_;Q+=s*C,Q+=o*q,Q+=c*V,Q+=a*F,Q+=u*H,_=Q>>>13,Q&=8191,Q+=f*z,Q+=p*k,Q+=S*U,Q+=I*D,Q+=N*R,_+=Q>>>13,Q&=8191,_=(_<<2)+_|0,_=_+A|0,A=_&8191,_=_>>>13,y+=_,s=A,o=y,c=T,a=E,u=M,f=W,p=Y,S=P,I=G,N=Q,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=c,this._h[3]=a,this._h[4]=u,this._h[5]=f,this._h[6]=p,this._h[7]=S,this._h[8]=I,this._h[9]=N},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,c;if(this._leftover){for(c=this._leftover,this._buffer[c++]=1;c<16;c++)this._buffer[c]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,c=2;c<10;c++)this._h[c]+=i,i=this._h[c]>>>13,this._h[c]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,c=1;c<10;c++)n[c]=this._h[c]+i,i=n[c]>>>13,n[c]&=8191;for(n[9]-=8192,s=(i^1)-1,c=0;c<10;c++)n[c]&=s;for(s=~s,c=0;c<10;c++)this._h[c]=this._h[c]&s|n[c];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,c=1;c<8;c++)o=(this._h[c]+this._pad[c]|0)+(o>>>16)|0,this._h[c]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";h();Object.defineProperty(qo,"__esModule",{value:!0});var Iv=CL(),Oue=OL(),x0=Ci(),PL=Sf(),Pue=_v();qo.KEY_LENGTH=32;qo.NONCE_LENGTH=12;qo.TAG_LENGTH=16;var RL=new Uint8Array(16),Rue=function(){function t(e){if(this.nonceLength=qo.NONCE_LENGTH,this.tagLength=qo.TAG_LENGTH,e.length!==qo.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);Iv.stream(this._key,s,o,4);var c=r.length+this.tagLength,a;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");a=i}else a=new Uint8Array(c);return Iv.streamXOR(this._key,s,r,a,4),this._authenticate(a.subarray(a.length-this.tagLength,a.length),o,a.subarray(0,a.length-this.tagLength),n),x0.wipe(s),a},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(RL.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(RL.subarray(n.length%16));var o=new Uint8Array(8);i&&PL.writeUint64LE(i.length,o),s.update(o),PL.writeUint64LE(n.length,o),s.update(o);for(var c=s.digest(),a=0;a{"use strict";h();Object.defineProperty(tI,"__esModule",{value:!0});function Mue(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}tI.isSerializableHash=Mue});var LL=L(N0=>{"use strict";h();Object.defineProperty(N0,"__esModule",{value:!0});var zs=DL(),Due=_v(),Bue=Ci(),BL=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";h();Object.defineProperty(rI,"__esModule",{value:!0});var FL=LL(),qL=Ci(),Fue=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=FL.hmac(this._hash,n,r);this._hmac=new FL.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";h();Object.defineProperty(La,"__esModule",{value:!0});var xv=Sf(),Cv=Ci();La.DIGEST_LENGTH=32;La.BLOCK_SIZE=64;var kL=function(){function t(){this.digestLength=La.DIGEST_LENGTH,this.blockSize=La.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Cv.wipe(this._buffer),Cv.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(nI(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=nI(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Cv.wipe(e.state),e.buffer&&Cv.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();La.SHA256=kL;var que=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 nI(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],c=e[2],a=e[3],u=e[4],f=e[5],p=e[6],S=e[7],I=0;I<16;I++){var N=n+I*4;t[I]=xv.readUint32BE(r,N)}for(var I=16;I<64;I++){var R=t[I-2],D=(R>>>17|R<<15)^(R>>>19|R<<13)^R>>>10;R=t[I-15];var U=(R>>>7|R<<25)^(R>>>18|R<<14)^R>>>3;t[I]=(D+t[I-7]|0)+(U+t[I-16]|0)}for(var I=0;I<64;I++){var D=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&f^~u&p)|0)+(S+(que[I]+t[I]|0)|0)|0,U=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&c^o&c)|0;S=p,p=f,f=u,u=a+D|0,a=c,c=o,o=s,s=D+U|0}e[0]+=s,e[1]+=o,e[2]+=c,e[3]+=a,e[4]+=u,e[5]+=f,e[6]+=p,e[7]+=S,n+=64,i-=64}return n}function Uue(t){var e=new kL;e.update(t);var r=e.digest();return e.clean(),r}La.hash=Uue});var jL=L(mr=>{"use strict";h();Object.defineProperty(mr,"__esModule",{value:!0});mr.sharedKey=mr.generateKeyPair=mr.generateKeyPairFromSeed=mr.scalarMultBase=mr.scalarMult=mr.SHARED_KEY_LENGTH=mr.SECRET_KEY_LENGTH=mr.PUBLIC_KEY_LENGTH=void 0;var kue=y0(),Vue=Ci();mr.PUBLIC_KEY_LENGTH=32;mr.SECRET_KEY_LENGTH=32;mr.SHARED_KEY_LENGTH=32;function js(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,O0(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function zue(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Nv(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ov(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Uo(t,e,r){let n,i,s=0,o=0,c=0,a=0,u=0,f=0,p=0,S=0,I=0,N=0,R=0,D=0,U=0,k=0,z=0,H=0,F=0,V=0,q=0,C=0,B=0,x=0,g=0,v=0,l=0,d=0,m=0,w=0,_=0,A=0,y=0,T=r[0],E=r[1],M=r[2],W=r[3],Y=r[4],P=r[5],G=r[6],Q=r[7],$=r[8],ee=r[9],ie=r[10],X=r[11],re=r[12],ae=r[13],Z=r[14],oe=r[15];n=e[0],s+=n*T,o+=n*E,c+=n*M,a+=n*W,u+=n*Y,f+=n*P,p+=n*G,S+=n*Q,I+=n*$,N+=n*ee,R+=n*ie,D+=n*X,U+=n*re,k+=n*ae,z+=n*Z,H+=n*oe,n=e[1],o+=n*T,c+=n*E,a+=n*M,u+=n*W,f+=n*Y,p+=n*P,S+=n*G,I+=n*Q,N+=n*$,R+=n*ee,D+=n*ie,U+=n*X,k+=n*re,z+=n*ae,H+=n*Z,F+=n*oe,n=e[2],c+=n*T,a+=n*E,u+=n*M,f+=n*W,p+=n*Y,S+=n*P,I+=n*G,N+=n*Q,R+=n*$,D+=n*ee,U+=n*ie,k+=n*X,z+=n*re,H+=n*ae,F+=n*Z,V+=n*oe,n=e[3],a+=n*T,u+=n*E,f+=n*M,p+=n*W,S+=n*Y,I+=n*P,N+=n*G,R+=n*Q,D+=n*$,U+=n*ee,k+=n*ie,z+=n*X,H+=n*re,F+=n*ae,V+=n*Z,q+=n*oe,n=e[4],u+=n*T,f+=n*E,p+=n*M,S+=n*W,I+=n*Y,N+=n*P,R+=n*G,D+=n*Q,U+=n*$,k+=n*ee,z+=n*ie,H+=n*X,F+=n*re,V+=n*ae,q+=n*Z,C+=n*oe,n=e[5],f+=n*T,p+=n*E,S+=n*M,I+=n*W,N+=n*Y,R+=n*P,D+=n*G,U+=n*Q,k+=n*$,z+=n*ee,H+=n*ie,F+=n*X,V+=n*re,q+=n*ae,C+=n*Z,B+=n*oe,n=e[6],p+=n*T,S+=n*E,I+=n*M,N+=n*W,R+=n*Y,D+=n*P,U+=n*G,k+=n*Q,z+=n*$,H+=n*ee,F+=n*ie,V+=n*X,q+=n*re,C+=n*ae,B+=n*Z,x+=n*oe,n=e[7],S+=n*T,I+=n*E,N+=n*M,R+=n*W,D+=n*Y,U+=n*P,k+=n*G,z+=n*Q,H+=n*$,F+=n*ee,V+=n*ie,q+=n*X,C+=n*re,B+=n*ae,x+=n*Z,g+=n*oe,n=e[8],I+=n*T,N+=n*E,R+=n*M,D+=n*W,U+=n*Y,k+=n*P,z+=n*G,H+=n*Q,F+=n*$,V+=n*ee,q+=n*ie,C+=n*X,B+=n*re,x+=n*ae,g+=n*Z,v+=n*oe,n=e[9],N+=n*T,R+=n*E,D+=n*M,U+=n*W,k+=n*Y,z+=n*P,H+=n*G,F+=n*Q,V+=n*$,q+=n*ee,C+=n*ie,B+=n*X,x+=n*re,g+=n*ae,v+=n*Z,l+=n*oe,n=e[10],R+=n*T,D+=n*E,U+=n*M,k+=n*W,z+=n*Y,H+=n*P,F+=n*G,V+=n*Q,q+=n*$,C+=n*ee,B+=n*ie,x+=n*X,g+=n*re,v+=n*ae,l+=n*Z,d+=n*oe,n=e[11],D+=n*T,U+=n*E,k+=n*M,z+=n*W,H+=n*Y,F+=n*P,V+=n*G,q+=n*Q,C+=n*$,B+=n*ee,x+=n*ie,g+=n*X,v+=n*re,l+=n*ae,d+=n*Z,m+=n*oe,n=e[12],U+=n*T,k+=n*E,z+=n*M,H+=n*W,F+=n*Y,V+=n*P,q+=n*G,C+=n*Q,B+=n*$,x+=n*ee,g+=n*ie,v+=n*X,l+=n*re,d+=n*ae,m+=n*Z,w+=n*oe,n=e[13],k+=n*T,z+=n*E,H+=n*M,F+=n*W,V+=n*Y,q+=n*P,C+=n*G,B+=n*Q,x+=n*$,g+=n*ee,v+=n*ie,l+=n*X,d+=n*re,m+=n*ae,w+=n*Z,_+=n*oe,n=e[14],z+=n*T,H+=n*E,F+=n*M,V+=n*W,q+=n*Y,C+=n*P,B+=n*G,x+=n*Q,g+=n*$,v+=n*ee,l+=n*ie,d+=n*X,m+=n*re,w+=n*ae,_+=n*Z,A+=n*oe,n=e[15],H+=n*T,F+=n*E,V+=n*M,q+=n*W,C+=n*Y,B+=n*P,x+=n*G,g+=n*Q,v+=n*$,l+=n*ee,d+=n*ie,m+=n*X,w+=n*re,_+=n*ae,A+=n*Z,y+=n*oe,s+=38*F,o+=38*V,c+=38*q,a+=38*C,u+=38*B,f+=38*x,p+=38*g,S+=38*v,I+=38*l,N+=38*d,R+=38*m,D+=38*w,U+=38*_,k+=38*A,z+=38*y,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=k+i+65535,i=Math.floor(n/65536),k=n-i*65536,n=z+i+65535,i=Math.floor(n/65536),z=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=c,t[3]=a,t[4]=u,t[5]=f,t[6]=p,t[7]=S,t[8]=I,t[9]=N,t[10]=R,t[11]=D,t[12]=U,t[13]=k,t[14]=z,t[15]=H}function P0(t,e){Uo(t,e,e)}function jue(t,e){let r=js();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)P0(r,r),n!==2&&n!==4&&Uo(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function sI(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=js(),s=js(),o=js(),c=js(),a=js(),u=js();for(let I=0;I<31;I++)r[I]=t[I];r[31]=t[31]&127|64,r[0]&=248,zue(n,e);for(let I=0;I<16;I++)s[I]=n[I];i[0]=c[0]=1;for(let I=254;I>=0;--I){let N=r[I>>>3]>>>(I&7)&1;O0(i,s,N),O0(o,c,N),Nv(a,i,o),Ov(i,i,o),Nv(o,s,c),Ov(s,s,c),P0(c,a),P0(u,i),Uo(i,o,i),Uo(o,s,a),Nv(a,i,o),Ov(i,i,o),P0(s,i),Ov(o,c,u),Uo(i,o,Hue),Nv(i,i,c),Uo(o,o,i),Uo(i,c,u),Uo(c,s,n),P0(s,a),O0(i,s,N),O0(o,c,N)}for(let I=0;I<16;I++)n[I+16]=i[I],n[I+32]=o[I],n[I+48]=s[I],n[I+64]=c[I];let f=n.subarray(32),p=n.subarray(16);jue(f,f),Uo(p,p,f);let S=new Uint8Array(32);return Gue(S,p),S}mr.scalarMult=sI;function GL(t){return sI(t,HL)}mr.scalarMultBase=GL;function zL(t){if(t.length!==mr.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${mr.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:GL(e),secretKey:e}}mr.generateKeyPairFromSeed=zL;function Que(t){let e=(0,kue.randomBytes)(32,t),r=zL(e);return(0,Vue.wipe)(e),r}mr.generateKeyPair=Que;function Kue(t,e,r=!1){if(t.length!==mr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==mr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=sI(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{h()});function WL(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{h()});function YL(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Nf(t.length);for(let n=0;n{h();pv()});var oI={};Zt(oI,{compare:()=>QL,concat:()=>gv,equals:()=>WL,fromString:()=>Gs,toString:()=>Bo,xor:()=>YL});var aI=pe(()=>{h();KL();pT();$L();VT();kT();JL()});var XL=L((_Ne,Wue)=>{Wue.exports={name:"elliptic",version:"6.5.7",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var Qs=L((ZL,cI)=>{h();(function(t,e){"use strict";function r(x,g){if(!x)throw new Error(g||"Assertion failed")}function n(x,g){x.super_=g;var v=function(){};v.prototype=g.prototype,x.prototype=new v,x.prototype.constructor=x}function i(x,g,v){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((g==="le"||g==="be")&&(v=g,g=10),this._init(x||0,g||10,v||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=wo().Buffer}catch{}i.isBN=function(g){return g instanceof i?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===i.wordSize&&Array.isArray(g.words)},i.max=function(g,v){return g.cmp(v)>0?g:v},i.min=function(g,v){return g.cmp(v)<0?g:v},i.prototype._init=function(g,v,l){if(typeof g=="number")return this._initNumber(g,v,l);if(typeof g=="object")return this._initArray(g,v,l);v==="hex"&&(v=16),r(v===(v|0)&&v>=2&&v<=36),g=g.toString().replace(/\s+/g,"");var d=0;g[0]==="-"&&(d++,this.negative=1),d=0;d-=3)w=g[d]|g[d-1]<<8|g[d-2]<<16,this.words[m]|=w<<_&67108863,this.words[m+1]=w>>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);else if(l==="le")for(d=0,m=0;d>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);return this.strip()};function o(x,g){var v=x.charCodeAt(g);return v>=65&&v<=70?v-55:v>=97&&v<=102?v-87:v-48&15}function c(x,g,v){var l=o(x,v);return v-1>=g&&(l|=o(x,v-1)<<4),l}i.prototype._parseHex=function(g,v,l){this.length=Math.ceil((g.length-v)/6),this.words=new Array(this.length);for(var d=0;d=v;d-=2)_=c(g,v,d)<=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8;else{var A=g.length-v;for(d=A%2===0?v+1:v;d=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8}this.strip()};function a(x,g,v,l){for(var d=0,m=Math.min(x.length,v),w=g;w=49?d+=_-49+10:_>=17?d+=_-17+10:d+=_}return d}i.prototype._parseBase=function(g,v,l){this.words=[0],this.length=1;for(var d=0,m=1;m<=67108863;m*=v)d++;d--,m=m/v|0;for(var w=g.length-l,_=w%d,A=Math.min(w,w-_)+l,y=0,T=l;T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","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"],f=[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],p=[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];i.prototype.toString=function(g,v){g=g||10,v=v|0||1;var l;if(g===16||g==="hex"){l="";for(var d=0,m=0,w=0;w>>24-d&16777215,m!==0||w!==this.length-1?l=u[6-A.length]+A+l:l=A+l,d+=2,d>=26&&(d-=26,w--)}for(m!==0&&(l=m.toString(16)+l);l.length%v!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(g===(g|0)&&g>=2&&g<=36){var y=f[g],T=p[g];l="";var E=this.clone();for(E.negative=0;!E.isZero();){var M=E.modn(T).toString(g);E=E.idivn(T),E.isZero()?l=M+l:l=u[y-M.length]+M+l}for(this.isZero()&&(l="0"+l);l.length%v!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(g,v){return r(typeof s<"u"),this.toArrayLike(s,g,v)},i.prototype.toArray=function(g,v){return this.toArrayLike(Array,g,v)},i.prototype.toArrayLike=function(g,v,l){var d=this.byteLength(),m=l||Math.max(1,d);r(d<=m,"byte array longer than desired length"),r(m>0,"Requested array length <= 0"),this.strip();var w=v==="le",_=new g(m),A,y,T=this.clone();if(w){for(y=0;!T.isZero();y++)A=T.andln(255),T.iushrn(8),_[y]=A;for(;y=4096&&(l+=13,v>>>=13),v>=64&&(l+=7,v>>>=7),v>=8&&(l+=4,v>>>=4),v>=2&&(l+=2,v>>>=2),l+v},i.prototype._zeroBits=function(g){if(g===0)return 26;var v=g,l=0;return v&8191||(l+=13,v>>>=13),v&127||(l+=7,v>>>=7),v&15||(l+=4,v>>>=4),v&3||(l+=2,v>>>=2),v&1||l++,l},i.prototype.bitLength=function(){var g=this.words[this.length-1],v=this._countBits(g);return(this.length-1)*26+v};function S(x){for(var g=new Array(x.bitLength()),v=0;v>>d}return g}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,v=0;vg.length?this.clone().ior(g):g.clone().ior(this)},i.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},i.prototype.iuand=function(g){var v;this.length>g.length?v=g:v=this;for(var l=0;lg.length?this.clone().iand(g):g.clone().iand(this)},i.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},i.prototype.iuxor=function(g){var v,l;this.length>g.length?(v=this,l=g):(v=g,l=this);for(var d=0;dg.length?this.clone().ixor(g):g.clone().ixor(this)},i.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},i.prototype.inotn=function(g){r(typeof g=="number"&&g>=0);var v=Math.ceil(g/26)|0,l=g%26;this._expand(v),l>0&&v--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-l),this.strip()},i.prototype.notn=function(g){return this.clone().inotn(g)},i.prototype.setn=function(g,v){r(typeof g=="number"&&g>=0);var l=g/26|0,d=g%26;return this._expand(l+1),v?this.words[l]=this.words[l]|1<g.length?(l=this,d=g):(l=g,d=this);for(var m=0,w=0;w>>26;for(;m!==0&&w>>26;if(this.length=l.length,m!==0)this.words[this.length]=m,this.length++;else if(l!==this)for(;wg.length?this.clone().iadd(g):g.clone().iadd(this)},i.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var v=this.iadd(g);return g.negative=1,v._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var l=this.cmp(g);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,m;l>0?(d=this,m=g):(d=g,m=this);for(var w=0,_=0;_>26,this.words[_]=v&67108863;for(;w!==0&&_>26,this.words[_]=v&67108863;if(w===0&&_>>26,E=A&67108863,M=Math.min(y,g.length-1),W=Math.max(0,y-x.length+1);W<=M;W++){var Y=y-W|0;d=x.words[Y]|0,m=g.words[W]|0,w=d*m+E,T+=w/67108864|0,E=w&67108863}v.words[y]=E|0,A=T|0}return A!==0?v.words[y]=A|0:v.length--,v.strip()}var N=function(g,v,l){var d=g.words,m=v.words,w=l.words,_=0,A,y,T,E=d[0]|0,M=E&8191,W=E>>>13,Y=d[1]|0,P=Y&8191,G=Y>>>13,Q=d[2]|0,$=Q&8191,ee=Q>>>13,ie=d[3]|0,X=ie&8191,re=ie>>>13,ae=d[4]|0,Z=ae&8191,oe=ae>>>13,Ot=d[5]|0,De=Ot&8191,Pt=Ot>>>13,Rt=d[6]|0,Be=Rt&8191,Mt=Rt>>>13,Dt=d[7]|0,Le=Dt&8191,Bt=Dt>>>13,Lt=d[8]|0,Fe=Lt&8191,Ft=Lt>>>13,at=d[9]|0,Se=at&8191,ct=at>>>13,ut=m[0]|0,_e=ut&8191,lt=ut>>>13,ft=m[1]|0,Te=ft&8191,dt=ft>>>13,ht=m[2]|0,Ie=ht&8191,pt=ht>>>13,gt=m[3]|0,Ce=gt&8191,mt=gt>>>13,yt=m[4]|0,xe=yt&8191,vt=yt>>>13,bt=m[5]|0,Ne=bt&8191,wt=bt>>>13,At=m[6]|0,Oe=At&8191,Et=At>>>13,St=m[7]|0,Pe=St&8191,_t=St>>>13,Tt=m[8]|0,Re=Tt&8191,It=Tt>>>13,Ct=m[9]|0,Me=Ct&8191,xt=Ct>>>13;l.negative=g.negative^v.negative,l.length=19,A=Math.imul(M,_e),y=Math.imul(M,lt),y=y+Math.imul(W,_e)|0,T=Math.imul(W,lt);var rt=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(rt>>>26)|0,rt&=67108863,A=Math.imul(P,_e),y=Math.imul(P,lt),y=y+Math.imul(G,_e)|0,T=Math.imul(G,lt),A=A+Math.imul(M,Te)|0,y=y+Math.imul(M,dt)|0,y=y+Math.imul(W,Te)|0,T=T+Math.imul(W,dt)|0;var nt=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(nt>>>26)|0,nt&=67108863,A=Math.imul($,_e),y=Math.imul($,lt),y=y+Math.imul(ee,_e)|0,T=Math.imul(ee,lt),A=A+Math.imul(P,Te)|0,y=y+Math.imul(P,dt)|0,y=y+Math.imul(G,Te)|0,T=T+Math.imul(G,dt)|0,A=A+Math.imul(M,Ie)|0,y=y+Math.imul(M,pt)|0,y=y+Math.imul(W,Ie)|0,T=T+Math.imul(W,pt)|0;var nn=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(nn>>>26)|0,nn&=67108863,A=Math.imul(X,_e),y=Math.imul(X,lt),y=y+Math.imul(re,_e)|0,T=Math.imul(re,lt),A=A+Math.imul($,Te)|0,y=y+Math.imul($,dt)|0,y=y+Math.imul(ee,Te)|0,T=T+Math.imul(ee,dt)|0,A=A+Math.imul(P,Ie)|0,y=y+Math.imul(P,pt)|0,y=y+Math.imul(G,Ie)|0,T=T+Math.imul(G,pt)|0,A=A+Math.imul(M,Ce)|0,y=y+Math.imul(M,mt)|0,y=y+Math.imul(W,Ce)|0,T=T+Math.imul(W,mt)|0;var sn=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(sn>>>26)|0,sn&=67108863,A=Math.imul(Z,_e),y=Math.imul(Z,lt),y=y+Math.imul(oe,_e)|0,T=Math.imul(oe,lt),A=A+Math.imul(X,Te)|0,y=y+Math.imul(X,dt)|0,y=y+Math.imul(re,Te)|0,T=T+Math.imul(re,dt)|0,A=A+Math.imul($,Ie)|0,y=y+Math.imul($,pt)|0,y=y+Math.imul(ee,Ie)|0,T=T+Math.imul(ee,pt)|0,A=A+Math.imul(P,Ce)|0,y=y+Math.imul(P,mt)|0,y=y+Math.imul(G,Ce)|0,T=T+Math.imul(G,mt)|0,A=A+Math.imul(M,xe)|0,y=y+Math.imul(M,vt)|0,y=y+Math.imul(W,xe)|0,T=T+Math.imul(W,vt)|0;var on=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(on>>>26)|0,on&=67108863,A=Math.imul(De,_e),y=Math.imul(De,lt),y=y+Math.imul(Pt,_e)|0,T=Math.imul(Pt,lt),A=A+Math.imul(Z,Te)|0,y=y+Math.imul(Z,dt)|0,y=y+Math.imul(oe,Te)|0,T=T+Math.imul(oe,dt)|0,A=A+Math.imul(X,Ie)|0,y=y+Math.imul(X,pt)|0,y=y+Math.imul(re,Ie)|0,T=T+Math.imul(re,pt)|0,A=A+Math.imul($,Ce)|0,y=y+Math.imul($,mt)|0,y=y+Math.imul(ee,Ce)|0,T=T+Math.imul(ee,mt)|0,A=A+Math.imul(P,xe)|0,y=y+Math.imul(P,vt)|0,y=y+Math.imul(G,xe)|0,T=T+Math.imul(G,vt)|0,A=A+Math.imul(M,Ne)|0,y=y+Math.imul(M,wt)|0,y=y+Math.imul(W,Ne)|0,T=T+Math.imul(W,wt)|0;var an=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(an>>>26)|0,an&=67108863,A=Math.imul(Be,_e),y=Math.imul(Be,lt),y=y+Math.imul(Mt,_e)|0,T=Math.imul(Mt,lt),A=A+Math.imul(De,Te)|0,y=y+Math.imul(De,dt)|0,y=y+Math.imul(Pt,Te)|0,T=T+Math.imul(Pt,dt)|0,A=A+Math.imul(Z,Ie)|0,y=y+Math.imul(Z,pt)|0,y=y+Math.imul(oe,Ie)|0,T=T+Math.imul(oe,pt)|0,A=A+Math.imul(X,Ce)|0,y=y+Math.imul(X,mt)|0,y=y+Math.imul(re,Ce)|0,T=T+Math.imul(re,mt)|0,A=A+Math.imul($,xe)|0,y=y+Math.imul($,vt)|0,y=y+Math.imul(ee,xe)|0,T=T+Math.imul(ee,vt)|0,A=A+Math.imul(P,Ne)|0,y=y+Math.imul(P,wt)|0,y=y+Math.imul(G,Ne)|0,T=T+Math.imul(G,wt)|0,A=A+Math.imul(M,Oe)|0,y=y+Math.imul(M,Et)|0,y=y+Math.imul(W,Oe)|0,T=T+Math.imul(W,Et)|0;var cn=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(cn>>>26)|0,cn&=67108863,A=Math.imul(Le,_e),y=Math.imul(Le,lt),y=y+Math.imul(Bt,_e)|0,T=Math.imul(Bt,lt),A=A+Math.imul(Be,Te)|0,y=y+Math.imul(Be,dt)|0,y=y+Math.imul(Mt,Te)|0,T=T+Math.imul(Mt,dt)|0,A=A+Math.imul(De,Ie)|0,y=y+Math.imul(De,pt)|0,y=y+Math.imul(Pt,Ie)|0,T=T+Math.imul(Pt,pt)|0,A=A+Math.imul(Z,Ce)|0,y=y+Math.imul(Z,mt)|0,y=y+Math.imul(oe,Ce)|0,T=T+Math.imul(oe,mt)|0,A=A+Math.imul(X,xe)|0,y=y+Math.imul(X,vt)|0,y=y+Math.imul(re,xe)|0,T=T+Math.imul(re,vt)|0,A=A+Math.imul($,Ne)|0,y=y+Math.imul($,wt)|0,y=y+Math.imul(ee,Ne)|0,T=T+Math.imul(ee,wt)|0,A=A+Math.imul(P,Oe)|0,y=y+Math.imul(P,Et)|0,y=y+Math.imul(G,Oe)|0,T=T+Math.imul(G,Et)|0,A=A+Math.imul(M,Pe)|0,y=y+Math.imul(M,_t)|0,y=y+Math.imul(W,Pe)|0,T=T+Math.imul(W,_t)|0;var un=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(un>>>26)|0,un&=67108863,A=Math.imul(Fe,_e),y=Math.imul(Fe,lt),y=y+Math.imul(Ft,_e)|0,T=Math.imul(Ft,lt),A=A+Math.imul(Le,Te)|0,y=y+Math.imul(Le,dt)|0,y=y+Math.imul(Bt,Te)|0,T=T+Math.imul(Bt,dt)|0,A=A+Math.imul(Be,Ie)|0,y=y+Math.imul(Be,pt)|0,y=y+Math.imul(Mt,Ie)|0,T=T+Math.imul(Mt,pt)|0,A=A+Math.imul(De,Ce)|0,y=y+Math.imul(De,mt)|0,y=y+Math.imul(Pt,Ce)|0,T=T+Math.imul(Pt,mt)|0,A=A+Math.imul(Z,xe)|0,y=y+Math.imul(Z,vt)|0,y=y+Math.imul(oe,xe)|0,T=T+Math.imul(oe,vt)|0,A=A+Math.imul(X,Ne)|0,y=y+Math.imul(X,wt)|0,y=y+Math.imul(re,Ne)|0,T=T+Math.imul(re,wt)|0,A=A+Math.imul($,Oe)|0,y=y+Math.imul($,Et)|0,y=y+Math.imul(ee,Oe)|0,T=T+Math.imul(ee,Et)|0,A=A+Math.imul(P,Pe)|0,y=y+Math.imul(P,_t)|0,y=y+Math.imul(G,Pe)|0,T=T+Math.imul(G,_t)|0,A=A+Math.imul(M,Re)|0,y=y+Math.imul(M,It)|0,y=y+Math.imul(W,Re)|0,T=T+Math.imul(W,It)|0;var Ui=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,A=Math.imul(Se,_e),y=Math.imul(Se,lt),y=y+Math.imul(ct,_e)|0,T=Math.imul(ct,lt),A=A+Math.imul(Fe,Te)|0,y=y+Math.imul(Fe,dt)|0,y=y+Math.imul(Ft,Te)|0,T=T+Math.imul(Ft,dt)|0,A=A+Math.imul(Le,Ie)|0,y=y+Math.imul(Le,pt)|0,y=y+Math.imul(Bt,Ie)|0,T=T+Math.imul(Bt,pt)|0,A=A+Math.imul(Be,Ce)|0,y=y+Math.imul(Be,mt)|0,y=y+Math.imul(Mt,Ce)|0,T=T+Math.imul(Mt,mt)|0,A=A+Math.imul(De,xe)|0,y=y+Math.imul(De,vt)|0,y=y+Math.imul(Pt,xe)|0,T=T+Math.imul(Pt,vt)|0,A=A+Math.imul(Z,Ne)|0,y=y+Math.imul(Z,wt)|0,y=y+Math.imul(oe,Ne)|0,T=T+Math.imul(oe,wt)|0,A=A+Math.imul(X,Oe)|0,y=y+Math.imul(X,Et)|0,y=y+Math.imul(re,Oe)|0,T=T+Math.imul(re,Et)|0,A=A+Math.imul($,Pe)|0,y=y+Math.imul($,_t)|0,y=y+Math.imul(ee,Pe)|0,T=T+Math.imul(ee,_t)|0,A=A+Math.imul(P,Re)|0,y=y+Math.imul(P,It)|0,y=y+Math.imul(G,Re)|0,T=T+Math.imul(G,It)|0,A=A+Math.imul(M,Me)|0,y=y+Math.imul(M,xt)|0,y=y+Math.imul(W,Me)|0,T=T+Math.imul(W,xt)|0;var ki=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(ki>>>26)|0,ki&=67108863,A=Math.imul(Se,Te),y=Math.imul(Se,dt),y=y+Math.imul(ct,Te)|0,T=Math.imul(ct,dt),A=A+Math.imul(Fe,Ie)|0,y=y+Math.imul(Fe,pt)|0,y=y+Math.imul(Ft,Ie)|0,T=T+Math.imul(Ft,pt)|0,A=A+Math.imul(Le,Ce)|0,y=y+Math.imul(Le,mt)|0,y=y+Math.imul(Bt,Ce)|0,T=T+Math.imul(Bt,mt)|0,A=A+Math.imul(Be,xe)|0,y=y+Math.imul(Be,vt)|0,y=y+Math.imul(Mt,xe)|0,T=T+Math.imul(Mt,vt)|0,A=A+Math.imul(De,Ne)|0,y=y+Math.imul(De,wt)|0,y=y+Math.imul(Pt,Ne)|0,T=T+Math.imul(Pt,wt)|0,A=A+Math.imul(Z,Oe)|0,y=y+Math.imul(Z,Et)|0,y=y+Math.imul(oe,Oe)|0,T=T+Math.imul(oe,Et)|0,A=A+Math.imul(X,Pe)|0,y=y+Math.imul(X,_t)|0,y=y+Math.imul(re,Pe)|0,T=T+Math.imul(re,_t)|0,A=A+Math.imul($,Re)|0,y=y+Math.imul($,It)|0,y=y+Math.imul(ee,Re)|0,T=T+Math.imul(ee,It)|0,A=A+Math.imul(P,Me)|0,y=y+Math.imul(P,xt)|0,y=y+Math.imul(G,Me)|0,T=T+Math.imul(G,xt)|0;var Vi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,A=Math.imul(Se,Ie),y=Math.imul(Se,pt),y=y+Math.imul(ct,Ie)|0,T=Math.imul(ct,pt),A=A+Math.imul(Fe,Ce)|0,y=y+Math.imul(Fe,mt)|0,y=y+Math.imul(Ft,Ce)|0,T=T+Math.imul(Ft,mt)|0,A=A+Math.imul(Le,xe)|0,y=y+Math.imul(Le,vt)|0,y=y+Math.imul(Bt,xe)|0,T=T+Math.imul(Bt,vt)|0,A=A+Math.imul(Be,Ne)|0,y=y+Math.imul(Be,wt)|0,y=y+Math.imul(Mt,Ne)|0,T=T+Math.imul(Mt,wt)|0,A=A+Math.imul(De,Oe)|0,y=y+Math.imul(De,Et)|0,y=y+Math.imul(Pt,Oe)|0,T=T+Math.imul(Pt,Et)|0,A=A+Math.imul(Z,Pe)|0,y=y+Math.imul(Z,_t)|0,y=y+Math.imul(oe,Pe)|0,T=T+Math.imul(oe,_t)|0,A=A+Math.imul(X,Re)|0,y=y+Math.imul(X,It)|0,y=y+Math.imul(re,Re)|0,T=T+Math.imul(re,It)|0,A=A+Math.imul($,Me)|0,y=y+Math.imul($,xt)|0,y=y+Math.imul(ee,Me)|0,T=T+Math.imul(ee,xt)|0;var Hi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,A=Math.imul(Se,Ce),y=Math.imul(Se,mt),y=y+Math.imul(ct,Ce)|0,T=Math.imul(ct,mt),A=A+Math.imul(Fe,xe)|0,y=y+Math.imul(Fe,vt)|0,y=y+Math.imul(Ft,xe)|0,T=T+Math.imul(Ft,vt)|0,A=A+Math.imul(Le,Ne)|0,y=y+Math.imul(Le,wt)|0,y=y+Math.imul(Bt,Ne)|0,T=T+Math.imul(Bt,wt)|0,A=A+Math.imul(Be,Oe)|0,y=y+Math.imul(Be,Et)|0,y=y+Math.imul(Mt,Oe)|0,T=T+Math.imul(Mt,Et)|0,A=A+Math.imul(De,Pe)|0,y=y+Math.imul(De,_t)|0,y=y+Math.imul(Pt,Pe)|0,T=T+Math.imul(Pt,_t)|0,A=A+Math.imul(Z,Re)|0,y=y+Math.imul(Z,It)|0,y=y+Math.imul(oe,Re)|0,T=T+Math.imul(oe,It)|0,A=A+Math.imul(X,Me)|0,y=y+Math.imul(X,xt)|0,y=y+Math.imul(re,Me)|0,T=T+Math.imul(re,xt)|0;var Gi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,A=Math.imul(Se,xe),y=Math.imul(Se,vt),y=y+Math.imul(ct,xe)|0,T=Math.imul(ct,vt),A=A+Math.imul(Fe,Ne)|0,y=y+Math.imul(Fe,wt)|0,y=y+Math.imul(Ft,Ne)|0,T=T+Math.imul(Ft,wt)|0,A=A+Math.imul(Le,Oe)|0,y=y+Math.imul(Le,Et)|0,y=y+Math.imul(Bt,Oe)|0,T=T+Math.imul(Bt,Et)|0,A=A+Math.imul(Be,Pe)|0,y=y+Math.imul(Be,_t)|0,y=y+Math.imul(Mt,Pe)|0,T=T+Math.imul(Mt,_t)|0,A=A+Math.imul(De,Re)|0,y=y+Math.imul(De,It)|0,y=y+Math.imul(Pt,Re)|0,T=T+Math.imul(Pt,It)|0,A=A+Math.imul(Z,Me)|0,y=y+Math.imul(Z,xt)|0,y=y+Math.imul(oe,Me)|0,T=T+Math.imul(oe,xt)|0;var zi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(zi>>>26)|0,zi&=67108863,A=Math.imul(Se,Ne),y=Math.imul(Se,wt),y=y+Math.imul(ct,Ne)|0,T=Math.imul(ct,wt),A=A+Math.imul(Fe,Oe)|0,y=y+Math.imul(Fe,Et)|0,y=y+Math.imul(Ft,Oe)|0,T=T+Math.imul(Ft,Et)|0,A=A+Math.imul(Le,Pe)|0,y=y+Math.imul(Le,_t)|0,y=y+Math.imul(Bt,Pe)|0,T=T+Math.imul(Bt,_t)|0,A=A+Math.imul(Be,Re)|0,y=y+Math.imul(Be,It)|0,y=y+Math.imul(Mt,Re)|0,T=T+Math.imul(Mt,It)|0,A=A+Math.imul(De,Me)|0,y=y+Math.imul(De,xt)|0,y=y+Math.imul(Pt,Me)|0,T=T+Math.imul(Pt,xt)|0;var ji=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(ji>>>26)|0,ji&=67108863,A=Math.imul(Se,Oe),y=Math.imul(Se,Et),y=y+Math.imul(ct,Oe)|0,T=Math.imul(ct,Et),A=A+Math.imul(Fe,Pe)|0,y=y+Math.imul(Fe,_t)|0,y=y+Math.imul(Ft,Pe)|0,T=T+Math.imul(Ft,_t)|0,A=A+Math.imul(Le,Re)|0,y=y+Math.imul(Le,It)|0,y=y+Math.imul(Bt,Re)|0,T=T+Math.imul(Bt,It)|0,A=A+Math.imul(Be,Me)|0,y=y+Math.imul(Be,xt)|0,y=y+Math.imul(Mt,Me)|0,T=T+Math.imul(Mt,xt)|0;var Qi=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,A=Math.imul(Se,Pe),y=Math.imul(Se,_t),y=y+Math.imul(ct,Pe)|0,T=Math.imul(ct,_t),A=A+Math.imul(Fe,Re)|0,y=y+Math.imul(Fe,It)|0,y=y+Math.imul(Ft,Re)|0,T=T+Math.imul(Ft,It)|0,A=A+Math.imul(Le,Me)|0,y=y+Math.imul(Le,xt)|0,y=y+Math.imul(Bt,Me)|0,T=T+Math.imul(Bt,xt)|0;var Ki=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,A=Math.imul(Se,Re),y=Math.imul(Se,It),y=y+Math.imul(ct,Re)|0,T=Math.imul(ct,It),A=A+Math.imul(Fe,Me)|0,y=y+Math.imul(Fe,xt)|0,y=y+Math.imul(Ft,Me)|0,T=T+Math.imul(Ft,xt)|0;var mc=(_+A|0)+((y&8191)<<13)|0;_=(T+(y>>>13)|0)+(mc>>>26)|0,mc&=67108863,A=Math.imul(Se,Me),y=Math.imul(Se,xt),y=y+Math.imul(ct,Me)|0,T=Math.imul(ct,xt);var yc=(_+A|0)+((y&8191)<<13)|0;return _=(T+(y>>>13)|0)+(yc>>>26)|0,yc&=67108863,w[0]=rt,w[1]=nt,w[2]=nn,w[3]=sn,w[4]=on,w[5]=an,w[6]=cn,w[7]=un,w[8]=Ui,w[9]=ki,w[10]=Vi,w[11]=Hi,w[12]=Gi,w[13]=zi,w[14]=ji,w[15]=Qi,w[16]=Ki,w[17]=mc,w[18]=yc,_!==0&&(w[19]=_,l.length++),l};Math.imul||(N=I);function R(x,g,v){v.negative=g.negative^x.negative,v.length=x.length+g.length;for(var l=0,d=0,m=0;m>>26)|0,d+=w>>>26,w&=67108863}v.words[m]=_,l=w,w=d}return l!==0?v.words[m]=l:v.length--,v.strip()}function D(x,g,v){var l=new U;return l.mulp(x,g,v)}i.prototype.mulTo=function(g,v){var l,d=this.length+g.length;return this.length===10&&g.length===10?l=N(this,g,v):d<63?l=I(this,g,v):d<1024?l=R(this,g,v):l=D(this,g,v),l};function U(x,g){this.x=x,this.y=g}U.prototype.makeRBT=function(g){for(var v=new Array(g),l=i.prototype._countBits(g)-1,d=0;d>=1;return d},U.prototype.permute=function(g,v,l,d,m,w){for(var _=0;_>>1)m++;return 1<>>13,l[2*w+1]=m&8191,m=m>>>13;for(w=2*v;w>=26,v+=d/67108864|0,v+=m>>>26,this.words[l]=m&67108863}return v!==0&&(this.words[l]=v,this.length++),this},i.prototype.muln=function(g){return this.clone().imuln(g)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(g){var v=S(g);if(v.length===0)return new i(1);for(var l=this,d=0;d=0);var v=g%26,l=(g-v)/26,d=67108863>>>26-v<<26-v,m;if(v!==0){var w=0;for(m=0;m>>26-v}w&&(this.words[m]=w,this.length++)}if(l!==0){for(m=this.length-1;m>=0;m--)this.words[m+l]=this.words[m];for(m=0;m=0);var d;v?d=(v-v%26)/26:d=0;var m=g%26,w=Math.min((g-m)/26,this.length),_=67108863^67108863>>>m<w)for(this.length-=w,y=0;y=0&&(T!==0||y>=d);y--){var E=this.words[y]|0;this.words[y]=T<<26-m|E>>>m,T=E&_}return A&&T!==0&&(A.words[A.length++]=T),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(g,v,l){return r(this.negative===0),this.iushrn(g,v,l)},i.prototype.shln=function(g){return this.clone().ishln(g)},i.prototype.ushln=function(g){return this.clone().iushln(g)},i.prototype.shrn=function(g){return this.clone().ishrn(g)},i.prototype.ushrn=function(g){return this.clone().iushrn(g)},i.prototype.testn=function(g){r(typeof g=="number"&&g>=0);var v=g%26,l=(g-v)/26,d=1<=0);var v=g%26,l=(g-v)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(v!==0&&l++,this.length=Math.min(l,this.length),v!==0){var d=67108863^67108863>>>v<=67108864;v++)this.words[v]-=67108864,v===this.length-1?this.words[v+1]=1:this.words[v+1]++;return this.length=Math.max(this.length,v+1),this},i.prototype.isubn=function(g){if(r(typeof g=="number"),r(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var v=0;v>26)-(A/67108864|0),this.words[m+l]=w&67108863}for(;m>26,this.words[m+l]=w&67108863;if(_===0)return this.strip();for(r(_===-1),_=0,m=0;m>26,this.words[m]=w&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(g,v){var l=this.length-g.length,d=this.clone(),m=g,w=m.words[m.length-1]|0,_=this._countBits(w);l=26-_,l!==0&&(m=m.ushln(l),d.iushln(l),w=m.words[m.length-1]|0);var A=d.length-m.length,y;if(v!=="mod"){y=new i(null),y.length=A+1,y.words=new Array(y.length);for(var T=0;T=0;M--){var W=(d.words[m.length+M]|0)*67108864+(d.words[m.length+M-1]|0);for(W=Math.min(W/w|0,67108863),d._ishlnsubmul(m,W,M);d.negative!==0;)W--,d.negative=0,d._ishlnsubmul(m,1,M),d.isZero()||(d.negative^=1);y&&(y.words[M]=W)}return y&&y.strip(),d.strip(),v!=="div"&&l!==0&&d.iushrn(l),{div:y||null,mod:d}},i.prototype.divmod=function(g,v,l){if(r(!g.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var d,m,w;return this.negative!==0&&g.negative===0?(w=this.neg().divmod(g,v),v!=="mod"&&(d=w.div.neg()),v!=="div"&&(m=w.mod.neg(),l&&m.negative!==0&&m.iadd(g)),{div:d,mod:m}):this.negative===0&&g.negative!==0?(w=this.divmod(g.neg(),v),v!=="mod"&&(d=w.div.neg()),{div:d,mod:w.mod}):this.negative&g.negative?(w=this.neg().divmod(g.neg(),v),v!=="div"&&(m=w.mod.neg(),l&&m.negative!==0&&m.isub(g)),{div:w.div,mod:m}):g.length>this.length||this.cmp(g)<0?{div:new i(0),mod:this}:g.length===1?v==="div"?{div:this.divn(g.words[0]),mod:null}:v==="mod"?{div:null,mod:new i(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new i(this.modn(g.words[0]))}:this._wordDiv(g,v)},i.prototype.div=function(g){return this.divmod(g,"div",!1).div},i.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},i.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},i.prototype.divRound=function(g){var v=this.divmod(g);if(v.mod.isZero())return v.div;var l=v.div.negative!==0?v.mod.isub(g):v.mod,d=g.ushrn(1),m=g.andln(1),w=l.cmp(d);return w<0||m===1&&w===0?v.div:v.div.negative!==0?v.div.isubn(1):v.div.iaddn(1)},i.prototype.modn=function(g){r(g<=67108863);for(var v=(1<<26)%g,l=0,d=this.length-1;d>=0;d--)l=(v*l+(this.words[d]|0))%g;return l},i.prototype.idivn=function(g){r(g<=67108863);for(var v=0,l=this.length-1;l>=0;l--){var d=(this.words[l]|0)+v*67108864;this.words[l]=d/g|0,v=d%g}return this.strip()},i.prototype.divn=function(g){return this.clone().idivn(g)},i.prototype.egcd=function(g){r(g.negative===0),r(!g.isZero());var v=this,l=g.clone();v.negative!==0?v=v.umod(g):v=v.clone();for(var d=new i(1),m=new i(0),w=new i(0),_=new i(1),A=0;v.isEven()&&l.isEven();)v.iushrn(1),l.iushrn(1),++A;for(var y=l.clone(),T=v.clone();!v.isZero();){for(var E=0,M=1;!(v.words[0]&M)&&E<26;++E,M<<=1);if(E>0)for(v.iushrn(E);E-- >0;)(d.isOdd()||m.isOdd())&&(d.iadd(y),m.isub(T)),d.iushrn(1),m.iushrn(1);for(var W=0,Y=1;!(l.words[0]&Y)&&W<26;++W,Y<<=1);if(W>0)for(l.iushrn(W);W-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(y),_.isub(T)),w.iushrn(1),_.iushrn(1);v.cmp(l)>=0?(v.isub(l),d.isub(w),m.isub(_)):(l.isub(v),w.isub(d),_.isub(m))}return{a:w,b:_,gcd:l.iushln(A)}},i.prototype._invmp=function(g){r(g.negative===0),r(!g.isZero());var v=this,l=g.clone();v.negative!==0?v=v.umod(g):v=v.clone();for(var d=new i(1),m=new i(0),w=l.clone();v.cmpn(1)>0&&l.cmpn(1)>0;){for(var _=0,A=1;!(v.words[0]&A)&&_<26;++_,A<<=1);if(_>0)for(v.iushrn(_);_-- >0;)d.isOdd()&&d.iadd(w),d.iushrn(1);for(var y=0,T=1;!(l.words[0]&T)&&y<26;++y,T<<=1);if(y>0)for(l.iushrn(y);y-- >0;)m.isOdd()&&m.iadd(w),m.iushrn(1);v.cmp(l)>=0?(v.isub(l),d.isub(m)):(l.isub(v),m.isub(d))}var E;return v.cmpn(1)===0?E=d:E=m,E.cmpn(0)<0&&E.iadd(g),E},i.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var v=this.clone(),l=g.clone();v.negative=0,l.negative=0;for(var d=0;v.isEven()&&l.isEven();d++)v.iushrn(1),l.iushrn(1);do{for(;v.isEven();)v.iushrn(1);for(;l.isEven();)l.iushrn(1);var m=v.cmp(l);if(m<0){var w=v;v=l,l=w}else if(m===0||l.cmpn(1)===0)break;v.isub(l)}while(!0);return l.iushln(d)},i.prototype.invm=function(g){return this.egcd(g).a.umod(g)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(g){return this.words[0]&g},i.prototype.bincn=function(g){r(typeof g=="number");var v=g%26,l=(g-v)/26,d=1<>>26,_&=67108863,this.words[w]=_}return m!==0&&(this.words[w]=m,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(g){var v=g<0;if(this.negative!==0&&!v)return-1;if(this.negative===0&&v)return 1;this.strip();var l;if(this.length>1)l=1;else{v&&(g=-g),r(g<=67108863,"Number is too big");var d=this.words[0]|0;l=d===g?0:dg.length)return 1;if(this.length=0;l--){var d=this.words[l]|0,m=g.words[l]|0;if(d!==m){dm&&(v=1);break}}return v},i.prototype.gtn=function(g){return this.cmpn(g)===1},i.prototype.gt=function(g){return this.cmp(g)===1},i.prototype.gten=function(g){return this.cmpn(g)>=0},i.prototype.gte=function(g){return this.cmp(g)>=0},i.prototype.ltn=function(g){return this.cmpn(g)===-1},i.prototype.lt=function(g){return this.cmp(g)===-1},i.prototype.lten=function(g){return this.cmpn(g)<=0},i.prototype.lte=function(g){return this.cmp(g)<=0},i.prototype.eqn=function(g){return this.cmpn(g)===0},i.prototype.eq=function(g){return this.cmp(g)===0},i.red=function(g){return new C(g)},i.prototype.toRed=function(g){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(g){return this.red=g,this},i.prototype.forceRed=function(g){return r(!this.red,"Already a number in reduction context"),this._forceRed(g)},i.prototype.redAdd=function(g){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},i.prototype.redIAdd=function(g){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},i.prototype.redSub=function(g){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},i.prototype.redISub=function(g){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},i.prototype.redShl=function(g){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},i.prototype.redMul=function(g){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},i.prototype.redIMul=function(g){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(g){return r(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var k={k256:null,p224:null,p192:null,p25519:null};function z(x,g){this.name=x,this.p=new i(g,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var g=new i(null);return g.words=new Array(Math.ceil(this.n/13)),g},z.prototype.ireduce=function(g){var v=g,l;do this.split(v,this.tmp),v=this.imulK(v),v=v.iadd(this.tmp),l=v.bitLength();while(l>this.n);var d=l0?v.isub(this.p):v.strip!==void 0?v.strip():v._strip(),v},z.prototype.split=function(g,v){g.iushrn(this.n,0,v)},z.prototype.imulK=function(g){return g.imul(this.k)};function H(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(H,z),H.prototype.split=function(g,v){for(var l=4194303,d=Math.min(g.length,9),m=0;m>>22,w=_}w>>>=22,g.words[m-10]=w,w===0&&g.length>10?g.length-=10:g.length-=9},H.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var v=0,l=0;l>>=26,g.words[l]=m,v=d}return v!==0&&(g.words[g.length++]=v),g},i._prime=function(g){if(k[g])return k[g];var v;if(g==="k256")v=new H;else if(g==="p224")v=new F;else if(g==="p192")v=new V;else if(g==="p25519")v=new q;else throw new Error("Unknown prime "+g);return k[g]=v,v};function C(x){if(typeof x=="string"){var g=i._prime(x);this.m=g.p,this.prime=g}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}C.prototype._verify1=function(g){r(g.negative===0,"red works only with positives"),r(g.red,"red works only with red numbers")},C.prototype._verify2=function(g,v){r((g.negative|v.negative)===0,"red works only with positives"),r(g.red&&g.red===v.red,"red works only with red numbers")},C.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},C.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},C.prototype.add=function(g,v){this._verify2(g,v);var l=g.add(v);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},C.prototype.iadd=function(g,v){this._verify2(g,v);var l=g.iadd(v);return l.cmp(this.m)>=0&&l.isub(this.m),l},C.prototype.sub=function(g,v){this._verify2(g,v);var l=g.sub(v);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},C.prototype.isub=function(g,v){this._verify2(g,v);var l=g.isub(v);return l.cmpn(0)<0&&l.iadd(this.m),l},C.prototype.shl=function(g,v){return this._verify1(g),this.imod(g.ushln(v))},C.prototype.imul=function(g,v){return this._verify2(g,v),this.imod(g.imul(v))},C.prototype.mul=function(g,v){return this._verify2(g,v),this.imod(g.mul(v))},C.prototype.isqr=function(g){return this.imul(g,g.clone())},C.prototype.sqr=function(g){return this.mul(g,g)},C.prototype.sqrt=function(g){if(g.isZero())return g.clone();var v=this.m.andln(3);if(r(v%2===1),v===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(g,l)}for(var d=this.m.subn(1),m=0;!d.isZero()&&d.andln(1)===0;)m++,d.iushrn(1);r(!d.isZero());var w=new i(1).toRed(this),_=w.redNeg(),A=this.m.subn(1).iushrn(1),y=this.m.bitLength();for(y=new i(2*y*y).toRed(this);this.pow(y,A).cmp(_)!==0;)y.redIAdd(_);for(var T=this.pow(y,d),E=this.pow(g,d.addn(1).iushrn(1)),M=this.pow(g,d),W=m;M.cmp(w)!==0;){for(var Y=M,P=0;Y.cmp(w)!==0;P++)Y=Y.redSqr();r(P=0;m--){for(var T=v.words[m],E=y-1;E>=0;E--){var M=T>>E&1;if(w!==d[0]&&(w=this.sqr(w)),M===0&&_===0){A=0;continue}_<<=1,_|=M,A++,!(A!==l&&(m!==0||E!==0))&&(w=this.mul(w,d[_]),A=0,_=0)}y=26}return w},C.prototype.convertTo=function(g){var v=g.umod(this.m);return v===g?v.clone():v},C.prototype.convertFrom=function(g){var v=g.clone();return v.red=null,v},i.mont=function(g){return new B(g)};function B(x){C.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}n(B,C),B.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},B.prototype.convertFrom=function(g){var v=this.imod(g.mul(this.rinv));return v.red=null,v},B.prototype.imul=function(g,v){if(g.isZero()||v.isZero())return g.words[0]=0,g.length=1,g;var l=g.imul(v),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(d).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},B.prototype.mul=function(g,v){if(g.isZero()||v.isZero())return new i(0)._forceRed(this);var l=g.mul(v),d=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=l.isub(d).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},B.prototype.invm=function(g){var v=this.imod(g._invmp(this.m).mul(this.r2));return v._forceRed(this)}})(typeof cI>"u"||cI,ZL)});var Fa=L((INe,tF)=>{h();tF.exports=eF;function eF(t,e){if(!t)throw new Error(e||"Assertion failed")}eF.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)}});var uI=L(iF=>{"use strict";h();var Pv=iF;function $ue(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t!="string"){for(var n=0;n>8,o=i&255;s?r.push(s,o):r.push(o)}return r}Pv.toArray=$ue;function rF(t){return t.length===1?"0"+t:t}Pv.zero2=rF;function nF(t){for(var e="",r=0;r{"use strict";h();var ss=sF,Yue=Qs(),Jue=Fa(),Rv=uI();ss.assert=Jue;ss.toArray=Rv.toArray;ss.zero2=Rv.zero2;ss.toHex=Rv.toHex;ss.encode=Rv.encode;function Xue(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1),i;for(i=0;i(s>>1)-1?c=(s>>1)-a:c=a,o.isubn(c)):c=0,n[i]=c,o.iushrn(1)}return n}ss.getNAF=Xue;function Zue(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0,s;t.cmpn(-n)>0||e.cmpn(-i)>0;){var o=t.andln(3)+n&3,c=e.andln(3)+i&3;o===3&&(o=-1),c===3&&(c=-1);var a;o&1?(s=t.andln(7)+n&7,(s===3||s===5)&&c===2?a=-o:a=o):a=0,r[0].push(a);var u;c&1?(s=e.andln(7)+i&7,(s===3||s===5)&&o===2?u=-c:u=c):u=0,r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}ss.getJSF=Zue;function ele(t,e,r){var n="_"+e;t.prototype[e]=function(){return this[n]!==void 0?this[n]:this[n]=r.call(this)}}ss.cachedProperty=ele;function tle(t){return typeof t=="string"?ss.toArray(t,"hex"):t}ss.parseBytes=tle;function rle(t){return new Yue(t,"hex","le")}ss.intFromLE=rle});var hI=L((RNe,dI)=>{h();var lI;dI.exports=function(e){return lI||(lI=new qa(null)),lI.generate(e)};function qa(t){this.rand=t}dI.exports.Rand=qa;qa.prototype.generate=function(e){return this._rand(e)};qa.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n{"use strict";h();var iu=Qs(),R0=Xn(),Mv=R0.getNAF,nle=R0.getJSF,Dv=R0.assert;function Ua(t,e){this.type=t,this.p=new iu(e.p,16),this.red=e.prime?iu.red(e.prime):iu.mont(this.p),this.zero=new iu(0).toRed(this.red),this.one=new iu(1).toRed(this.red),this.two=new iu(2).toRed(this.red),this.n=e.n&&new iu(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}oF.exports=Ua;Ua.prototype.point=function(){throw new Error("Not implemented")};Ua.prototype.validate=function(){throw new Error("Not implemented")};Ua.prototype._fixedNafMul=function(e,r){Dv(e.precomputed);var n=e._getDoubles(),i=Mv(r,1,this._bitLength),s=(1<=c;u--)a=(a<<1)+i[u];o.push(a)}for(var f=this.jpoint(null,null,null),p=this.jpoint(null,null,null),S=s;S>0;S--){for(c=0;c=0;a--){for(var u=0;a>=0&&o[a]===0;a--)u++;if(a>=0&&u++,c=c.dblp(u),a<0)break;var f=o[a];Dv(f!==0),e.type==="affine"?f>0?c=c.mixedAdd(s[f-1>>1]):c=c.mixedAdd(s[-f-1>>1].neg()):f>0?c=c.add(s[f-1>>1]):c=c.add(s[-f-1>>1].neg())}return e.type==="affine"?c.toP():c};Ua.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,c=this._wnafT2,a=this._wnafT3,u=0,f,p,S;for(f=0;f=1;f-=2){var N=f-1,R=f;if(o[N]!==1||o[R]!==1){a[N]=Mv(n[N],o[N],this._bitLength),a[R]=Mv(n[R],o[R],this._bitLength),u=Math.max(a[N].length,u),u=Math.max(a[R].length,u);continue}var D=[r[N],null,null,r[R]];r[N].y.cmp(r[R].y)===0?(D[1]=r[N].add(r[R]),D[2]=r[N].toJ().mixedAdd(r[R].neg())):r[N].y.cmp(r[R].y.redNeg())===0?(D[1]=r[N].toJ().mixedAdd(r[R]),D[2]=r[N].add(r[R].neg())):(D[1]=r[N].toJ().mixedAdd(r[R]),D[2]=r[N].toJ().mixedAdd(r[R].neg()));var U=[-3,-1,-5,-7,0,7,5,1,3],k=nle(n[N],n[R]);for(u=Math.max(k[0].length,u),a[N]=new Array(u),a[R]=new Array(u),p=0;p=0;f--){for(var q=0;f>=0;){var C=!0;for(p=0;p=0&&q++,F=F.dblp(q),f<0)break;for(p=0;p0?S=c[p][B-1>>1]:B<0&&(S=c[p][-B-1>>1].neg()),S.type==="affine"?F=F.mixedAdd(S):F=F.add(S))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};xi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s{"use strict";h();var ile=Xn(),yr=Qs(),pI=Ss(),qf=M0(),sle=ile.assert;function Ni(t){qf.call(this,"short",t),this.a=new yr(t.a,16).toRed(this.red),this.b=new yr(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}pI(Ni,qf);aF.exports=Ni;Ni.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(e.beta)r=new yr(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(e.lambda)n=new yr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?n=s[0]:(n=s[1],sle(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(c){return{a:new yr(c.a,16),b:new yr(c.b,16)}}):o=this._getEndoBasis(n),{beta:r,lambda:n,basis:o}}};Ni.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:yr.mont(e),n=new yr(2).toRed(r).redInvm(),i=n.redNeg(),s=new yr(3).toRed(r).redNeg().redSqrt().redMul(n),o=i.redAdd(s).fromRed(),c=i.redSub(s).fromRed();return[o,c]};Ni.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),s=new yr(1),o=new yr(0),c=new yr(0),a=new yr(1),u,f,p,S,I,N,R,D=0,U,k;n.cmpn(0)!==0;){var z=i.div(n);U=i.sub(z.mul(n)),k=c.sub(z.mul(s));var H=a.sub(z.mul(o));if(!p&&U.cmp(r)<0)u=R.neg(),f=s,p=U.neg(),S=k;else if(p&&++D===2)break;R=U,i=n,n=U,c=s,s=k,a=o,o=H}I=U.neg(),N=k;var F=p.sqr().add(S.sqr()),V=I.sqr().add(N.sqr());return V.cmp(F)>=0&&(I=u,N=f),p.negative&&(p=p.neg(),S=S.neg()),I.negative&&(I=I.neg(),N=N.neg()),[{a:p,b:S},{a:I,b:N}]};Ni.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),c=s.mul(n.a),a=o.mul(i.a),u=s.mul(n.b),f=o.mul(i.b),p=e.sub(c).sub(a),S=u.add(f).neg();return{k1:p,k2:S}};Ni.prototype.pointFromX=function(e,r){e=new yr(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};Ni.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};Ni.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Hr.prototype.isInfinity=function(){return this.inf};Hr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Hr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),c=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,c)};Hr.prototype.getX=function(){return this.x.fromRed()};Hr.prototype.getY=function(){return this.y.fromRed()};Hr.prototype.mul=function(e){return e=new yr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Hr.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Hr.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Hr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Hr.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Hr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Yr(t,e,r,n){qf.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new yr(0)):(this.x=new yr(e,16),this.y=new yr(r,16),this.z=new yr(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}pI(Yr,qf.BasePoint);Ni.prototype.jpoint=function(e,r,n){return new Yr(this,e,r,n)};Yr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Yr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Yr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),c=e.y.redMul(n.redMul(this.z)),a=i.redSub(s),u=o.redSub(c);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),p=f.redMul(a),S=i.redMul(f),I=u.redSqr().redIAdd(p).redISub(S).redISub(S),N=u.redMul(S.redISub(I)).redISub(o.redMul(p)),R=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(I,N,R)};Yr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),c=n.redSub(i),a=s.redSub(o);if(c.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=c.redSqr(),f=u.redMul(c),p=n.redMul(u),S=a.redSqr().redIAdd(f).redISub(p).redISub(p),I=a.redMul(p.redISub(S)).redISub(s.redMul(f)),N=this.z.redMul(c);return this.curve.jpoint(S,I,N)};Yr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};Yr.prototype.inspect=function(){return this.isInfinity()?"":""};Yr.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var fF=L((qNe,lF)=>{"use strict";h();var Uf=Qs(),uF=Ss(),Bv=M0(),ole=Xn();function kf(t){Bv.call(this,"mont",t),this.a=new Uf(t.a,16).toRed(this.red),this.b=new Uf(t.b,16).toRed(this.red),this.i4=new Uf(4).toRed(this.red).redInvm(),this.two=new Uf(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}uF(kf,Bv);lF.exports=kf;kf.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function Gr(t,e,r){Bv.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Uf(e,16),this.z=new Uf(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}uF(Gr,Bv.BasePoint);kf.prototype.decodePoint=function(e,r){return this.point(ole.toArray(e,r),1)};kf.prototype.point=function(e,r){return new Gr(this,e,r)};kf.prototype.pointFromJSON=function(e){return Gr.fromJSON(this,e)};Gr.prototype.precompute=function(){};Gr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Gr.fromJSON=function(e,r){return new Gr(e,r[0],r[1]||e.one)};Gr.prototype.inspect=function(){return this.isInfinity()?"":""};Gr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Gr.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),c=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,c)};Gr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Gr.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),c=o.redMul(n),a=s.redMul(i),u=r.z.redMul(c.redAdd(a).redSqr()),f=r.x.redMul(c.redISub(a).redSqr());return this.curve.point(u,f)};Gr.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var c=o.length-1;c>=0;c--)o[c]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};Gr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Gr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Gr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Gr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Gr.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var pF=L((kNe,hF)=>{"use strict";h();var ale=Xn(),ko=Qs(),dF=Ss(),Lv=M0(),cle=ale.assert;function Ks(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Lv.call(this,"edwards",t),this.a=new ko(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ko(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ko(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),cle(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}dF(Ks,Lv);hF.exports=Ks;Ks.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Ks.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Ks.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};Ks.prototype.pointFromX=function(e,r){e=new ko(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),c=o.redSqrt();if(c.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var a=c.fromRed().isOdd();return(r&&!a||!r&&a)&&(c=c.redNeg()),this.point(e,c)};Ks.prototype.pointFromY=function(e,r){e=new ko(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var c=o.redSqrt();if(c.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return c.fromRed().isOdd()!==r&&(c=c.redNeg()),this.point(c,e)};Ks.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function nr(t,e,r,n,i){Lv.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ko(e,16),this.y=new ko(r,16),this.z=n?new ko(n,16):this.curve.one,this.t=i&&new ko(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}dF(nr,Lv.BasePoint);Ks.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)};Ks.prototype.point=function(e,r,n,i){return new nr(this,e,r,n,i)};nr.fromJSON=function(e,r){return new nr(e,r[0],r[1],r[2])};nr.prototype.inspect=function(){return this.isInfinity()?"":""};nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};nr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),c=o.redSub(n),a=i.redSub(r),u=s.redMul(c),f=o.redMul(a),p=s.redMul(a),S=c.redMul(o);return this.curve.point(u,f,S,p)};nr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,c,a,u;if(this.curve.twisted){c=this.curve._mulA(r);var f=c.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(f.redSub(this.curve.two)),s=f.redMul(c.redSub(n)),o=f.redSqr().redSub(f).redSub(f)):(a=this.z.redSqr(),u=f.redSub(a).redISub(a),i=e.redSub(r).redISub(n).redMul(u),s=f.redMul(c.redSub(n)),o=f.redMul(u))}else c=r.redAdd(n),a=this.curve._mulC(this.z).redSqr(),u=c.redSub(a).redSub(a),i=this.curve._mulC(e.redISub(c)).redMul(u),s=this.curve._mulC(c).redMul(r.redISub(n)),o=c.redMul(u);return this.curve.point(i,s,o)};nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};nr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),c=s.redSub(i),a=s.redAdd(i),u=n.redAdd(r),f=o.redMul(c),p=a.redMul(u),S=o.redMul(u),I=c.redMul(a);return this.curve.point(f,p,I,S)};nr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),c=n.redSub(o),a=n.redAdd(o),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),f=r.redMul(c).redMul(u),p,S;return this.curve.twisted?(p=r.redMul(a).redMul(s.redSub(this.curve._mulA(i))),S=c.redMul(a)):(p=r.redMul(a).redMul(s.redSub(i)),S=this.curve._mulC(c).redMul(a)),this.curve.point(f,p,S)};nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};nr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};nr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()};nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};nr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};nr.prototype.toP=nr.prototype.normalize;nr.prototype.mixedAdd=nr.prototype.add});var gI=L(gF=>{"use strict";h();var Fv=gF;Fv.base=M0();Fv.short=cF();Fv.mont=fF();Fv.edwards=pF()});var os=L(Xt=>{"use strict";h();var ule=Fa(),lle=Ss();Xt.inherits=lle;function fle(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function dle(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):fle(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Xt.htonl=mF;function ple(t,e){for(var r="",n=0;n>>0}return s}Xt.join32=gle;function mle(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Xt.split32=mle;function yle(t,e){return t>>>e|t<<32-e}Xt.rotr32=yle;function vle(t,e){return t<>>32-e}Xt.rotl32=vle;function ble(t,e){return t+e>>>0}Xt.sum32=ble;function wle(t,e,r){return t+e+r>>>0}Xt.sum32_3=wle;function Ale(t,e,r,n){return t+e+r+n>>>0}Xt.sum32_4=Ale;function Ele(t,e,r,n,i){return t+e+r+n+i>>>0}Xt.sum32_5=Ele;function Sle(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,c=(o>>0,t[e+1]=o}Xt.sum64=Sle;function _le(t,e,r,n){var i=e+n>>>0,s=(i>>0}Xt.sum64_hi=_le;function Tle(t,e,r,n){var i=e+n;return i>>>0}Xt.sum64_lo=Tle;function Ile(t,e,r,n,i,s,o,c){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}Xt.sum64_4_hi=Ile;function Cle(t,e,r,n,i,s,o,c){var a=e+n+s+c;return a>>>0}Xt.sum64_4_lo=Cle;function xle(t,e,r,n,i,s,o,c,a,u){var f=0,p=e;p=p+n>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0}Xt.sum64_5_hi=xle;function Nle(t,e,r,n,i,s,o,c,a,u){var f=e+n+s+c+u;return f>>>0}Xt.sum64_5_lo=Nle;function Ole(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Xt.rotr64_hi=Ole;function Ple(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Xt.rotr64_lo=Ple;function Rle(t,e,r){return t>>>r}Xt.shr64_hi=Rle;function Mle(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Xt.shr64_lo=Mle});var Vf=L(wF=>{"use strict";h();var bF=os(),Dle=Fa();function qv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}wF.BlockHash=qv;qv.prototype.update=function(e,r){if(e=bF.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=bF.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o{"use strict";h();var Ble=os(),Ws=Ble.rotr32;function Lle(t,e,r,n){if(t===0)return AF(e,r,n);if(t===1||t===3)return SF(e,r,n);if(t===2)return EF(e,r,n)}Vo.ft_1=Lle;function AF(t,e,r){return t&e^~t&r}Vo.ch32=AF;function EF(t,e,r){return t&e^t&r^e&r}Vo.maj32=EF;function SF(t,e,r){return t^e^r}Vo.p32=SF;function Fle(t){return Ws(t,2)^Ws(t,13)^Ws(t,22)}Vo.s0_256=Fle;function qle(t){return Ws(t,6)^Ws(t,11)^Ws(t,25)}Vo.s1_256=qle;function Ule(t){return Ws(t,7)^Ws(t,18)^t>>>3}Vo.g0_256=Ule;function kle(t){return Ws(t,17)^Ws(t,19)^t>>>10}Vo.g1_256=kle});var IF=L((YNe,TF)=>{"use strict";h();var Hf=os(),Vle=Vf(),Hle=mI(),yI=Hf.rotl32,D0=Hf.sum32,Gle=Hf.sum32_5,zle=Hle.ft_1,_F=Vle.BlockHash,jle=[1518500249,1859775393,2400959708,3395469782];function $s(){if(!(this instanceof $s))return new $s;_F.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Hf.inherits($s,_F);TF.exports=$s;$s.blockSize=512;$s.outSize=160;$s.hmacStrength=80;$s.padLength=64;$s.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i{"use strict";h();var Gf=os(),Qle=Vf(),zf=mI(),Kle=Fa(),as=Gf.sum32,Wle=Gf.sum32_4,$le=Gf.sum32_5,Yle=zf.ch32,Jle=zf.maj32,Xle=zf.s0_256,Zle=zf.s1_256,efe=zf.g0_256,tfe=zf.g1_256,CF=Qle.BlockHash,rfe=[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 Ys(){if(!(this instanceof Ys))return new Ys;CF.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=rfe,this.W=new Array(64)}Gf.inherits(Ys,CF);xF.exports=Ys;Ys.blockSize=512;Ys.outSize=256;Ys.hmacStrength=192;Ys.padLength=64;Ys.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i{"use strict";h();var bI=os(),NF=vI();function Ho(){if(!(this instanceof Ho))return new Ho;NF.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}bI.inherits(Ho,NF);OF.exports=Ho;Ho.blockSize=512;Ho.outSize=224;Ho.hmacStrength=192;Ho.padLength=64;Ho.prototype._digest=function(e){return e==="hex"?bI.toHex32(this.h.slice(0,7),"big"):bI.split32(this.h.slice(0,7),"big")}});var EI=L((rOe,BF)=>{"use strict";h();var kn=os(),nfe=Vf(),ife=Fa(),Js=kn.rotr64_hi,Xs=kn.rotr64_lo,RF=kn.shr64_hi,MF=kn.shr64_lo,ka=kn.sum64,wI=kn.sum64_hi,AI=kn.sum64_lo,sfe=kn.sum64_4_hi,ofe=kn.sum64_4_lo,afe=kn.sum64_5_hi,cfe=kn.sum64_5_lo,DF=nfe.BlockHash,ufe=[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 cs(){if(!(this instanceof cs))return new cs;DF.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=ufe,this.W=new Array(160)}kn.inherits(cs,DF);BF.exports=cs;cs.blockSize=1024;cs.outSize=512;cs.hmacStrength=192;cs.padLength=128;cs.prototype._prepareBlock=function(e,r){for(var n=this.W,i=0;i<32;i++)n[i]=e[r+i];for(;i{"use strict";h();var SI=os(),LF=EI();function Go(){if(!(this instanceof Go))return new Go;LF.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}SI.inherits(Go,LF);FF.exports=Go;Go.blockSize=1024;Go.outSize=384;Go.hmacStrength=192;Go.padLength=128;Go.prototype._digest=function(e){return e==="hex"?SI.toHex32(this.h.slice(0,12),"big"):SI.split32(this.h.slice(0,12),"big")}});var UF=L(jf=>{"use strict";h();jf.sha1=IF();jf.sha224=PF();jf.sha256=vI();jf.sha384=qF();jf.sha512=EI()});var jF=L(zF=>{"use strict";h();var su=os(),Efe=Vf(),Uv=su.rotl32,kF=su.sum32,B0=su.sum32_3,VF=su.sum32_4,GF=Efe.BlockHash;function Zs(){if(!(this instanceof Zs))return new Zs;GF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}su.inherits(Zs,GF);zF.ripemd160=Zs;Zs.blockSize=512;Zs.outSize=160;Zs.hmacStrength=192;Zs.padLength=64;Zs.prototype._update=function(e,r){for(var n=this.h[0],i=this.h[1],s=this.h[2],o=this.h[3],c=this.h[4],a=n,u=i,f=s,p=o,S=c,I=0;I<80;I++){var N=kF(Uv(VF(n,HF(I,i,s,o),e[Tfe[I]+r],Sfe(I)),Cfe[I]),c);n=c,c=o,o=Uv(s,10),s=i,i=N,N=kF(Uv(VF(a,HF(79-I,u,f,p),e[Ife[I]+r],_fe(I)),xfe[I]),S),a=S,S=p,p=Uv(f,10),f=u,u=N}N=B0(this.h[1],s,p),this.h[1]=B0(this.h[2],o,S),this.h[2]=B0(this.h[3],c,a),this.h[3]=B0(this.h[4],n,u),this.h[4]=B0(this.h[0],i,f),this.h[0]=N};Zs.prototype._digest=function(e){return e==="hex"?su.toHex32(this.h,"little"):su.split32(this.h,"little")};function HF(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function Sfe(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function _fe(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var Tfe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Ife=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Cfe=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],xfe=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var KF=L((lOe,QF)=>{"use strict";h();var Nfe=os(),Ofe=Fa();function Qf(t,e,r){if(!(this instanceof Qf))return new Qf(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Nfe.toArray(e,r))}QF.exports=Qf;Qf.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),Ofe(e.length<=this.blockSize);for(var r=e.length;r{h();var Jr=WF;Jr.utils=os();Jr.common=Vf();Jr.sha=UF();Jr.ripemd=jF();Jr.hmac=KF();Jr.sha1=Jr.sha.sha1;Jr.sha256=Jr.sha.sha256;Jr.sha224=Jr.sha.sha224;Jr.sha384=Jr.sha.sha384;Jr.sha512=Jr.sha.sha512;Jr.ripemd160=Jr.ripemd.ripemd160});var YF=L((pOe,$F)=>{h();$F.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var Vv=L(ZF=>{"use strict";h();var TI=ZF,Va=kv(),_I=gI(),Pfe=Xn(),JF=Pfe.assert;function XF(t){t.type==="short"?this.curve=new _I.short(t):t.type==="edwards"?this.curve=new _I.edwards(t):this.curve=new _I.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,JF(this.g.validate(),"Invalid curve"),JF(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}TI.PresetCurve=XF;function Ha(t,e){Object.defineProperty(TI,t,{configurable:!0,enumerable:!0,get:function(){var r=new XF(e);return Object.defineProperty(TI,t,{configurable:!0,enumerable:!0,value:r}),r}})}Ha("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Va.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});Ha("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Va.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});Ha("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Va.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});Ha("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Va.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});Ha("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Va.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});Ha("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Va.sha256,gRed:!1,g:["9"]});Ha("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Va.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var II;try{II=YF()}catch{II=void 0}Ha("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Va.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",II]})});var rq=L((vOe,tq)=>{"use strict";h();var Rfe=kv(),ou=uI(),eq=Fa();function Ga(t){if(!(this instanceof Ga))return new Ga(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ou.toArray(t.entropy,t.entropyEnc||"hex"),r=ou.toArray(t.nonce,t.nonceEnc||"hex"),n=ou.toArray(t.pers,t.persEnc||"hex");eq(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}tq.exports=Ga;Ga.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Ga.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=ou.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length{"use strict";h();var Mfe=Qs(),Dfe=Xn(),CI=Dfe.assert;function gn(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}nq.exports=gn;gn.fromPublic=function(e,r,n){return r instanceof gn?r:new gn(e,{pub:r,pubEnc:n})};gn.fromPrivate=function(e,r,n){return r instanceof gn?r:new gn(e,{priv:r,privEnc:n})};gn.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};gn.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};gn.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};gn.prototype._importPrivate=function(e,r){this.priv=new Mfe(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};gn.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?CI(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&CI(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};gn.prototype.derive=function(e){return e.validate()||CI(e.validate(),"public point not validated"),e.mul(this.priv).getX()};gn.prototype.sign=function(e,r,n){return this.ec.sign(e,this,r,n)};gn.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};gn.prototype.inspect=function(){return""}});var aq=L((EOe,oq)=>{"use strict";h();var Hv=Qs(),OI=Xn(),Bfe=OI.assert;function Gv(t,e){if(t instanceof Gv)return t;this._importDER(t,e)||(Bfe(t.r&&t.s,"Signature without r or s"),this.r=new Hv(t.r,16),this.s=new Hv(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}oq.exports=Gv;function Lfe(){this.place=0}function xI(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function sq(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Gv.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=sq(r),n=sq(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];NI(i,r.length),i=i.concat(r),i.push(2),NI(i,n.length);var s=i.concat(n),o=[48];return NI(o,s.length),o=o.concat(s),OI.encode(o,e)}});var fq=L((_Oe,lq)=>{"use strict";h();var au=Qs(),cq=rq(),Ffe=Xn(),PI=Vv(),qfe=hI(),uq=Ffe.assert,RI=iq(),zv=aq();function Oi(t){if(!(this instanceof Oi))return new Oi(t);typeof t=="string"&&(uq(Object.prototype.hasOwnProperty.call(PI,t),"Unknown curve "+t),t=PI[t]),t instanceof PI.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}lq.exports=Oi;Oi.prototype.keyPair=function(e){return new RI(this,e)};Oi.prototype.keyFromPrivate=function(e,r){return RI.fromPrivate(this,e,r)};Oi.prototype.keyFromPublic=function(e,r){return RI.fromPublic(this,e,r)};Oi.prototype.genKeyPair=function(e){e||(e={});for(var r=new cq({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qfe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new au(2));;){var s=new au(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};Oi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Oi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new au(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),c=e.toArray("be",s),a=new cq({hash:this.hash,entropy:o,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new au(1)),f=0;;f++){var p=i.k?i.k(f):new au(a.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(u)>=0)){var S=this.g.mul(p);if(!S.isInfinity()){var I=S.getX(),N=I.umod(this.n);if(N.cmpn(0)!==0){var R=p.invm(this.n).mul(N.mul(r.getPrivate()).iadd(e));if(R=R.umod(this.n),R.cmpn(0)!==0){var D=(S.getY().isOdd()?1:0)|(I.cmp(N)!==0?2:0);return i.canonical&&R.cmp(this.nh)>0&&(R=this.n.sub(R),D^=1),new zv({r:N,s:R,recoveryParam:D})}}}}}};Oi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new au(e,16)),n=this.keyFromPublic(n,i),r=new zv(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c=o.invm(this.n),a=c.mul(e).umod(this.n),u=c.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(a,n.getPublic(),u),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(a,n.getPublic(),u),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};Oi.prototype.recoverPubKey=function(t,e,r,n){uq((3&r)===r,"The recovery param is more than two bits"),e=new zv(e,n);var i=this.n,s=new au(t),o=e.r,c=e.s,a=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),a):o=this.curve.pointFromX(o,a);var f=e.r.invm(i),p=i.sub(s).mul(f).umod(i),S=c.mul(f).umod(i);return this.g.mulAdd(p,o,S)};Oi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new zv(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}});var gq=L((IOe,pq)=>{"use strict";h();var L0=Xn(),hq=L0.assert,dq=L0.parseBytes,Kf=L0.cachedProperty;function zr(t,e){this.eddsa=t,this._secret=dq(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=dq(e.pub)}zr.fromPublic=function(e,r){return r instanceof zr?r:new zr(e,{pub:r})};zr.fromSecret=function(e,r){return r instanceof zr?r:new zr(e,{secret:r})};zr.prototype.secret=function(){return this._secret};Kf(zr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Kf(zr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Kf(zr,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});Kf(zr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Kf(zr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Kf(zr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});zr.prototype.sign=function(e){return hq(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};zr.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};zr.prototype.getSecret=function(e){return hq(this._secret,"KeyPair is public only"),L0.encode(this.secret(),e)};zr.prototype.getPublic=function(e){return L0.encode(this.pubBytes(),e)};pq.exports=zr});var vq=L((xOe,yq)=>{"use strict";h();var Ufe=Qs(),jv=Xn(),mq=jv.assert,Qv=jv.cachedProperty,kfe=jv.parseBytes;function cu(t,e){this.eddsa=t,typeof e!="object"&&(e=kfe(e)),Array.isArray(e)&&(mq(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),mq(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof Ufe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Qv(cu,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Qv(cu,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Qv(cu,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Qv(cu,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});cu.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};cu.prototype.toHex=function(){return jv.encode(this.toBytes(),"hex").toUpperCase()};yq.exports=cu});var Sq=L((OOe,Eq)=>{"use strict";h();var Vfe=kv(),Hfe=Vv(),Wf=Xn(),Gfe=Wf.assert,wq=Wf.parseBytes,Aq=gq(),bq=vq();function Vn(t){if(Gfe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Vn))return new Vn(t);t=Hfe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Vfe.sha512}Eq.exports=Vn;Vn.prototype.sign=function(e,r){e=wq(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),c=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),a=i.add(c).umod(this.curve.n);return this.makeSignature({R:s,S:a,Rencoded:o})};Vn.prototype.verify=function(e,r,n){if(e=wq(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),c=r.R().add(i.pub().mul(s));return c.eq(o)};Vn.prototype.hashInt=function(){for(var e=this.hash(),r=0;r{"use strict";h();var uu=_q;uu.version=XL().version;uu.utils=Xn();uu.rand=hI();uu.curve=gI();uu.curves=Vv();uu.ec=fq();uu.eddsa=Sq()});var Iq={};Zt(Iq,{RELAY_JSONRPC:()=>tde,isPublishMethod:()=>BI,isPublishParams:()=>LI,isPublishRequest:()=>Wfe,isSubscribeMethod:()=>MI,isSubscribeParams:()=>DI,isSubscribeRequest:()=>Kfe,isSubscriptionMethod:()=>UI,isSubscriptionParams:()=>kI,isSubscriptionRequest:()=>Yfe,isUnsubscribeMethod:()=>FI,isUnsubscribeParams:()=>qI,isUnsubscribeRequest:()=>$fe,parsePublishRequest:()=>Xfe,parseSubscribeRequest:()=>Jfe,parseSubscriptionRequest:()=>ede,parseUnsubscribeRequest:()=>Zfe});function lu(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function zfe(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function jfe(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function Qfe(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Kv(t,e,r){return(r.length?Qfe(t,e.length):jfe(t,e.length))?zfe(t,e):!1}function Wv(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}function Kfe(t){return MI(t.method)&&DI(t.params)}function MI(t){return Wv(t,"subscribe")}function DI(t){return Kv(t,["topic"],[])}function Wfe(t){return BI(t.method)&&LI(t.params)}function BI(t){return Wv(t,"publish")}function LI(t){return Kv(t,["message","topic","ttl"],["prompt","tag"])}function $fe(t){return FI(t.method)&&qI(t.params)}function FI(t){return Wv(t,"unsubscribe")}function qI(t){return Kv(t,["id","topic"],[])}function Yfe(t){return UI(t.method)&&kI(t.params)}function UI(t){return Wv(t,"subscription")}function kI(t){return Kv(t,["id","data"],[])}function Jfe(t){if(!MI(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!DI(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return lu(e,"topic"),e}function Xfe(t){if(!BI(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!LI(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return lu(e,"topic"),lu(e,"message"),lu(e,"ttl","number"),e}function Zfe(t){if(!FI(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!qI(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return lu(e,"id"),e}function ede(t){if(!UI(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!kI(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return lu(e,"id"),lu(e,"data"),e}var tde,Cq=pe(()=>{h();tde={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}}});var J0=L(K=>{"use strict";h();Object.defineProperty(K,"__esModule",{value:!0});var rde=iL(),Yf=yf(),du=JT(),nde=oL(),ide=TL(),aU=ML(),sde=UL(),lb=y0(),fb=VL(),ode=jL(),Yt=(aI(),qe(oI)),ade=Tq(),cde=($T(),qe(WT)),ude=(Cq(),qe(Iq));function cU(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var nb=cU(ide),uU=cU(ode),db=":";function lU(t){let[e,r]=t.split(db);return{namespace:e,reference:r}}function fU(t){let{namespace:e,reference:r}=t;return[e,r].join(db)}function d8(t){let[e,r,n]=t.split(db);return{namespace:e,reference:r,address:n}}function dU(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(db)}function h8(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function hU(t){let{address:e}=d8(t);return e}function pU(t){let{namespace:e,reference:r}=d8(t);return fU({namespace:e,reference:r})}function lde(t,e){let{namespace:r,reference:n}=lU(e);return dU({namespace:r,reference:n,address:t})}function fde(t){return h8(t,hU)}function gU(t){return h8(t,pU)}function dde(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function hde(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...gU(i.accounts))}),r}function pde(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...hb(n,i))}),r}function hb(t,e){return t.includes(":")?[t]:e.chains||[]}var gde=Object.defineProperty,xq=Object.getOwnPropertySymbols,mde=Object.prototype.hasOwnProperty,yde=Object.prototype.propertyIsEnumerable,Nq=(t,e,r)=>e in t?gde(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oq=(t,e)=>{for(var r in e||(e={}))mde.call(e,r)&&Nq(t,r,e[r]);if(xq)for(var r of xq(e))yde.call(e,r)&&Nq(t,r,e[r]);return t},mU="ReactNative",_n={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},ib=" ",vde=":",yU="/",p8=2,bde=1e3,vU="js";function g8(){return typeof O.default<"u"&&typeof O.default.versions<"u"&&typeof O.default.versions.node<"u"}function rd(){return!du.getDocument()&&!!du.getNavigator()&&navigator.product===mU}function K0(){return!g8()&&!!du.getNavigator()&&!!du.getDocument()}function gu(){return rd()?_n.reactNative:g8()?_n.node:K0()?_n.browser:_n.unknown}function wde(){var t;try{return rd()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function bU(t,e){let r=nb.parse(t);return r=Oq(Oq({},r),e),t=nb.stringify(r),t}function Ade(){return nde.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Ede(t,e){var r;let n=gu(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=du.getLocation())==null?void 0:r.host)||"unknown"),i}function wU(){if(gu()===_n.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=rde.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function AU(){var t;let e=gu();return e===_n.browser?[e,((t=du.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function EU(t,e,r){let n=wU(),i=AU();return[[t,e].join("-"),[vU,r].join("-"),n,i].join("/")}function Sde({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:c}){let a=r.split("?"),u=EU(t,e,n),f={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0,origin:c||void 0},p=bU(a[1]||"",f);return a[0]+"?"+p}function _de(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function Tde(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function SU(t,e=p8){return _U(t.split(yU),e)}function Ide(t){return SU(t).join(ib)}function Ka(t,e){return t.filter(r=>e.includes(r)).length===t.length}function _U(t,e=p8){return t.slice(Math.max(t.length-e,0))}function Cde(t){return Object.fromEntries(t.entries())}function xde(t){return new Map(Object.entries(t))}function Nde(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Ode=t=>t;function TU(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function Pde(t){return t.split(ib).map(e=>TU(e)).join(ib)}function Rde(t=Yf.FIVE_MINUTES,e){let r=Yf.toMiliseconds(t||Yf.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,c)=>{s=setTimeout(()=>{c(new Error(e))},r),n=o,i=c})}}function Mde(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function m8(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Dde(t){return m8("topic",t)}function Bde(t){return m8("id",t)}function Lde(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Fde(t,e){return Yf.fromMiliseconds((e||Date.now())+Yf.toMiliseconds(t))}function qde(t){return Date.now()>=Yf.toMiliseconds(t)}function Ude(t,e){return`${t}${e?`:${e}`:""}`}function $o(t=[],e=[]){return[...new Set([...t,...e])]}async function kde({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;let i=typeof r=="string"?JSON.parse(r):r,s=i?.href;if(typeof s!="string")return;let o=IU(s,t,e),c=gu();if(c===_n.browser){if(!((n=du.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,CU()?"_blank":"_self","noreferrer noopener")}else c===_n.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function IU(t,e,r){let n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){let s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${xU(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function Vde(t,e){let r="";try{if(K0()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function r8(t,e){return t.filter(r=>e.includes(r))}function Hde(t,e){if(!t.includes(e))return null;let r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function Gde(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function zde(){return typeof O.default<"u"&&O.default.env.IS_VITEST==="true"}function CU(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function xU(t,e=!1){let r=b.Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function y8(t){return b.Buffer.from(t,"base64").toString("utf-8")}var NU=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jde(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var OU={exports:{}};(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof O.default=="object"&&O.default.versions&&O.default.versions.node;o?i=NU:s&&(i=self);var c=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],S=[1,256,65536,16777216],I=[6,1536,393216,100663296],N=[0,8,16,24],R=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],U=[128,256],k=["hex","buffer","arrayBuffer","array","digest"],z={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(P){return Object.prototype.toString.call(P)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(P){return typeof P=="object"&&P.buffer&&P.buffer.constructor===ArrayBuffer});for(var H=function(P,G,Q){return function($){return new M(P,G,P).update($)[Q]()}},F=function(P,G,Q){return function($,ee){return new M(P,G,ee).update($)[Q]()}},V=function(P,G,Q){return function($,ee,ie,X){return d["cshake"+P].update($,ee,ie,X)[Q]()}},q=function(P,G,Q){return function($,ee,ie,X){return d["kmac"+P].update($,ee,ie,X)[Q]()}},C=function(P,G,Q,$){for(var ee=0;ee>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Q>>5,this.extraBytes=(Q&31)>>3;for(var $=0;$<50;++$)this.s[$]=0}M.prototype.update=function(P){if(this.finalized)throw new Error(r);var G,Q=typeof P;if(Q!=="string"){if(Q==="object"){if(P===null)throw new Error(e);if(a&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!a||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);G=!0}for(var $=this.blocks,ee=this.byteCount,ie=P.length,X=this.blockCount,re=0,ae=this.s,Z,oe;re>2]|=P[re]<>2]|=oe<>2]|=(192|oe>>6)<>2]|=(128|oe&63)<=57344?($[Z>>2]|=(224|oe>>12)<>2]|=(128|oe>>6&63)<>2]|=(128|oe&63)<>2]|=(240|oe>>18)<>2]|=(128|oe>>12&63)<>2]|=(128|oe>>6&63)<>2]|=(128|oe&63)<=ee){for(this.start=Z-ee,this.block=$[X],Z=0;Z>8,Q=P&255;Q>0;)ee.unshift(Q),P=P>>8,Q=P&255,++$;return G?ee.push($):ee.unshift($),this.update(ee),ee.length},M.prototype.encodeString=function(P){var G,Q=typeof P;if(Q!=="string"){if(Q==="object"){if(P===null)throw new Error(e);if(a&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!a||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);G=!0}var $=0,ee=P.length;if(G)$=ee;else for(var ie=0;ie=57344?$+=3:(X=65536+((X&1023)<<10|P.charCodeAt(++ie)&1023),$+=4)}return $+=this.encode($*8),this.update(P),$},M.prototype.bytepad=function(P,G){for(var Q=this.encode(G),$=0;$>2]|=this.padding[G&3],this.lastByteIndex===this.byteCount)for(P[0]=P[Q],G=1;G>4&15]+u[re&15]+u[re>>12&15]+u[re>>8&15]+u[re>>20&15]+u[re>>16&15]+u[re>>28&15]+u[re>>24&15];ie%P===0&&(Y(G),ee=0)}return $&&(re=G[ee],X+=u[re>>4&15]+u[re&15],$>1&&(X+=u[re>>12&15]+u[re>>8&15]),$>2&&(X+=u[re>>20&15]+u[re>>16&15])),X},M.prototype.arrayBuffer=function(){this.finalize();var P=this.blockCount,G=this.s,Q=this.outputBlocks,$=this.extraBytes,ee=0,ie=0,X=this.outputBits>>3,re;$?re=new ArrayBuffer(Q+1<<2):re=new ArrayBuffer(X);for(var ae=new Uint32Array(re);ie>8&255,X[re+2]=ae>>16&255,X[re+3]=ae>>24&255;ie%P===0&&Y(G)}return $&&(re=ie<<2,ae=G[ee],X[re]=ae&255,$>1&&(X[re+1]=ae>>8&255),$>2&&(X[re+2]=ae>>16&255)),X};function W(P,G,Q){M.call(this,P,G,Q)}W.prototype=new M,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),M.prototype.finalize.call(this)};var Y=function(P){var G,Q,$,ee,ie,X,re,ae,Z,oe,Ot,De,Pt,Rt,Be,Mt,Dt,Le,Bt,Lt,Fe,Ft,at,Se,ct,ut,_e,lt,ft,Te,dt,ht,Ie,pt,gt,Ce,mt,yt,xe,vt,bt,Ne,wt,At,Oe,Et,St,Pe,_t,Tt,Re,It,Ct,Me,xt,rt,nt,nn,sn,on,an,cn,un;for($=0;$<48;$+=2)ee=P[0]^P[10]^P[20]^P[30]^P[40],ie=P[1]^P[11]^P[21]^P[31]^P[41],X=P[2]^P[12]^P[22]^P[32]^P[42],re=P[3]^P[13]^P[23]^P[33]^P[43],ae=P[4]^P[14]^P[24]^P[34]^P[44],Z=P[5]^P[15]^P[25]^P[35]^P[45],oe=P[6]^P[16]^P[26]^P[36]^P[46],Ot=P[7]^P[17]^P[27]^P[37]^P[47],De=P[8]^P[18]^P[28]^P[38]^P[48],Pt=P[9]^P[19]^P[29]^P[39]^P[49],G=De^(X<<1|re>>>31),Q=Pt^(re<<1|X>>>31),P[0]^=G,P[1]^=Q,P[10]^=G,P[11]^=Q,P[20]^=G,P[21]^=Q,P[30]^=G,P[31]^=Q,P[40]^=G,P[41]^=Q,G=ee^(ae<<1|Z>>>31),Q=ie^(Z<<1|ae>>>31),P[2]^=G,P[3]^=Q,P[12]^=G,P[13]^=Q,P[22]^=G,P[23]^=Q,P[32]^=G,P[33]^=Q,P[42]^=G,P[43]^=Q,G=X^(oe<<1|Ot>>>31),Q=re^(Ot<<1|oe>>>31),P[4]^=G,P[5]^=Q,P[14]^=G,P[15]^=Q,P[24]^=G,P[25]^=Q,P[34]^=G,P[35]^=Q,P[44]^=G,P[45]^=Q,G=ae^(De<<1|Pt>>>31),Q=Z^(Pt<<1|De>>>31),P[6]^=G,P[7]^=Q,P[16]^=G,P[17]^=Q,P[26]^=G,P[27]^=Q,P[36]^=G,P[37]^=Q,P[46]^=G,P[47]^=Q,G=oe^(ee<<1|ie>>>31),Q=Ot^(ie<<1|ee>>>31),P[8]^=G,P[9]^=Q,P[18]^=G,P[19]^=Q,P[28]^=G,P[29]^=Q,P[38]^=G,P[39]^=Q,P[48]^=G,P[49]^=Q,Rt=P[0],Be=P[1],Et=P[11]<<4|P[10]>>>28,St=P[10]<<4|P[11]>>>28,lt=P[20]<<3|P[21]>>>29,ft=P[21]<<3|P[20]>>>29,on=P[31]<<9|P[30]>>>23,an=P[30]<<9|P[31]>>>23,Ne=P[40]<<18|P[41]>>>14,wt=P[41]<<18|P[40]>>>14,pt=P[2]<<1|P[3]>>>31,gt=P[3]<<1|P[2]>>>31,Mt=P[13]<<12|P[12]>>>20,Dt=P[12]<<12|P[13]>>>20,Pe=P[22]<<10|P[23]>>>22,_t=P[23]<<10|P[22]>>>22,Te=P[33]<<13|P[32]>>>19,dt=P[32]<<13|P[33]>>>19,cn=P[42]<<2|P[43]>>>30,un=P[43]<<2|P[42]>>>30,Me=P[5]<<30|P[4]>>>2,xt=P[4]<<30|P[5]>>>2,Ce=P[14]<<6|P[15]>>>26,mt=P[15]<<6|P[14]>>>26,Le=P[25]<<11|P[24]>>>21,Bt=P[24]<<11|P[25]>>>21,Tt=P[34]<<15|P[35]>>>17,Re=P[35]<<15|P[34]>>>17,ht=P[45]<<29|P[44]>>>3,Ie=P[44]<<29|P[45]>>>3,Se=P[6]<<28|P[7]>>>4,ct=P[7]<<28|P[6]>>>4,rt=P[17]<<23|P[16]>>>9,nt=P[16]<<23|P[17]>>>9,yt=P[26]<<25|P[27]>>>7,xe=P[27]<<25|P[26]>>>7,Lt=P[36]<<21|P[37]>>>11,Fe=P[37]<<21|P[36]>>>11,It=P[47]<<24|P[46]>>>8,Ct=P[46]<<24|P[47]>>>8,At=P[8]<<27|P[9]>>>5,Oe=P[9]<<27|P[8]>>>5,ut=P[18]<<20|P[19]>>>12,_e=P[19]<<20|P[18]>>>12,nn=P[29]<<7|P[28]>>>25,sn=P[28]<<7|P[29]>>>25,vt=P[38]<<8|P[39]>>>24,bt=P[39]<<8|P[38]>>>24,Ft=P[48]<<14|P[49]>>>18,at=P[49]<<14|P[48]>>>18,P[0]=Rt^~Mt&Le,P[1]=Be^~Dt&Bt,P[10]=Se^~ut<,P[11]=ct^~_e&ft,P[20]=pt^~Ce&yt,P[21]=gt^~mt&xe,P[30]=At^~Et&Pe,P[31]=Oe^~St&_t,P[40]=Me^~rt&nn,P[41]=xt^~nt&sn,P[2]=Mt^~Le&Lt,P[3]=Dt^~Bt&Fe,P[12]=ut^~lt&Te,P[13]=_e^~ft&dt,P[22]=Ce^~yt&vt,P[23]=mt^~xe&bt,P[32]=Et^~Pe&Tt,P[33]=St^~_t&Re,P[42]=rt^~nn&on,P[43]=nt^~sn&an,P[4]=Le^~Lt&Ft,P[5]=Bt^~Fe&at,P[14]=lt^~Te&ht,P[15]=ft^~dt&Ie,P[24]=yt^~vt&Ne,P[25]=xe^~bt&wt,P[34]=Pe^~Tt&It,P[35]=_t^~Re&Ct,P[44]=nn^~on&cn,P[45]=sn^~an&un,P[6]=Lt^~Ft&Rt,P[7]=Fe^~at&Be,P[16]=Te^~ht&Se,P[17]=dt^~Ie&ct,P[26]=vt^~Ne&pt,P[27]=bt^~wt>,P[36]=Tt^~It&At,P[37]=Re^~Ct&Oe,P[46]=on^~cn&Me,P[47]=an^~un&xt,P[8]=Ft^~Rt&Mt,P[9]=at^~Be&Dt,P[18]=ht^~Se&ut,P[19]=Ie^~ct&_e,P[28]=Ne^~pt&Ce,P[29]=wt^~gt&mt,P[38]=It^~At&Et,P[39]=Ct^~Oe&St,P[48]=cn^~Me&rt,P[49]=un^~xt&nt,P[0]^=R[$],P[1]^=R[$+1]};if(c)t.exports=d;else for(w=0;w{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var Dq=Wde(),n8;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(n8||(n8={}));var ls;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ls||(ls={}));var Bq="0123456789abcdef",lr=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let n=e.toLowerCase();eb[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Mq>eb[n])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,n){if(Rq)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(a=>{let u=n[a];try{if(u instanceof Uint8Array){let f="";for(let p=0;p>4],f+=Bq[u[p]&15];i.push(a+"=Uint8Array(0x"+f+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);let s=e,o="";switch(r){case ls.NUMERIC_FAULT:{o="NUMERIC_FAULT";let a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":o+="-"+a;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case ls.CALL_EXCEPTION:case ls.INSUFFICIENT_FUNDS:case ls.MISSING_NEW:case ls.NONCE_EXPIRED:case ls.REPLACEMENT_UNDERPRICED:case ls.TRANSACTION_REPLACED:case ls.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let c=new Error(e);return c.reason=s,c.code=r,Object.keys(n).forEach(function(a){c[a]=n[a]}),c}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Dq&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Dq})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return VI||(VI=new t(Kde)),VI}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Pq){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Rq=!!e,Pq=!!r}static setLogLevel(e){let r=eb[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}Mq=r}static from(e){return new t(e)}};lr.errors=ls,lr.levels=n8;var $de="bytes/5.7.0",Cr=new lr($de);function PU(t){return!!t.toHexString}function Jf(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return Jf(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Yde(t){return Zn(t)&&!(t.length%2)||nd(t)}function Lq(t){return typeof t=="number"&&t==t&&t%1===0}function nd(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Lq(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function vr(t,e){if(e||(e={}),typeof t=="number"){Cr.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Jf(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PU(t)&&(t=t.toHexString()),Zn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Cr.throwArgumentError("hex data is odd-length","value",t));let n=[];for(let i=0;ivr(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Jf(n)}function Xde(t,e){t=vr(t),t.length>e&&Cr.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),Jf(r)}function Zn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var HI="0123456789abcdef";function En(t,e){if(e||(e={}),typeof t=="number"){Cr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=HI[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PU(t))return t.toHexString();if(Zn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Cr.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(nd(t)){let r="0x";for(let n=0;n>4]+HI[i&15]}return r}return Cr.throwArgumentError("invalid hexlify value","value",t)}function Zde(t){if(typeof t!="string")t=En(t);else if(!Zn(t)||t.length%2)return null;return(t.length-2)/2}function Fq(t,e,r){return typeof t!="string"?t=En(t):(!Zn(t)||t.length%2)&&Cr.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function so(t,e){for(typeof t!="string"?t=En(t):Zn(t)||Cr.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Cr.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function RU(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Yde(t)){let r=vr(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=En(r.slice(0,32)),e.s=En(r.slice(32,64))):r.length===65?(e.r=En(r.slice(0,32)),e.s=En(r.slice(32,64)),e.v=r[64]):Cr.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:Cr.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=En(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let i=Xde(vr(e._vs),32);e._vs=En(i);let s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Cr.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;let o=En(i);e.s==null?e.s=o:e.s!==o&&Cr.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?Cr.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Cr.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Zn(e.r)?Cr.throwArgumentError("signature missing or invalid r","signature",t):e.r=so(e.r,32),e.s==null||!Zn(e.s)?Cr.throwArgumentError("signature missing or invalid s","signature",t):e.s=so(e.s,32);let r=vr(e.s);r[0]>=128&&Cr.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let n=En(r);e._vs&&(Zn(e._vs)||Cr.throwArgumentError("signature invalid _vs","signature",t),e._vs=so(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&Cr.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function v8(t){return"0x"+Qde.keccak_256(vr(t))}var MU={exports:{}},ehe={},the=Object.freeze({__proto__:null,default:ehe}),rhe=jde(the);(function(t){(function(e,r){function n(l,d){if(!l)throw new Error(d||"Assertion failed")}function i(l,d){l.super_=d;var m=function(){};m.prototype=d.prototype,l.prototype=new m,l.prototype.constructor=l}function s(l,d,m){if(s.isBN(l))return l;this.negative=0,this.words=null,this.length=0,this.red=null,l!==null&&((d==="le"||d==="be")&&(m=d,d=10),this._init(l||0,d||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=rhe.Buffer}catch{}s.isBN=function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},s.max=function(l,d){return l.cmp(d)>0?l:d},s.min=function(l,d){return l.cmp(d)<0?l:d},s.prototype._init=function(l,d,m){if(typeof l=="number")return this._initNumber(l,d,m);if(typeof l=="object")return this._initArray(l,d,m);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),l=l.toString().replace(/\s+/g,"");var w=0;l[0]==="-"&&(w++,this.negative=1),w=0;w-=3)A=l[w]|l[w-1]<<8|l[w-2]<<16,this.words[_]|=A<>>26-y&67108863,y+=24,y>=26&&(y-=26,_++);else if(m==="le")for(w=0,_=0;w>>26-y&67108863,y+=24,y>=26&&(y-=26,_++);return this._strip()};function c(l,d){var m=l.charCodeAt(d);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;n(!1,"Invalid character in "+l)}function a(l,d,m){var w=c(l,m);return m-1>=d&&(w|=c(l,m-1)<<4),w}s.prototype._parseHex=function(l,d,m){this.length=Math.ceil((l.length-d)/6),this.words=new Array(this.length);for(var w=0;w=d;w-=2)y=a(l,d,w)<<_,this.words[A]|=y&67108863,_>=18?(_-=18,A+=1,this.words[A]|=y>>>26):_+=8;else{var T=l.length-d;for(w=T%2===0?d+1:d;w=18?(_-=18,A+=1,this.words[A]|=y>>>26):_+=8}this._strip()};function u(l,d,m,w){for(var _=0,A=0,y=Math.min(l.length,m),T=d;T=49?A=E-49+10:E>=17?A=E-17+10:A=E,n(E>=0&&A1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var S=["","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"],I=[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],N=[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];s.prototype.toString=function(l,d){l=l||10,d=d|0||1;var m;if(l===16||l==="hex"){m="";for(var w=0,_=0,A=0;A>>24-w&16777215,w+=2,w>=26&&(w-=26,A--),_!==0||A!==this.length-1?m=S[6-T.length]+T+m:m=T+m}for(_!==0&&(m=_.toString(16)+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(l===(l|0)&&l>=2&&l<=36){var E=I[l],M=N[l];m="";var W=this.clone();for(W.negative=0;!W.isZero();){var Y=W.modrn(M).toString(l);W=W.idivn(M),W.isZero()?m=Y+m:m=S[E-Y.length]+Y+m}for(this.isZero()&&(m="0"+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(l,d){return this.toArrayLike(o,l,d)}),s.prototype.toArray=function(l,d){return this.toArrayLike(Array,l,d)};var R=function(l,d){return l.allocUnsafe?l.allocUnsafe(d):new l(d)};s.prototype.toArrayLike=function(l,d,m){this._strip();var w=this.byteLength(),_=m||Math.max(1,w);n(w<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var A=R(l,_),y=d==="le"?"LE":"BE";return this["_toArrayLike"+y](A,w),A},s.prototype._toArrayLikeLE=function(l,d){for(var m=0,w=0,_=0,A=0;_>8&255),m>16&255),A===6?(m>24&255),w=0,A=0):(w=y>>>24,A+=2)}if(m=0&&(l[m--]=y>>8&255),m>=0&&(l[m--]=y>>16&255),A===6?(m>=0&&(l[m--]=y>>24&255),w=0,A=0):(w=y>>>24,A+=2)}if(m>=0)for(l[m--]=w;m>=0;)l[m--]=0},Math.clz32?s.prototype._countBits=function(l){return 32-Math.clz32(l)}:s.prototype._countBits=function(l){var d=l,m=0;return d>=4096&&(m+=13,d>>>=13),d>=64&&(m+=7,d>>>=7),d>=8&&(m+=4,d>>>=4),d>=2&&(m+=2,d>>>=2),m+d},s.prototype._zeroBits=function(l){if(l===0)return 26;var d=l,m=0;return d&8191||(m+=13,d>>>=13),d&127||(m+=7,d>>>=7),d&15||(m+=4,d>>>=4),d&3||(m+=2,d>>>=2),d&1||m++,m},s.prototype.bitLength=function(){var l=this.words[this.length-1],d=this._countBits(l);return(this.length-1)*26+d};function D(l){for(var d=new Array(l.bitLength()),m=0;m>>_&1}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,d=0;dl.length?this.clone().ior(l):l.clone().ior(this)},s.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},s.prototype.iuand=function(l){var d;this.length>l.length?d=l:d=this;for(var m=0;ml.length?this.clone().iand(l):l.clone().iand(this)},s.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},s.prototype.iuxor=function(l){var d,m;this.length>l.length?(d=this,m=l):(d=l,m=this);for(var w=0;wl.length?this.clone().ixor(l):l.clone().ixor(this)},s.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},s.prototype.inotn=function(l){n(typeof l=="number"&&l>=0);var d=Math.ceil(l/26)|0,m=l%26;this._expand(d),m>0&&d--;for(var w=0;w0&&(this.words[w]=~this.words[w]&67108863>>26-m),this._strip()},s.prototype.notn=function(l){return this.clone().inotn(l)},s.prototype.setn=function(l,d){n(typeof l=="number"&&l>=0);var m=l/26|0,w=l%26;return this._expand(m+1),d?this.words[m]=this.words[m]|1<l.length?(m=this,w=l):(m=l,w=this);for(var _=0,A=0;A>>26;for(;_!==0&&A>>26;if(this.length=m.length,_!==0)this.words[this.length]=_,this.length++;else if(m!==this)for(;Al.length?this.clone().iadd(l):l.clone().iadd(this)},s.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var d=this.iadd(l);return l.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var m=this.cmp(l);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,_;m>0?(w=this,_=l):(w=l,_=this);for(var A=0,y=0;y<_.length;y++)d=(w.words[y]|0)-(_.words[y]|0)+A,A=d>>26,this.words[y]=d&67108863;for(;A!==0&&y>26,this.words[y]=d&67108863;if(A===0&&y>>26,Y=E&67108863,P=Math.min(M,d.length-1),G=Math.max(0,M-l.length+1);G<=P;G++){var Q=M-G|0;_=l.words[Q]|0,A=d.words[G]|0,y=_*A+Y,W+=y/67108864|0,Y=y&67108863}m.words[M]=Y|0,E=W|0}return E!==0?m.words[M]=E|0:m.length--,m._strip()}var k=function(l,d,m){var w=l.words,_=d.words,A=m.words,y=0,T,E,M,W=w[0]|0,Y=W&8191,P=W>>>13,G=w[1]|0,Q=G&8191,$=G>>>13,ee=w[2]|0,ie=ee&8191,X=ee>>>13,re=w[3]|0,ae=re&8191,Z=re>>>13,oe=w[4]|0,Ot=oe&8191,De=oe>>>13,Pt=w[5]|0,Rt=Pt&8191,Be=Pt>>>13,Mt=w[6]|0,Dt=Mt&8191,Le=Mt>>>13,Bt=w[7]|0,Lt=Bt&8191,Fe=Bt>>>13,Ft=w[8]|0,at=Ft&8191,Se=Ft>>>13,ct=w[9]|0,ut=ct&8191,_e=ct>>>13,lt=_[0]|0,ft=lt&8191,Te=lt>>>13,dt=_[1]|0,ht=dt&8191,Ie=dt>>>13,pt=_[2]|0,gt=pt&8191,Ce=pt>>>13,mt=_[3]|0,yt=mt&8191,xe=mt>>>13,vt=_[4]|0,bt=vt&8191,Ne=vt>>>13,wt=_[5]|0,At=wt&8191,Oe=wt>>>13,Et=_[6]|0,St=Et&8191,Pe=Et>>>13,_t=_[7]|0,Tt=_t&8191,Re=_t>>>13,It=_[8]|0,Ct=It&8191,Me=It>>>13,xt=_[9]|0,rt=xt&8191,nt=xt>>>13;m.negative=l.negative^d.negative,m.length=19,T=Math.imul(Y,ft),E=Math.imul(Y,Te),E=E+Math.imul(P,ft)|0,M=Math.imul(P,Te);var nn=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(nn>>>26)|0,nn&=67108863,T=Math.imul(Q,ft),E=Math.imul(Q,Te),E=E+Math.imul($,ft)|0,M=Math.imul($,Te),T=T+Math.imul(Y,ht)|0,E=E+Math.imul(Y,Ie)|0,E=E+Math.imul(P,ht)|0,M=M+Math.imul(P,Ie)|0;var sn=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(sn>>>26)|0,sn&=67108863,T=Math.imul(ie,ft),E=Math.imul(ie,Te),E=E+Math.imul(X,ft)|0,M=Math.imul(X,Te),T=T+Math.imul(Q,ht)|0,E=E+Math.imul(Q,Ie)|0,E=E+Math.imul($,ht)|0,M=M+Math.imul($,Ie)|0,T=T+Math.imul(Y,gt)|0,E=E+Math.imul(Y,Ce)|0,E=E+Math.imul(P,gt)|0,M=M+Math.imul(P,Ce)|0;var on=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(on>>>26)|0,on&=67108863,T=Math.imul(ae,ft),E=Math.imul(ae,Te),E=E+Math.imul(Z,ft)|0,M=Math.imul(Z,Te),T=T+Math.imul(ie,ht)|0,E=E+Math.imul(ie,Ie)|0,E=E+Math.imul(X,ht)|0,M=M+Math.imul(X,Ie)|0,T=T+Math.imul(Q,gt)|0,E=E+Math.imul(Q,Ce)|0,E=E+Math.imul($,gt)|0,M=M+Math.imul($,Ce)|0,T=T+Math.imul(Y,yt)|0,E=E+Math.imul(Y,xe)|0,E=E+Math.imul(P,yt)|0,M=M+Math.imul(P,xe)|0;var an=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(an>>>26)|0,an&=67108863,T=Math.imul(Ot,ft),E=Math.imul(Ot,Te),E=E+Math.imul(De,ft)|0,M=Math.imul(De,Te),T=T+Math.imul(ae,ht)|0,E=E+Math.imul(ae,Ie)|0,E=E+Math.imul(Z,ht)|0,M=M+Math.imul(Z,Ie)|0,T=T+Math.imul(ie,gt)|0,E=E+Math.imul(ie,Ce)|0,E=E+Math.imul(X,gt)|0,M=M+Math.imul(X,Ce)|0,T=T+Math.imul(Q,yt)|0,E=E+Math.imul(Q,xe)|0,E=E+Math.imul($,yt)|0,M=M+Math.imul($,xe)|0,T=T+Math.imul(Y,bt)|0,E=E+Math.imul(Y,Ne)|0,E=E+Math.imul(P,bt)|0,M=M+Math.imul(P,Ne)|0;var cn=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(cn>>>26)|0,cn&=67108863,T=Math.imul(Rt,ft),E=Math.imul(Rt,Te),E=E+Math.imul(Be,ft)|0,M=Math.imul(Be,Te),T=T+Math.imul(Ot,ht)|0,E=E+Math.imul(Ot,Ie)|0,E=E+Math.imul(De,ht)|0,M=M+Math.imul(De,Ie)|0,T=T+Math.imul(ae,gt)|0,E=E+Math.imul(ae,Ce)|0,E=E+Math.imul(Z,gt)|0,M=M+Math.imul(Z,Ce)|0,T=T+Math.imul(ie,yt)|0,E=E+Math.imul(ie,xe)|0,E=E+Math.imul(X,yt)|0,M=M+Math.imul(X,xe)|0,T=T+Math.imul(Q,bt)|0,E=E+Math.imul(Q,Ne)|0,E=E+Math.imul($,bt)|0,M=M+Math.imul($,Ne)|0,T=T+Math.imul(Y,At)|0,E=E+Math.imul(Y,Oe)|0,E=E+Math.imul(P,At)|0,M=M+Math.imul(P,Oe)|0;var un=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(un>>>26)|0,un&=67108863,T=Math.imul(Dt,ft),E=Math.imul(Dt,Te),E=E+Math.imul(Le,ft)|0,M=Math.imul(Le,Te),T=T+Math.imul(Rt,ht)|0,E=E+Math.imul(Rt,Ie)|0,E=E+Math.imul(Be,ht)|0,M=M+Math.imul(Be,Ie)|0,T=T+Math.imul(Ot,gt)|0,E=E+Math.imul(Ot,Ce)|0,E=E+Math.imul(De,gt)|0,M=M+Math.imul(De,Ce)|0,T=T+Math.imul(ae,yt)|0,E=E+Math.imul(ae,xe)|0,E=E+Math.imul(Z,yt)|0,M=M+Math.imul(Z,xe)|0,T=T+Math.imul(ie,bt)|0,E=E+Math.imul(ie,Ne)|0,E=E+Math.imul(X,bt)|0,M=M+Math.imul(X,Ne)|0,T=T+Math.imul(Q,At)|0,E=E+Math.imul(Q,Oe)|0,E=E+Math.imul($,At)|0,M=M+Math.imul($,Oe)|0,T=T+Math.imul(Y,St)|0,E=E+Math.imul(Y,Pe)|0,E=E+Math.imul(P,St)|0,M=M+Math.imul(P,Pe)|0;var Ui=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,T=Math.imul(Lt,ft),E=Math.imul(Lt,Te),E=E+Math.imul(Fe,ft)|0,M=Math.imul(Fe,Te),T=T+Math.imul(Dt,ht)|0,E=E+Math.imul(Dt,Ie)|0,E=E+Math.imul(Le,ht)|0,M=M+Math.imul(Le,Ie)|0,T=T+Math.imul(Rt,gt)|0,E=E+Math.imul(Rt,Ce)|0,E=E+Math.imul(Be,gt)|0,M=M+Math.imul(Be,Ce)|0,T=T+Math.imul(Ot,yt)|0,E=E+Math.imul(Ot,xe)|0,E=E+Math.imul(De,yt)|0,M=M+Math.imul(De,xe)|0,T=T+Math.imul(ae,bt)|0,E=E+Math.imul(ae,Ne)|0,E=E+Math.imul(Z,bt)|0,M=M+Math.imul(Z,Ne)|0,T=T+Math.imul(ie,At)|0,E=E+Math.imul(ie,Oe)|0,E=E+Math.imul(X,At)|0,M=M+Math.imul(X,Oe)|0,T=T+Math.imul(Q,St)|0,E=E+Math.imul(Q,Pe)|0,E=E+Math.imul($,St)|0,M=M+Math.imul($,Pe)|0,T=T+Math.imul(Y,Tt)|0,E=E+Math.imul(Y,Re)|0,E=E+Math.imul(P,Tt)|0,M=M+Math.imul(P,Re)|0;var ki=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(ki>>>26)|0,ki&=67108863,T=Math.imul(at,ft),E=Math.imul(at,Te),E=E+Math.imul(Se,ft)|0,M=Math.imul(Se,Te),T=T+Math.imul(Lt,ht)|0,E=E+Math.imul(Lt,Ie)|0,E=E+Math.imul(Fe,ht)|0,M=M+Math.imul(Fe,Ie)|0,T=T+Math.imul(Dt,gt)|0,E=E+Math.imul(Dt,Ce)|0,E=E+Math.imul(Le,gt)|0,M=M+Math.imul(Le,Ce)|0,T=T+Math.imul(Rt,yt)|0,E=E+Math.imul(Rt,xe)|0,E=E+Math.imul(Be,yt)|0,M=M+Math.imul(Be,xe)|0,T=T+Math.imul(Ot,bt)|0,E=E+Math.imul(Ot,Ne)|0,E=E+Math.imul(De,bt)|0,M=M+Math.imul(De,Ne)|0,T=T+Math.imul(ae,At)|0,E=E+Math.imul(ae,Oe)|0,E=E+Math.imul(Z,At)|0,M=M+Math.imul(Z,Oe)|0,T=T+Math.imul(ie,St)|0,E=E+Math.imul(ie,Pe)|0,E=E+Math.imul(X,St)|0,M=M+Math.imul(X,Pe)|0,T=T+Math.imul(Q,Tt)|0,E=E+Math.imul(Q,Re)|0,E=E+Math.imul($,Tt)|0,M=M+Math.imul($,Re)|0,T=T+Math.imul(Y,Ct)|0,E=E+Math.imul(Y,Me)|0,E=E+Math.imul(P,Ct)|0,M=M+Math.imul(P,Me)|0;var Vi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,T=Math.imul(ut,ft),E=Math.imul(ut,Te),E=E+Math.imul(_e,ft)|0,M=Math.imul(_e,Te),T=T+Math.imul(at,ht)|0,E=E+Math.imul(at,Ie)|0,E=E+Math.imul(Se,ht)|0,M=M+Math.imul(Se,Ie)|0,T=T+Math.imul(Lt,gt)|0,E=E+Math.imul(Lt,Ce)|0,E=E+Math.imul(Fe,gt)|0,M=M+Math.imul(Fe,Ce)|0,T=T+Math.imul(Dt,yt)|0,E=E+Math.imul(Dt,xe)|0,E=E+Math.imul(Le,yt)|0,M=M+Math.imul(Le,xe)|0,T=T+Math.imul(Rt,bt)|0,E=E+Math.imul(Rt,Ne)|0,E=E+Math.imul(Be,bt)|0,M=M+Math.imul(Be,Ne)|0,T=T+Math.imul(Ot,At)|0,E=E+Math.imul(Ot,Oe)|0,E=E+Math.imul(De,At)|0,M=M+Math.imul(De,Oe)|0,T=T+Math.imul(ae,St)|0,E=E+Math.imul(ae,Pe)|0,E=E+Math.imul(Z,St)|0,M=M+Math.imul(Z,Pe)|0,T=T+Math.imul(ie,Tt)|0,E=E+Math.imul(ie,Re)|0,E=E+Math.imul(X,Tt)|0,M=M+Math.imul(X,Re)|0,T=T+Math.imul(Q,Ct)|0,E=E+Math.imul(Q,Me)|0,E=E+Math.imul($,Ct)|0,M=M+Math.imul($,Me)|0,T=T+Math.imul(Y,rt)|0,E=E+Math.imul(Y,nt)|0,E=E+Math.imul(P,rt)|0,M=M+Math.imul(P,nt)|0;var Hi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,T=Math.imul(ut,ht),E=Math.imul(ut,Ie),E=E+Math.imul(_e,ht)|0,M=Math.imul(_e,Ie),T=T+Math.imul(at,gt)|0,E=E+Math.imul(at,Ce)|0,E=E+Math.imul(Se,gt)|0,M=M+Math.imul(Se,Ce)|0,T=T+Math.imul(Lt,yt)|0,E=E+Math.imul(Lt,xe)|0,E=E+Math.imul(Fe,yt)|0,M=M+Math.imul(Fe,xe)|0,T=T+Math.imul(Dt,bt)|0,E=E+Math.imul(Dt,Ne)|0,E=E+Math.imul(Le,bt)|0,M=M+Math.imul(Le,Ne)|0,T=T+Math.imul(Rt,At)|0,E=E+Math.imul(Rt,Oe)|0,E=E+Math.imul(Be,At)|0,M=M+Math.imul(Be,Oe)|0,T=T+Math.imul(Ot,St)|0,E=E+Math.imul(Ot,Pe)|0,E=E+Math.imul(De,St)|0,M=M+Math.imul(De,Pe)|0,T=T+Math.imul(ae,Tt)|0,E=E+Math.imul(ae,Re)|0,E=E+Math.imul(Z,Tt)|0,M=M+Math.imul(Z,Re)|0,T=T+Math.imul(ie,Ct)|0,E=E+Math.imul(ie,Me)|0,E=E+Math.imul(X,Ct)|0,M=M+Math.imul(X,Me)|0,T=T+Math.imul(Q,rt)|0,E=E+Math.imul(Q,nt)|0,E=E+Math.imul($,rt)|0,M=M+Math.imul($,nt)|0;var Gi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,T=Math.imul(ut,gt),E=Math.imul(ut,Ce),E=E+Math.imul(_e,gt)|0,M=Math.imul(_e,Ce),T=T+Math.imul(at,yt)|0,E=E+Math.imul(at,xe)|0,E=E+Math.imul(Se,yt)|0,M=M+Math.imul(Se,xe)|0,T=T+Math.imul(Lt,bt)|0,E=E+Math.imul(Lt,Ne)|0,E=E+Math.imul(Fe,bt)|0,M=M+Math.imul(Fe,Ne)|0,T=T+Math.imul(Dt,At)|0,E=E+Math.imul(Dt,Oe)|0,E=E+Math.imul(Le,At)|0,M=M+Math.imul(Le,Oe)|0,T=T+Math.imul(Rt,St)|0,E=E+Math.imul(Rt,Pe)|0,E=E+Math.imul(Be,St)|0,M=M+Math.imul(Be,Pe)|0,T=T+Math.imul(Ot,Tt)|0,E=E+Math.imul(Ot,Re)|0,E=E+Math.imul(De,Tt)|0,M=M+Math.imul(De,Re)|0,T=T+Math.imul(ae,Ct)|0,E=E+Math.imul(ae,Me)|0,E=E+Math.imul(Z,Ct)|0,M=M+Math.imul(Z,Me)|0,T=T+Math.imul(ie,rt)|0,E=E+Math.imul(ie,nt)|0,E=E+Math.imul(X,rt)|0,M=M+Math.imul(X,nt)|0;var zi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(zi>>>26)|0,zi&=67108863,T=Math.imul(ut,yt),E=Math.imul(ut,xe),E=E+Math.imul(_e,yt)|0,M=Math.imul(_e,xe),T=T+Math.imul(at,bt)|0,E=E+Math.imul(at,Ne)|0,E=E+Math.imul(Se,bt)|0,M=M+Math.imul(Se,Ne)|0,T=T+Math.imul(Lt,At)|0,E=E+Math.imul(Lt,Oe)|0,E=E+Math.imul(Fe,At)|0,M=M+Math.imul(Fe,Oe)|0,T=T+Math.imul(Dt,St)|0,E=E+Math.imul(Dt,Pe)|0,E=E+Math.imul(Le,St)|0,M=M+Math.imul(Le,Pe)|0,T=T+Math.imul(Rt,Tt)|0,E=E+Math.imul(Rt,Re)|0,E=E+Math.imul(Be,Tt)|0,M=M+Math.imul(Be,Re)|0,T=T+Math.imul(Ot,Ct)|0,E=E+Math.imul(Ot,Me)|0,E=E+Math.imul(De,Ct)|0,M=M+Math.imul(De,Me)|0,T=T+Math.imul(ae,rt)|0,E=E+Math.imul(ae,nt)|0,E=E+Math.imul(Z,rt)|0,M=M+Math.imul(Z,nt)|0;var ji=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(ji>>>26)|0,ji&=67108863,T=Math.imul(ut,bt),E=Math.imul(ut,Ne),E=E+Math.imul(_e,bt)|0,M=Math.imul(_e,Ne),T=T+Math.imul(at,At)|0,E=E+Math.imul(at,Oe)|0,E=E+Math.imul(Se,At)|0,M=M+Math.imul(Se,Oe)|0,T=T+Math.imul(Lt,St)|0,E=E+Math.imul(Lt,Pe)|0,E=E+Math.imul(Fe,St)|0,M=M+Math.imul(Fe,Pe)|0,T=T+Math.imul(Dt,Tt)|0,E=E+Math.imul(Dt,Re)|0,E=E+Math.imul(Le,Tt)|0,M=M+Math.imul(Le,Re)|0,T=T+Math.imul(Rt,Ct)|0,E=E+Math.imul(Rt,Me)|0,E=E+Math.imul(Be,Ct)|0,M=M+Math.imul(Be,Me)|0,T=T+Math.imul(Ot,rt)|0,E=E+Math.imul(Ot,nt)|0,E=E+Math.imul(De,rt)|0,M=M+Math.imul(De,nt)|0;var Qi=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Qi>>>26)|0,Qi&=67108863,T=Math.imul(ut,At),E=Math.imul(ut,Oe),E=E+Math.imul(_e,At)|0,M=Math.imul(_e,Oe),T=T+Math.imul(at,St)|0,E=E+Math.imul(at,Pe)|0,E=E+Math.imul(Se,St)|0,M=M+Math.imul(Se,Pe)|0,T=T+Math.imul(Lt,Tt)|0,E=E+Math.imul(Lt,Re)|0,E=E+Math.imul(Fe,Tt)|0,M=M+Math.imul(Fe,Re)|0,T=T+Math.imul(Dt,Ct)|0,E=E+Math.imul(Dt,Me)|0,E=E+Math.imul(Le,Ct)|0,M=M+Math.imul(Le,Me)|0,T=T+Math.imul(Rt,rt)|0,E=E+Math.imul(Rt,nt)|0,E=E+Math.imul(Be,rt)|0,M=M+Math.imul(Be,nt)|0;var Ki=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,T=Math.imul(ut,St),E=Math.imul(ut,Pe),E=E+Math.imul(_e,St)|0,M=Math.imul(_e,Pe),T=T+Math.imul(at,Tt)|0,E=E+Math.imul(at,Re)|0,E=E+Math.imul(Se,Tt)|0,M=M+Math.imul(Se,Re)|0,T=T+Math.imul(Lt,Ct)|0,E=E+Math.imul(Lt,Me)|0,E=E+Math.imul(Fe,Ct)|0,M=M+Math.imul(Fe,Me)|0,T=T+Math.imul(Dt,rt)|0,E=E+Math.imul(Dt,nt)|0,E=E+Math.imul(Le,rt)|0,M=M+Math.imul(Le,nt)|0;var mc=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(mc>>>26)|0,mc&=67108863,T=Math.imul(ut,Tt),E=Math.imul(ut,Re),E=E+Math.imul(_e,Tt)|0,M=Math.imul(_e,Re),T=T+Math.imul(at,Ct)|0,E=E+Math.imul(at,Me)|0,E=E+Math.imul(Se,Ct)|0,M=M+Math.imul(Se,Me)|0,T=T+Math.imul(Lt,rt)|0,E=E+Math.imul(Lt,nt)|0,E=E+Math.imul(Fe,rt)|0,M=M+Math.imul(Fe,nt)|0;var yc=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(yc>>>26)|0,yc&=67108863,T=Math.imul(ut,Ct),E=Math.imul(ut,Me),E=E+Math.imul(_e,Ct)|0,M=Math.imul(_e,Me),T=T+Math.imul(at,rt)|0,E=E+Math.imul(at,nt)|0,E=E+Math.imul(Se,rt)|0,M=M+Math.imul(Se,nt)|0;var lA=(y+T|0)+((E&8191)<<13)|0;y=(M+(E>>>13)|0)+(lA>>>26)|0,lA&=67108863,T=Math.imul(ut,rt),E=Math.imul(ut,nt),E=E+Math.imul(_e,rt)|0,M=Math.imul(_e,nt);var fA=(y+T|0)+((E&8191)<<13)|0;return y=(M+(E>>>13)|0)+(fA>>>26)|0,fA&=67108863,A[0]=nn,A[1]=sn,A[2]=on,A[3]=an,A[4]=cn,A[5]=un,A[6]=Ui,A[7]=ki,A[8]=Vi,A[9]=Hi,A[10]=Gi,A[11]=zi,A[12]=ji,A[13]=Qi,A[14]=Ki,A[15]=mc,A[16]=yc,A[17]=lA,A[18]=fA,y!==0&&(A[19]=y,m.length++),m};Math.imul||(k=U);function z(l,d,m){m.negative=d.negative^l.negative,m.length=l.length+d.length;for(var w=0,_=0,A=0;A>>26)|0,_+=y>>>26,y&=67108863}m.words[A]=T,w=y,y=_}return w!==0?m.words[A]=w:m.length--,m._strip()}function H(l,d,m){return z(l,d,m)}s.prototype.mulTo=function(l,d){var m,w=this.length+l.length;return this.length===10&&l.length===10?m=k(this,l,d):w<63?m=U(this,l,d):w<1024?m=z(this,l,d):m=H(this,l,d),m},s.prototype.mul=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),this.mulTo(l,d)},s.prototype.mulf=function(l){var d=new s(null);return d.words=new Array(this.length+l.length),H(this,l,d)},s.prototype.imul=function(l){return this.clone().mulTo(l,this)},s.prototype.imuln=function(l){var d=l<0;d&&(l=-l),n(typeof l=="number"),n(l<67108864);for(var m=0,w=0;w>=26,m+=_/67108864|0,m+=A>>>26,this.words[w]=A&67108863}return m!==0&&(this.words[w]=m,this.length++),d?this.ineg():this},s.prototype.muln=function(l){return this.clone().imuln(l)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(l){var d=D(l);if(d.length===0)return new s(1);for(var m=this,w=0;w=0);var d=l%26,m=(l-d)/26,w=67108863>>>26-d<<26-d,_;if(d!==0){var A=0;for(_=0;_>>26-d}A&&(this.words[_]=A,this.length++)}if(m!==0){for(_=this.length-1;_>=0;_--)this.words[_+m]=this.words[_];for(_=0;_=0);var w;d?w=(d-d%26)/26:w=0;var _=l%26,A=Math.min((l-_)/26,this.length),y=67108863^67108863>>>_<<_,T=m;if(w-=A,w=Math.max(0,w),T){for(var E=0;EA)for(this.length-=A,E=0;E=0&&(M!==0||E>=w);E--){var W=this.words[E]|0;this.words[E]=M<<26-_|W>>>_,M=W&y}return T&&M!==0&&(T.words[T.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(l,d,m){return n(this.negative===0),this.iushrn(l,d,m)},s.prototype.shln=function(l){return this.clone().ishln(l)},s.prototype.ushln=function(l){return this.clone().iushln(l)},s.prototype.shrn=function(l){return this.clone().ishrn(l)},s.prototype.ushrn=function(l){return this.clone().iushrn(l)},s.prototype.testn=function(l){n(typeof l=="number"&&l>=0);var d=l%26,m=(l-d)/26,w=1<=0);var d=l%26,m=(l-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(d!==0&&m++,this.length=Math.min(m,this.length),d!==0){var w=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},s.prototype.isubn=function(l){if(n(typeof l=="number"),n(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(T/67108864|0),this.words[_+m]=A&67108863}for(;_>26,this.words[_+m]=A&67108863;if(y===0)return this._strip();for(n(y===-1),y=0,_=0;_>26,this.words[_]=A&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(l,d){var m=this.length-l.length,w=this.clone(),_=l,A=_.words[_.length-1]|0,y=this._countBits(A);m=26-y,m!==0&&(_=_.ushln(m),w.iushln(m),A=_.words[_.length-1]|0);var T=w.length-_.length,E;if(d!=="mod"){E=new s(null),E.length=T+1,E.words=new Array(E.length);for(var M=0;M=0;Y--){var P=(w.words[_.length+Y]|0)*67108864+(w.words[_.length+Y-1]|0);for(P=Math.min(P/A|0,67108863),w._ishlnsubmul(_,P,Y);w.negative!==0;)P--,w.negative=0,w._ishlnsubmul(_,1,Y),w.isZero()||(w.negative^=1);E&&(E.words[Y]=P)}return E&&E._strip(),w._strip(),d!=="div"&&m!==0&&w.iushrn(m),{div:E||null,mod:w}},s.prototype.divmod=function(l,d,m){if(n(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var w,_,A;return this.negative!==0&&l.negative===0?(A=this.neg().divmod(l,d),d!=="mod"&&(w=A.div.neg()),d!=="div"&&(_=A.mod.neg(),m&&_.negative!==0&&_.iadd(l)),{div:w,mod:_}):this.negative===0&&l.negative!==0?(A=this.divmod(l.neg(),d),d!=="mod"&&(w=A.div.neg()),{div:w,mod:A.mod}):this.negative&l.negative?(A=this.neg().divmod(l.neg(),d),d!=="div"&&(_=A.mod.neg(),m&&_.negative!==0&&_.isub(l)),{div:A.div,mod:_}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?d==="div"?{div:this.divn(l.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,d)},s.prototype.div=function(l){return this.divmod(l,"div",!1).div},s.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},s.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},s.prototype.divRound=function(l){var d=this.divmod(l);if(d.mod.isZero())return d.div;var m=d.div.negative!==0?d.mod.isub(l):d.mod,w=l.ushrn(1),_=l.andln(1),A=m.cmp(w);return A<0||_===1&&A===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(l){var d=l<0;d&&(l=-l),n(l<=67108863);for(var m=(1<<26)%l,w=0,_=this.length-1;_>=0;_--)w=(m*w+(this.words[_]|0))%l;return d?-w:w},s.prototype.modn=function(l){return this.modrn(l)},s.prototype.idivn=function(l){var d=l<0;d&&(l=-l),n(l<=67108863);for(var m=0,w=this.length-1;w>=0;w--){var _=(this.words[w]|0)+m*67108864;this.words[w]=_/l|0,m=_%l}return this._strip(),d?this.ineg():this},s.prototype.divn=function(l){return this.clone().idivn(l)},s.prototype.egcd=function(l){n(l.negative===0),n(!l.isZero());var d=this,m=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var w=new s(1),_=new s(0),A=new s(0),y=new s(1),T=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++T;for(var E=m.clone(),M=d.clone();!d.isZero();){for(var W=0,Y=1;!(d.words[0]&Y)&&W<26;++W,Y<<=1);if(W>0)for(d.iushrn(W);W-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(E),_.isub(M)),w.iushrn(1),_.iushrn(1);for(var P=0,G=1;!(m.words[0]&G)&&P<26;++P,G<<=1);if(P>0)for(m.iushrn(P);P-- >0;)(A.isOdd()||y.isOdd())&&(A.iadd(E),y.isub(M)),A.iushrn(1),y.iushrn(1);d.cmp(m)>=0?(d.isub(m),w.isub(A),_.isub(y)):(m.isub(d),A.isub(w),y.isub(_))}return{a:A,b:y,gcd:m.iushln(T)}},s.prototype._invmp=function(l){n(l.negative===0),n(!l.isZero());var d=this,m=l.clone();d.negative!==0?d=d.umod(l):d=d.clone();for(var w=new s(1),_=new s(0),A=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var y=0,T=1;!(d.words[0]&T)&&y<26;++y,T<<=1);if(y>0)for(d.iushrn(y);y-- >0;)w.isOdd()&&w.iadd(A),w.iushrn(1);for(var E=0,M=1;!(m.words[0]&M)&&E<26;++E,M<<=1);if(E>0)for(m.iushrn(E);E-- >0;)_.isOdd()&&_.iadd(A),_.iushrn(1);d.cmp(m)>=0?(d.isub(m),w.isub(_)):(m.isub(d),_.isub(w))}var W;return d.cmpn(1)===0?W=w:W=_,W.cmpn(0)<0&&W.iadd(l),W},s.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var d=this.clone(),m=l.clone();d.negative=0,m.negative=0;for(var w=0;d.isEven()&&m.isEven();w++)d.iushrn(1),m.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;m.isEven();)m.iushrn(1);var _=d.cmp(m);if(_<0){var A=d;d=m,m=A}else if(_===0||m.cmpn(1)===0)break;d.isub(m)}while(!0);return m.iushln(w)},s.prototype.invm=function(l){return this.egcd(l).a.umod(l)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(l){return this.words[0]&l},s.prototype.bincn=function(l){n(typeof l=="number");var d=l%26,m=(l-d)/26,w=1<>>26,y&=67108863,this.words[A]=y}return _!==0&&(this.words[A]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(l){var d=l<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var m;if(this.length>1)m=1;else{d&&(l=-l),n(l<=67108863,"Number is too big");var w=this.words[0]|0;m=w===l?0:wl.length)return 1;if(this.length=0;m--){var w=this.words[m]|0,_=l.words[m]|0;if(w!==_){w<_?d=-1:w>_&&(d=1);break}}return d},s.prototype.gtn=function(l){return this.cmpn(l)===1},s.prototype.gt=function(l){return this.cmp(l)===1},s.prototype.gten=function(l){return this.cmpn(l)>=0},s.prototype.gte=function(l){return this.cmp(l)>=0},s.prototype.ltn=function(l){return this.cmpn(l)===-1},s.prototype.lt=function(l){return this.cmp(l)===-1},s.prototype.lten=function(l){return this.cmpn(l)<=0},s.prototype.lte=function(l){return this.cmp(l)<=0},s.prototype.eqn=function(l){return this.cmpn(l)===0},s.prototype.eq=function(l){return this.cmp(l)===0},s.red=function(l){return new g(l)},s.prototype.toRed=function(l){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(l){return this.red=l,this},s.prototype.forceRed=function(l){return n(!this.red,"Already a number in reduction context"),this._forceRed(l)},s.prototype.redAdd=function(l){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},s.prototype.redIAdd=function(l){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},s.prototype.redSub=function(l){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},s.prototype.redISub=function(l){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},s.prototype.redShl=function(l){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},s.prototype.redMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},s.prototype.redIMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(l){return n(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var F={k256:null,p224:null,p192:null,p25519:null};function V(l,d){this.name=l,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V.prototype._tmp=function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},V.prototype.ireduce=function(l){var d=l,m;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),m=d.bitLength();while(m>this.n);var w=m0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},V.prototype.split=function(l,d){l.iushrn(this.n,0,d)},V.prototype.imulK=function(l){return l.imul(this.k)};function q(){V.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,V),q.prototype.split=function(l,d){for(var m=4194303,w=Math.min(l.length,9),_=0;_>>22,A=y}A>>>=22,l.words[_-10]=A,A===0&&l.length>10?l.length-=10:l.length-=9},q.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var d=0,m=0;m>>=26,l.words[m]=_,d=w}return d!==0&&(l.words[l.length++]=d),l},s._prime=function(l){if(F[l])return F[l];var d;if(l==="k256")d=new q;else if(l==="p224")d=new C;else if(l==="p192")d=new B;else if(l==="p25519")d=new x;else throw new Error("Unknown prime "+l);return F[l]=d,d};function g(l){if(typeof l=="string"){var d=s._prime(l);this.m=d.p,this.prime=d}else n(l.gtn(1),"modulus must be greater than 1"),this.m=l,this.prime=null}g.prototype._verify1=function(l){n(l.negative===0,"red works only with positives"),n(l.red,"red works only with red numbers")},g.prototype._verify2=function(l,d){n((l.negative|d.negative)===0,"red works only with positives"),n(l.red&&l.red===d.red,"red works only with red numbers")},g.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(f(l,l.umod(this.m)._forceRed(this)),l)},g.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},g.prototype.add=function(l,d){this._verify2(l,d);var m=l.add(d);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},g.prototype.iadd=function(l,d){this._verify2(l,d);var m=l.iadd(d);return m.cmp(this.m)>=0&&m.isub(this.m),m},g.prototype.sub=function(l,d){this._verify2(l,d);var m=l.sub(d);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},g.prototype.isub=function(l,d){this._verify2(l,d);var m=l.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},g.prototype.shl=function(l,d){return this._verify1(l),this.imod(l.ushln(d))},g.prototype.imul=function(l,d){return this._verify2(l,d),this.imod(l.imul(d))},g.prototype.mul=function(l,d){return this._verify2(l,d),this.imod(l.mul(d))},g.prototype.isqr=function(l){return this.imul(l,l.clone())},g.prototype.sqr=function(l){return this.mul(l,l)},g.prototype.sqrt=function(l){if(l.isZero())return l.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(l,m)}for(var w=this.m.subn(1),_=0;!w.isZero()&&w.andln(1)===0;)_++,w.iushrn(1);n(!w.isZero());var A=new s(1).toRed(this),y=A.redNeg(),T=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new s(2*E*E).toRed(this);this.pow(E,T).cmp(y)!==0;)E.redIAdd(y);for(var M=this.pow(E,w),W=this.pow(l,w.addn(1).iushrn(1)),Y=this.pow(l,w),P=_;Y.cmp(A)!==0;){for(var G=Y,Q=0;G.cmp(A)!==0;Q++)G=G.redSqr();n(Q=0;_--){for(var M=d.words[_],W=E-1;W>=0;W--){var Y=M>>W&1;if(A!==w[0]&&(A=this.sqr(A)),Y===0&&y===0){T=0;continue}y<<=1,y|=Y,T++,!(T!==m&&(_!==0||W!==0))&&(A=this.mul(A,w[y]),T=0,y=0)}E=26}return A},g.prototype.convertTo=function(l){var d=l.umod(this.m);return d===l?d.clone():d},g.prototype.convertFrom=function(l){var d=l.clone();return d.red=null,d},s.mont=function(l){return new v(l)};function v(l){g.call(this,l),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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(v,g),v.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},v.prototype.convertFrom=function(l){var d=this.imod(l.mul(this.rinv));return d.red=null,d},v.prototype.imul=function(l,d){if(l.isZero()||d.isZero())return l.words[0]=0,l.length=1,l;var m=l.imul(d),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=m.isub(w).iushrn(this.shift),A=_;return _.cmp(this.m)>=0?A=_.isub(this.m):_.cmpn(0)<0&&(A=_.iadd(this.m)),A._forceRed(this)},v.prototype.mul=function(l,d){if(l.isZero()||d.isZero())return new s(0)._forceRed(this);var m=l.mul(d),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=m.isub(w).iushrn(this.shift),A=_;return _.cmp(this.m)>=0?A=_.isub(this.m):_.cmpn(0)<0&&(A=_.iadd(this.m)),A._forceRed(this)},v.prototype.invm=function(l){var d=this.imod(l._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(t,NU)})(MU);var He=MU.exports,DU="bignumber/5.7.0",sb=He.BN,jo=new lr(DU),GI={},qq=9007199254740991;function nhe(t){return t!=null&&(Zr.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Zn(t)||typeof t=="bigint"||nd(t))}var Uq=!1,Zr=class t{constructor(e,r){e!==GI&&jo.throwError("cannot call constructor directly; use BigNumber.from",lr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Hn($e(this).fromTwos(e))}toTwos(e){return Hn($e(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return Hn($e(this).add($e(e)))}sub(e){return Hn($e(this).sub($e(e)))}div(e){return t.from(e).isZero()&&Pi("division-by-zero","div"),Hn($e(this).div($e(e)))}mul(e){return Hn($e(this).mul($e(e)))}mod(e){let r=$e(e);return r.isNeg()&&Pi("division-by-zero","mod"),Hn($e(this).umod(r))}pow(e){let r=$e(e);return r.isNeg()&&Pi("negative-power","pow"),Hn($e(this).pow(r))}and(e){let r=$e(e);return(this.isNegative()||r.isNeg())&&Pi("unbound-bitwise-result","and"),Hn($e(this).and(r))}or(e){let r=$e(e);return(this.isNegative()||r.isNeg())&&Pi("unbound-bitwise-result","or"),Hn($e(this).or(r))}xor(e){let r=$e(e);return(this.isNegative()||r.isNeg())&&Pi("unbound-bitwise-result","xor"),Hn($e(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Pi("negative-width","mask"),Hn($e(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Pi("negative-width","shl"),Hn($e(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Pi("negative-width","shr"),Hn($e(this).shrn(e))}eq(e){return $e(this).eq($e(e))}lt(e){return $e(this).lt($e(e))}lte(e){return $e(this).lte($e(e))}gt(e){return $e(this).gt($e(e))}gte(e){return $e(this).gte($e(e))}isNegative(){return this._hex[0]==="-"}isZero(){return $e(this).isZero()}toNumber(){try{return $e(this).toNumber()}catch{Pi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return jo.throwError("this platform does not support BigInt",lr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Uq||(Uq=!0,jo.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?jo.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",lr.errors.UNEXPECTED_ARGUMENT,{}):jo.throwError("BigNumber.toString does not accept parameters",lr.errors.UNEXPECTED_ARGUMENT,{})),$e(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(GI,j0(e)):e.match(/^-?[0-9]+$/)?new t(GI,j0(new sb(e))):jo.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Pi("underflow","BigNumber.from",e),(e>=qq||e<=-qq)&&Pi("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(nd(r))return t.from(En(r));if(r)if(r.toHexString){let n=r.toHexString();if(typeof n=="string")return t.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(Zn(n)||n[0]==="-"&&Zn(n.substring(1))))return t.from(n)}return jo.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function j0(t){if(typeof t!="string")return j0(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&jo.throwArgumentError("invalid hex","value",t),t=j0(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Hn(t){return Zr.from(j0(t))}function $e(t){let e=Zr.from(t).toHexString();return e[0]==="-"?new sb("-"+e.substring(3),16):new sb(e.substring(2),16)}function Pi(t,e,r){let n={fault:t,operation:e};return r!=null&&(n.value=r),jo.throwError(t,lr.errors.NUMERIC_FAULT,n)}function ihe(t){return new sb(t,36).toString(16)}var Sn=new lr(DU),V0={},BU=Zr.from(0),LU=Zr.from(-1);function FU(t,e,r,n){let i={fault:e,operation:r};return n!==void 0&&(i.value=n),Sn.throwError(t,lr.errors.NUMERIC_FAULT,i)}var H0="0";for(;H0.length<256;)H0+=H0;function b8(t){if(typeof t!="number")try{t=Zr.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+H0.substring(0,t):Sn.throwArgumentError("invalid decimal size","decimals",t)}function zI(t,e){e==null&&(e=0);let r=b8(e);t=Zr.from(t);let n=t.lt(BU);n&&(t=t.mul(LU));let i=t.mod(r).toString();for(;i.length2&&Sn.throwArgumentError("too many decimal points","value",t);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&FU("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.lengthe[o]==null?a:(typeof e[o]!==c&&Sn.throwArgumentError("invalid fixed format ("+o+" not "+c+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&Sn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&Sn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(V0,r,n,i)}},ob=class t{constructor(e,r,n,i){e!==V0&&Sn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",lr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Sn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);let r=zo(this._value,this.format.decimals),n=zo(e._value,e.format.decimals);return t.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(kq.toFormat(r.format))),r}ceiling(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(kq.toFormat(r.format))),r}round(e){e==null&&(e=0);let r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&Sn.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;let n=t.from("1"+H0.substring(0,e),this.format),i=she.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Sn.throwArgumentError("invalid byte width","width",e);let r=Zr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return so(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return t.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!nhe(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),t.fromString(zI(e,r),G0.from(n))}static fromString(e,r){r==null&&(r="fixed");let n=G0.from(r),i=zo(e,n.decimals);!n.signed&&i.lt(BU)&&FU("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=so(s,n.width/8));let o=zI(i,n.decimals);return new t(V0,s,o,n)}static fromBytes(e,r){r==null&&(r="fixed");let n=G0.from(r);if(vr(e).length>n.width/8)throw new Error("overflow");let i=Zr.from(e);n.signed&&(i=i.fromTwos(n.width));let s=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=zI(i,n.decimals);return new t(V0,s,o,n)}static from(e,r){if(typeof e=="string")return t.fromString(e,r);if(nd(e))return t.fromBytes(e,r);try{return t.fromValue(e,0,r)}catch(n){if(n.code!==lr.errors.INVALID_ARGUMENT)throw n}return Sn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}},kq=ob.from(1),she=ob.from("0.5"),ohe="strings/5.7.0",qU=new lr(ohe),ab;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(ab||(ab={}));var Xf;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Xf||(Xf={}));function ahe(t,e,r,n,i){return qU.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function UU(t,e,r,n,i){if(t===Xf.BAD_PREFIX||t===Xf.UNEXPECTED_CONTINUE){let s=0;for(let o=e+1;o>6===2;o++)s++;return s}return t===Xf.OVERRUN?r.length-e-1:0}function che(t,e,r,n,i){return t===Xf.OVERLONG?(n.push(i),0):(n.push(65533),UU(t,e,r))}Object.freeze({error:ahe,ignore:UU,replace:che});function jI(t,e=ab.current){e!=ab.current&&(qU.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;let s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return vr(r)}function uhe(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function Vq(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}Vq("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),QI("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),QI("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),QI("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",uhe),Vq("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");var kU="hash/5.7.0";function lhe(t){t=atob(t);let e=[];for(let r=0;r0&&Array.isArray(c)?i(c,o-1):r.push(c)})};return i(t,e),r}function fhe(t){let e={};for(let r=0;r>--a&1}let p=31,S=Math.pow(2,p),I=S>>>1,N=I>>1,R=S-1,D=0;for(let F=0;F1;){let x=V+q>>>1;F>>1|f(),C=C<<1^I,B=(B^I)<<1|I|1;k=C,z=1+B-C}let H=n-4;return U.map(F=>{switch(F-H){case 3:return H+65792+(t[c++]<<16|t[c++]<<8|t[c++]);case 2:return H+256+(t[c++]<<8|t[c++]);case 1:return H+t[c++];default:return F-1}})}function hhe(t){let e=0;return()=>t[e++]}function phe(t){return hhe(dhe(t))}function ghe(t){return t&1?~t>>1:t>>1}function mhe(t,e){let r=Array(t);for(let n=0;ne[o]):r}function vhe(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(whe(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Ahe(r,t))}return fhe(VU(e))}function bhe(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function HU(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[o].push(s));return n}function whe(t,e){let r=1+e(),n=e(),i=bhe(e),s=HU(i.length,1+t,e);return VU(s.map((o,c)=>{let a=o[0],u=o.slice(1);return Array(i[c]).fill(void 0).map((f,p)=>{let S=p*n;return[a+p*r,u.map(I=>I+S)]})}))}function Ahe(t,e){let r=1+e();return HU(r,1+t,e).map(n=>[n[0],n.slice(1)])}function Ehe(t){let e=cb(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=cb(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,f)=>f.set.size-u.set.size);let i=t(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let c=i==1,a=i==2;return{branches:n,valid:s,fe0f:o,save:c,check:a}}}function She(){return phe(lhe("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}var $v=She();new Set(cb($v)),new Set(cb($v)),vhe($v),Ehe($v),new lr(kU);var _he=new Uint8Array(32);_he.fill(0);var The=`Ethereum Signed Message: +`;function GU(t){return typeof t=="string"&&(t=jI(t)),v8(Jde([jI(The),jI(String(t.length)),t]))}var Ihe="rlp/5.7.0";new lr(Ihe);var Che="address/5.7.0",k0=new lr(Che);function Gq(t){Zn(t,20)||k0.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);let n=vr(v8(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}var xhe=9007199254740991;function Nhe(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var w8={};for(let t=0;t<10;t++)w8[String(t)]=String(t);for(let t=0;t<26;t++)w8[String.fromCharCode(65+t)]=String(10+t);var zq=Math.floor(Nhe(xhe));function Ohe(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>w8[n]).join("");for(;e.length>=zq;){let n=e.substring(0,zq);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function Phe(t){let e=null;if(typeof t!="string"&&k0.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Gq(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&k0.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Ohe(t)&&k0.throwArgumentError("bad icap checksum","address",t),e=ihe(t.substring(4));e.length<40;)e="0"+e;e=Gq("0x"+e)}else k0.throwArgumentError("invalid address","address",t);return e}var Rhe="properties/5.7.0";new lr(Rhe);function F0(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new lr(kU);var Mhe=new Uint8Array(32);Mhe.fill(0),Zr.from(-1);var Dhe=Zr.from(0),Bhe=Zr.from(1);Zr.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),so(Bhe.toHexString(),32),so(Dhe.toHexString(),32);var eo={},Ye={},W0=zU;function zU(t,e){if(!t)throw new Error(e||"Assertion failed")}zU.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var i8={exports:{}};typeof Object.create=="function"?i8.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:i8.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var Lhe=W0,Fhe=i8.exports;Ye.inherits=Fhe;function qhe(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function Uhe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):qhe(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Ye.htonl=jU;function Vhe(t,e){for(var r="",n=0;n>>0}return s}Ye.join32=Hhe;function Ghe(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Ye.split32=Ghe;function zhe(t,e){return t>>>e|t<<32-e}Ye.rotr32=zhe;function jhe(t,e){return t<>>32-e}Ye.rotl32=jhe;function Qhe(t,e){return t+e>>>0}Ye.sum32=Qhe;function Khe(t,e,r){return t+e+r>>>0}Ye.sum32_3=Khe;function Whe(t,e,r,n){return t+e+r+n>>>0}Ye.sum32_4=Whe;function $he(t,e,r,n,i){return t+e+r+n+i>>>0}Ye.sum32_5=$he;function Yhe(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,c=(o>>0,t[e+1]=o}Ye.sum64=Yhe;function Jhe(t,e,r,n){var i=e+n>>>0,s=(i>>0}Ye.sum64_hi=Jhe;function Xhe(t,e,r,n){var i=e+n;return i>>>0}Ye.sum64_lo=Xhe;function Zhe(t,e,r,n,i,s,o,c){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}Ye.sum64_4_hi=Zhe;function e0e(t,e,r,n,i,s,o,c){var a=e+n+s+c;return a>>>0}Ye.sum64_4_lo=e0e;function t0e(t,e,r,n,i,s,o,c,a,u){var f=0,p=e;p=p+n>>>0,f+=p>>0,f+=p>>0,f+=p>>0,f+=p>>0}Ye.sum64_5_hi=t0e;function r0e(t,e,r,n,i,s,o,c,a,u){var f=e+n+s+c+u;return f>>>0}Ye.sum64_5_lo=r0e;function n0e(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Ye.rotr64_hi=n0e;function i0e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ye.rotr64_lo=i0e;function s0e(t,e,r){return t>>>r}Ye.shr64_hi=s0e;function o0e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ye.shr64_lo=o0e;var id={},jq=Ye,a0e=W0;function Yv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}id.BlockHash=Yv,Yv.prototype.update=function(t,e){if(t=jq.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=jq.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s>>3}lo.g0_256=d0e;function h0e(t){return oo(t,17)^oo(t,19)^t>>>10}lo.g1_256=h0e;var ed=Ye,p0e=id,g0e=lo,KI=ed.rotl32,q0=ed.sum32,m0e=ed.sum32_5,y0e=g0e.ft_1,JU=p0e.BlockHash,v0e=[1518500249,1859775393,2400959708,3395469782];function ro(){if(!(this instanceof ro))return new ro;JU.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ed.inherits(ro,JU);var b0e=ro;ro.blockSize=512,ro.outSize=160,ro.hmacStrength=80,ro.padLength=64,ro.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=new this.Hash().update(t).digest()),ope(t.length<=this.blockSize);for(var e=t.length;e>8,S=f&255;p?a.push(p,S):a.push(S)}return a}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var c="",a=0;a(S>>1)-1?R=(S>>1)-D:R=D,I.isubn(R)):R=0,p[N]=R,I.iushrn(1)}return p}r.getNAF=n;function i(a,u){var f=[[],[]];a=a.clone(),u=u.clone();for(var p=0,S=0,I;a.cmpn(-p)>0||u.cmpn(-S)>0;){var N=a.andln(3)+p&3,R=u.andln(3)+S&3;N===3&&(N=-1),R===3&&(R=-1);var D;N&1?(I=a.andln(7)+p&7,(I===3||I===5)&&R===2?D=-N:D=N):D=0,f[0].push(D);var U;R&1?(I=u.andln(7)+S&7,(I===3||I===5)&&N===2?U=-R:U=R):U=0,f[1].push(U),2*p===D+1&&(p=1-p),2*S===U+1&&(S=1-S),a.iushrn(1),u.iushrn(1)}return f}r.getJSF=i;function s(a,u,f){var p="_"+u;a.prototype[u]=function(){return this[p]!==void 0?this[p]:this[p]=f.call(this)}}r.cachedProperty=s;function o(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=o;function c(a){return new He(a,"hex","le")}r.intFromLE=c}),Xv=ei.getNAF,upe=ei.getJSF,ub=ei.assert;function ja(t,e){this.type=t,this.p=new He(e.p,16),this.red=e.prime?He.red(e.prime):He.mont(this.p),this.zero=new He(0).toRed(this.red),this.one=new He(1).toRed(this.red),this.two=new He(2).toRed(this.red),this.n=e.n&&new He(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var mu=ja;ja.prototype.point=function(){throw new Error("Not implemented")},ja.prototype.validate=function(){throw new Error("Not implemented")},ja.prototype._fixedNafMul=function(t,e){ub(t.precomputed);var r=t._getDoubles(),n=Xv(e,1,this._bitLength),i=(1<=o;a--)c=(c<<1)+n[a];s.push(c)}for(var u=this.jpoint(null,null,null),f=this.jpoint(null,null,null),p=i;p>0;p--){for(o=0;o=0;c--){for(var a=0;c>=0&&s[c]===0;c--)a++;if(c>=0&&a++,o=o.dblp(a),c<0)break;var u=s[c];ub(u!==0),t.type==="affine"?u>0?o=o.mixedAdd(i[u-1>>1]):o=o.mixedAdd(i[-u-1>>1].neg()):u>0?o=o.add(i[u-1>>1]):o=o.add(i[-u-1>>1].neg())}return t.type==="affine"?o.toP():o},ja.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,o=this._wnafT2,c=this._wnafT3,a=0,u,f,p;for(u=0;u=1;u-=2){var I=u-1,N=u;if(s[I]!==1||s[N]!==1){c[I]=Xv(r[I],s[I],this._bitLength),c[N]=Xv(r[N],s[N],this._bitLength),a=Math.max(c[I].length,a),a=Math.max(c[N].length,a);continue}var R=[e[I],null,null,e[N]];e[I].y.cmp(e[N].y)===0?(R[1]=e[I].add(e[N]),R[2]=e[I].toJ().mixedAdd(e[N].neg())):e[I].y.cmp(e[N].y.redNeg())===0?(R[1]=e[I].toJ().mixedAdd(e[N]),R[2]=e[I].add(e[N].neg())):(R[1]=e[I].toJ().mixedAdd(e[N]),R[2]=e[I].toJ().mixedAdd(e[N].neg()));var D=[-3,-1,-5,-7,0,7,5,1,3],U=upe(r[I],r[N]);for(a=Math.max(U[0].length,a),c[I]=new Array(a),c[N]=new Array(a),f=0;f=0;u--){for(var V=0;u>=0;){var q=!0;for(f=0;f=0&&V++,H=H.dblp(V),u<0)break;for(f=0;f0?p=o[f][C-1>>1]:C<0&&(p=o[f][-C-1>>1].neg()),p.type==="affine"?H=H.mixedAdd(p):H=H.add(p))}}for(u=0;u=Math.ceil((t.bitLength()+1)/e.step):!1},Ri.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(S=a,I=u),f.negative&&(f=f.neg(),p=p.neg()),S.negative&&(S=S.neg(),I=I.neg()),[{a:f,b:p},{a:S,b:I}]},Di.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),c=s.mul(n.a),a=i.mul(r.b),u=s.mul(n.b),f=t.sub(o).sub(c),p=a.add(u).neg();return{k1:f,k2:p}},Di.prototype.pointFromX=function(t,e){t=new He(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Di.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Di.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},jr.prototype.isInfinity=function(){return this.inf},jr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},jr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},jr.prototype.getX=function(){return this.x.fromRed()},jr.prototype.getY=function(){return this.y.fromRed()},jr.prototype.mul=function(t){return t=new He(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},jr.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},jr.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},jr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},jr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},jr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Xr(t,e,r,n){mu.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new He(0)):(this.x=new He(e,16),this.y=new He(r,16),this.z=new He(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}E8(Xr,mu.BasePoint),Di.prototype.jpoint=function(t,e,r){return new Xr(this,t,e,r)},Xr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Xr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Xr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),c=n.redSub(i),a=s.redSub(o);if(c.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=c.redSqr(),f=u.redMul(c),p=n.redMul(u),S=a.redSqr().redIAdd(f).redISub(p).redISub(p),I=a.redMul(p.redISub(S)).redISub(s.redMul(f)),N=this.z.redMul(t.z).redMul(c);return this.curve.jpoint(S,I,N)},Xr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),c=i.redSub(s);if(o.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var a=o.redSqr(),u=a.redMul(o),f=r.redMul(a),p=c.redSqr().redIAdd(u).redISub(f).redISub(f),S=c.redMul(f.redISub(p)).redISub(i.redMul(u)),I=this.z.redMul(o);return this.curve.jpoint(p,S,I)},Xr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Xr.prototype.inspect=function(){return this.isInfinity()?"":""},Xr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var tb=od(function(t,e){var r=e;r.base=mu,r.short=fpe,r.mont=null,r.edwards=null}),rb=od(function(t,e){var r=e,n=ei.assert;function i(c){c.type==="short"?this.curve=new tb.short(c):c.type==="edwards"?this.curve=new tb.edwards(c):this.curve=new tb.mont(c),this.g=this.curve.g,this.n=this.curve.n,this.hash=c.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(c,a){Object.defineProperty(r,c,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,c,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:eo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:eo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:eo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:eo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:eo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:eo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:eo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:eo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Qa(t){if(!(this instanceof Qa))return new Qa(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ds.toArray(t.entropy,t.entropyEnc||"hex"),r=ds.toArray(t.nonce,t.nonceEnc||"hex"),n=ds.toArray(t.pers,t.persEnc||"hex");A8(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var $q=Qa;Qa.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Qa.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=ds.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var dpe=ei.assert;function pb(t,e){if(t instanceof pb)return t;this._importDER(t,e)||(dpe(t.r&&t.s,"Signature without r or s"),this.r=new He(t.r,16),this.s=new He(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Zv=pb;function hpe(){this.place=0}function XI(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function Yq(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}pb.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=Yq(e),r=Yq(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];ZI(n,e.length),n=n.concat(e),n.push(2),ZI(n,r.length);var i=n.concat(r),s=[48];return ZI(s,i.length),s=s.concat(i),ei.encode(s,t)};var ppe=function(){throw new Error("unsupported")},uk=ei.assert;function Mi(t){if(!(this instanceof Mi))return new Mi(t);typeof t=="string"&&(uk(Object.prototype.hasOwnProperty.call(rb,t),"Unknown curve "+t),t=rb[t]),t instanceof rb.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gpe=Mi;Mi.prototype.keyPair=function(t){return new JI(this,t)},Mi.prototype.keyFromPrivate=function(t,e){return JI.fromPrivate(this,t,e)},Mi.prototype.keyFromPublic=function(t,e){return JI.fromPublic(this,t,e)},Mi.prototype.genKeyPair=function(t){t||(t={});for(var e=new $q({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||ppe(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new He(2));;){var i=new He(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Mi.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Mi.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new He(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),o=t.toArray("be",i),c=new $q({hash:this.hash,entropy:s,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),a=this.n.sub(new He(1)),u=0;;u++){var f=n.k?n.k(u):new He(c.generate(this.n.byteLength()));if(f=this._truncateToN(f,!0),!(f.cmpn(1)<=0||f.cmp(a)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var S=p.getX(),I=S.umod(this.n);if(I.cmpn(0)!==0){var N=f.invm(this.n).mul(I.mul(e.getPrivate()).iadd(t));if(N=N.umod(this.n),N.cmpn(0)!==0){var R=(p.getY().isOdd()?1:0)|(S.cmp(I)!==0?2:0);return n.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),R^=1),new Zv({r:I,s:N,recoveryParam:R})}}}}}},Mi.prototype.verify=function(t,e,r,n){t=this._truncateToN(new He(t,16)),r=this.keyFromPublic(r,n),e=new Zv(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o=s.invm(this.n),c=o.mul(t).umod(this.n),a=o.mul(i).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(c,r.getPublic(),a),u.isInfinity()?!1:u.eqXToP(i)):(u=this.g.mulAdd(c,r.getPublic(),a),u.isInfinity()?!1:u.getX().umod(this.n).cmp(i)===0)},Mi.prototype.recoverPubKey=function(t,e,r,n){uk((3&r)===r,"The recovery param is more than two bits"),e=new Zv(e,n);var i=this.n,s=new He(t),o=e.r,c=e.s,a=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),a):o=this.curve.pointFromX(o,a);var f=e.r.invm(i),p=i.sub(s).mul(f).umod(i),S=c.mul(f).umod(i);return this.g.mulAdd(p,o,S)},Mi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Zv(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var mpe=od(function(t,e){var r=e;r.version="6.5.4",r.utils=ei,r.rand=function(){throw new Error("unsupported")},r.curve=tb,r.curves=rb,r.ec=gpe,r.eddsa=null}),ype=mpe.ec,vpe="signing-key/5.7.0",a8=new lr(vpe),e8=null;function io(){return e8||(e8=new ype("secp256k1")),e8}var c8=class{constructor(e){F0(this,"curve","secp256k1"),F0(this,"privateKey",En(e)),Zde(this.privateKey)!==32&&a8.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let r=io().keyFromPrivate(vr(this.privateKey));F0(this,"publicKey","0x"+r.getPublic(!1,"hex")),F0(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),F0(this,"_isSigningKey",!0)}_addPoint(e){let r=io().keyFromPublic(vr(this.publicKey)),n=io().keyFromPublic(vr(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){let r=io().keyFromPrivate(vr(this.privateKey)),n=vr(e);n.length!==32&&a8.throwArgumentError("bad digest length","digest",e);let i=r.sign(n,{canonical:!0});return RU({recoveryParam:i.recoveryParam,r:so("0x"+i.r.toString(16),32),s:so("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let r=io().keyFromPrivate(vr(this.privateKey)),n=io().keyFromPublic(vr(lk(e)));return so("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};function bpe(t,e){let r=RU(e),n={r:vr(r.r),s:vr(r.s)};return"0x"+io().recoverPubKey(vr(t),n,r.recoveryParam).encode("hex",!1)}function lk(t,e){let r=vr(t);if(r.length===32){let n=new c8(r);return e?"0x"+io().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?En(r):"0x"+io().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+io().keyFromPublic(r).getPublic(!0,"hex"):En(r)}return a8.throwArgumentError("invalid public or private key","key","[REDACTED]")}var wpe="transactions/5.7.0";new lr(wpe);var Jq;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Jq||(Jq={}));function Ape(t){let e=lk(t);return Phe(Fq(v8(Fq(e,1)),12))}function Epe(t,e){return Ape(bpe(vr(t),e))}var Spe="https://rpc.walletconnect.org/v1";async function fk(t,e,r,n,i,s){switch(r.t){case"eip191":return dk(t,e,r.s);case"eip1271":return await hk(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function dk(t,e,r){return Epe(GU(e),r).toLowerCase()===t.toLowerCase()}async function hk(t,e,r,n,i,s){try{let o="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",u=r.substring(2),f=GU(e).substring(2),p=o+f+c+a+u,S=await fetch(`${s||Spe}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:_pe(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:p},"latest"]})}),{result:I}=await S.json();return I?I.slice(0,o.length).toLowerCase()===o.toLowerCase():!1}catch(o){return console.error("isValidEip1271Signature: ",o),!1}}function _pe(){return Date.now()+Math.floor(Math.random()*1e3)}var Tpe=Object.defineProperty,Ipe=Object.defineProperties,Cpe=Object.getOwnPropertyDescriptors,Xq=Object.getOwnPropertySymbols,xpe=Object.prototype.hasOwnProperty,Npe=Object.prototype.propertyIsEnumerable,Zq=(t,e,r)=>e in t?Tpe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S8=(t,e)=>{for(var r in e||(e={}))xpe.call(e,r)&&Zq(t,r,e[r]);if(Xq)for(var r of Xq(e))Npe.call(e,r)&&Zq(t,r,e[r]);return t},pk=(t,e)=>Ipe(t,Cpe(e)),Ope="did:pkh:",gb=t=>t?.split(":"),_8=t=>{let e=t&&gb(t);if(e)return t.includes(Ope)?e[3]:e[1]},Ppe=t=>{let e=t&&gb(t);if(e)return e[2]+":"+e[3]},T8=t=>{let e=t&&gb(t);if(e)return e.pop()};async function Rpe(t){let{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=gk(i,i.iss),o=T8(i.iss);return await fk(o,s,n,_8(i.iss),r)}var gk=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=T8(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0,s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,c=`Chain ID: ${_8(e)}`,a=`Nonce: ${t.nonce}`,u=`Issued At: ${t.iat}`,f=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,S=t.requestId?`Request ID: ${t.requestId}`:void 0,I=t.resources?`Resources:${t.resources.map(R=>` +- ${R}`).join("")}`:void 0,N=yb(t.resources);if(N){let R=$a(N);i=x8(i,R)}return[r,n,"",i,"",s,o,c,a,u,f,p,S,I].filter(R=>R!=null).join(` +`)};function Mpe(t,e,r){return r.includes("did:pkh:")||(r=`did:pkh:${r}`),{h:{t:"caip122"},p:{iss:r,domain:t.domain,aud:t.aud,version:t.version,nonce:t.nonce,iat:t.iat,statement:t.statement,requestId:t.requestId,resources:t.resources,nbf:t.nbf,exp:t.exp},s:e}}function Dpe(t){var e;let{authPayload:r,chains:n,methods:i}=t,s=r.statement||"";if(!(n!=null&&n.length))return r;let o=r.chains,c=r8(o,n);if(!(c!=null&&c.length))throw new Error("No supported chains");let a=mk(r.resources);if(!a)return r;uo(a);let u=yk(a,"eip155"),f=r?.resources||[];if(u!=null&&u.length){let p=vk(u),S=r8(p,i);if(!(S!=null&&S.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(p)}, supported: ${JSON.stringify(i)}`);let I=I8("request",S,{chains:c}),N=Ek(a,"eip155",I);f=((e=r?.resources)==null?void 0:e.slice(0,-1))||[],f.push(mb(N))}return pk(S8({},r),{statement:_k(s,yb(f)),chains:c,resources:r!=null&&r.resources||f.length>0?f:void 0})}function mk(t){let e=yb(t);if(e&&C8(e))return $a(e)}function Bpe(t,e){var r;return(r=t?.att)==null?void 0:r.hasOwnProperty(e)}function yk(t,e){var r,n;return(r=t?.att)!=null&&r[e]?Object.keys((n=t?.att)==null?void 0:n[e]):[]}function Lpe(t){return t?.map(e=>Object.keys(e))||[]}function vk(t){return t?.map(e=>{var r;return(r=e.split("/"))==null?void 0:r[1]})||[]}function bk(t){return b.Buffer.from(JSON.stringify(t)).toString("base64")}function wk(t){return JSON.parse(b.Buffer.from(t,"base64").toString("utf-8"))}function uo(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");let e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{let n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{let s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function Ak(t,e,r,n={}){return r?.sort((i,s)=>i.localeCompare(s)),{att:{[t]:I8(e,r,n)}}}function Ek(t,e,r){var n;return t.att[e]=S8({},r),((n=Object.keys(t.att))==null?void 0:n.sort((i,s)=>i.localeCompare(s))).reduce((i,s)=>(i.att[s]=t.att[s],i),{att:{}})}function I8(t,e,r={}){e=e?.sort((i,s)=>i.localeCompare(s));let n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function mb(t){return uo(t),`urn:recap:${bk(t).replace(/=/g,"")}`}function $a(t){let e=wk(t.replace("urn:recap:",""));return uo(e),e}function Fpe(t,e,r){let n=Ak(t,e,r);return mb(n)}function C8(t){return t&&t.includes("urn:recap:")}function qpe(t,e){let r=$a(t),n=$a(e),i=Sk(r,n);return mb(i)}function Sk(t,e){uo(t),uo(e);let r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((c,a)=>c.localeCompare(a)).forEach(c=>{var a,u;n.att[i]=pk(S8({},n.att[i]),{[c]:((a=t.att[i])==null?void 0:a[c])||((u=e.att[i])==null?void 0:u[c])})})}),n}function x8(t="",e){uo(e);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;let n=[],i=0;Object.keys(e.att).forEach(c=>{let a=Object.keys(e.att[c]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));a.sort((p,S)=>p.action.localeCompare(S.action));let u={};a.forEach(p=>{u[p.ability]||(u[p.ability]=[]),u[p.ability].push(p.action)});let f=Object.keys(u).map(p=>(i++,`(${i}) '${p}': '${u[p].join("', '")}' for '${c}'.`));n.push(f.join(", ").replace(".,","."))});let s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function Upe(t){var e;let r=$a(t);uo(r);let n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function kpe(t){let e=$a(t);uo(e);let r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function _k(t,e){if(!e)return t;let r=$a(e);return uo(r),x8(t,r)}function yb(t){if(!t)return;let e=t?.[t.length-1];return C8(e)?e:void 0}var N8="base10",Tn="base16",O8="base64pad",Vpe="base64url",ad="utf8",P8=0,cd=1,$0=2,Hpe=0,eU=1,z0=12,R8=32;function Gpe(){let t=uU.generateKeyPair();return{privateKey:Yt.toString(t.secretKey,Tn),publicKey:Yt.toString(t.publicKey,Tn)}}function zpe(){let t=lb.randomBytes(R8);return Yt.toString(t,Tn)}function jpe(t,e){let r=uU.sharedKey(Yt.fromString(t,Tn),Yt.fromString(e,Tn),!0),n=new sde.HKDF(fb.SHA256,r).expand(R8);return Yt.toString(n,Tn)}function Qpe(t){let e=fb.hash(Yt.fromString(t,Tn));return Yt.toString(e,Tn)}function Kpe(t){let e=fb.hash(Yt.fromString(t,ad));return Yt.toString(e,Tn)}function M8(t){return Yt.fromString(`${t}`,N8)}function hu(t){return Number(Yt.toString(t,N8))}function Wpe(t){let e=M8(typeof t.type<"u"?t.type:P8);if(hu(e)===cd&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?Yt.fromString(t.senderPublicKey,Tn):void 0,n=typeof t.iv<"u"?Yt.fromString(t.iv,Tn):lb.randomBytes(z0),i=new aU.ChaCha20Poly1305(Yt.fromString(t.symKey,Tn)).seal(n,Yt.fromString(t.message,ad));return D8({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function $pe(t,e){let r=M8($0),n=lb.randomBytes(z0),i=Yt.fromString(t,ad);return D8({type:r,sealed:i,iv:n,encoding:e})}function Ype(t){let e=new aU.ChaCha20Poly1305(Yt.fromString(t.symKey,Tn)),{sealed:r,iv:n}=vb({encoded:t.encoded,encoding:t?.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Yt.toString(i,ad)}function Jpe(t,e){let{sealed:r}=vb({encoded:t,encoding:e});return Yt.toString(r,ad)}function D8(t){let{encoding:e=O8}=t;if(hu(t.type)===$0)return Yt.toString(Yt.concat([t.type,t.sealed]),e);if(hu(t.type)===cd){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Yt.toString(Yt.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Yt.toString(Yt.concat([t.type,t.iv,t.sealed]),e)}function vb(t){let{encoded:e,encoding:r=O8}=t,n=Yt.fromString(e,r),i=n.slice(Hpe,eU),s=eU;if(hu(i)===cd){let u=s+R8,f=u+z0,p=n.slice(s,u),S=n.slice(u,f),I=n.slice(f);return{type:i,sealed:I,iv:S,senderPublicKey:p}}if(hu(i)===$0){let u=n.slice(s),f=lb.randomBytes(z0);return{type:i,sealed:u,iv:f}}let o=s+z0,c=n.slice(s,o),a=n.slice(o);return{type:i,sealed:a,iv:c}}function Xpe(t,e){let r=vb({encoded:t,encoding:e?.encoding});return Tk({type:hu(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Yt.toString(r.senderPublicKey,Tn):void 0,receiverPublicKey:e?.receiverPublicKey})}function Tk(t){let e=t?.type||P8;if(e===cd){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Zpe(t){return t.type===cd&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function ege(t){return t.type===$0}function Ik(t){return new ade.ec("p256").keyFromPublic({x:b.Buffer.from(t.x,"base64").toString("hex"),y:b.Buffer.from(t.y,"base64").toString("hex")},"hex")}function tge(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function rge(t){return b.Buffer.from(tge(t),"base64")}function nge(t,e){let[r,n,i]=t.split("."),s=rge(i);if(s.length!==64)throw new Error("Invalid signature length");let o=s.slice(0,32).toString("hex"),c=s.slice(32,64).toString("hex"),a=`${r}.${n}`,u=new fb.SHA256().update(b.Buffer.from(a)).digest(),f=Ik(e),p=b.Buffer.from(u).toString("hex");if(!f.verify(p,{r:o,s:c}))throw new Error("Invalid signature");return cde.decodeJWT(t).payload}var Ck="irn";function ige(t){return t?.relay||{protocol:Ck}}function sge(t){let e=ude.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var oge=Object.defineProperty,age=Object.defineProperties,cge=Object.getOwnPropertyDescriptors,tU=Object.getOwnPropertySymbols,uge=Object.prototype.hasOwnProperty,lge=Object.prototype.propertyIsEnumerable,rU=(t,e,r)=>e in t?oge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nU=(t,e)=>{for(var r in e||(e={}))uge.call(e,r)&&rU(t,r,e[r]);if(tU)for(var r of tU(e))lge.call(e,r)&&rU(t,r,e[r]);return t},fge=(t,e)=>age(t,cge(e));function xk(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function dge(t){if(!t.includes("wc:")){let a=y8(t);a!=null&&a.includes("wc:")&&(t=a)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=nb.parse(s),c=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:Nk(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:xk(o),methods:c,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function Nk(t){return t.startsWith("//")?t.substring(2):t}function Ok(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function hge(t){return`${t.protocol}:${t.topic}@${t.version}?`+nb.stringify(nU(fge(nU({symKey:t.symKey},Ok(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function pge(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}var gge=Object.defineProperty,mge=Object.defineProperties,yge=Object.getOwnPropertyDescriptors,iU=Object.getOwnPropertySymbols,vge=Object.prototype.hasOwnProperty,bge=Object.prototype.propertyIsEnumerable,sU=(t,e,r)=>e in t?gge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wge=(t,e)=>{for(var r in e||(e={}))vge.call(e,r)&&sU(t,r,e[r]);if(iU)for(var r of iU(e))bge.call(e,r)&&sU(t,r,e[r]);return t},Age=(t,e)=>mge(t,yge(e));function yu(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function Pk(t){let e=[];return Object.values(t).forEach(r=>{e.push(...yu(r.accounts))}),e}function Rk(t,e){let r=[];return Object.values(t).forEach(n=>{yu(n.accounts).includes(e)&&r.push(...n.methods)}),r}function Mk(t,e){let r=[];return Object.values(t).forEach(n=>{yu(n.accounts).includes(e)&&r.push(...n.events)}),r}function Ege(t,e){let r=zk(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function Sge(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=u8(e),s=u8(r),o={};Object.keys(n).forEach(u=>{let f=n[u].chains,p=n[u].methods,S=n[u].events,I=n[u].accounts;f.forEach(N=>{if(!I.some(R=>R.includes(N)))throw new Error(`No accounts provided for chain ${N} in namespace ${u}`)}),o[u]={chains:f,methods:p,events:S,accounts:I}});let c=Qk(e,o,"approve()");if(c)throw new Error(c.message);let a={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(u=>{let f=n[u].chains.filter(N=>{var R,D;return(D=(R=i[u])==null?void 0:R.chains)==null?void 0:D.includes(N)}),p=n[u].methods.filter(N=>{var R,D;return(D=(R=i[u])==null?void 0:R.methods)==null?void 0:D.includes(N)}),S=n[u].events.filter(N=>{var R,D;return(D=(R=i[u])==null?void 0:R.events)==null?void 0:D.includes(N)}),I=f.map(N=>n[u].accounts.filter(R=>R.includes(`${N}:`))).flat();a[u]={chains:f,methods:p,events:S,accounts:I}}),Object.keys(s).forEach(u=>{var f,p,S,I,N,R;if(!n[u])return;let D=(p=(f=s[u])==null?void 0:f.chains)==null?void 0:p.filter(H=>n[u].chains.includes(H)),U=n[u].methods.filter(H=>{var F,V;return(V=(F=s[u])==null?void 0:F.methods)==null?void 0:V.includes(H)}),k=n[u].events.filter(H=>{var F,V;return(V=(F=s[u])==null?void 0:F.events)==null?void 0:V.includes(H)}),z=D?.map(H=>n[u].accounts.filter(F=>F.includes(`${H}:`))).flat();a[u]={chains:$o((S=a[u])==null?void 0:S.chains,D),methods:$o((I=a[u])==null?void 0:I.methods,U),events:$o((N=a[u])==null?void 0:N.events,k),accounts:$o((R=a[u])==null?void 0:R.accounts,z)}}),a)}function B8(t){return t.includes(":")}function Dk(t){return B8(t)?t.split(":")[0]:t}function u8(t){var e,r,n;let i={};if(!bb(t))return i;for(let[s,o]of Object.entries(t)){let c=B8(s)?[s]:o.chains,a=o.methods||[],u=o.events||[],f=Dk(s);i[f]=Age(wge({},i[f]),{chains:$o(c,(e=i[f])==null?void 0:e.chains),methods:$o(a,(r=i[f])==null?void 0:r.methods),events:$o(u,(n=i[f])==null?void 0:n.events)})}return i}function Bk(t){let e={};return t?.forEach(r=>{let[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function _ge(t,e){e=e.map(n=>n.replace("did:pkh:",""));let r=Bk(e);for(let[n,i]of Object.entries(r))i.methods?i.methods=$o(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}var Lk={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}},Fk={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 Wo(t,e){let{message:r,code:n}=Fk[t];return{message:e?`${r} ${e}`:r,code:n}}function pu(t,e){let{message:r,code:n}=Lk[t];return{message:e?`${r} ${e}`:r,code:n}}function Y0(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function bb(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Wa(t){return typeof t>"u"}function ti(t,e){return e&&Wa(t)?!0:typeof t=="string"&&!!t.trim().length}function wb(t,e){return e&&Wa(t)?!0:typeof t=="number"&&!isNaN(t)}function Tge(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ka(i,n)?(n.forEach(o=>{let{accounts:c,methods:a,events:u}=t.namespaces[o],f=yu(c),p=r[o];(!Ka(hb(o,p),f)||!Ka(p.methods,a)||!Ka(p.events,u))&&(s=!1)}),s):!1}function Q0(t){return ti(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function qk(t){if(ti(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Q0(r)}}return!1}function Ige(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(ti(t,!1)){if(e(t))return!0;let r=y8(t);return e(r)}}catch{}return!1}function Cge(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function xge(t){return t?.topic}function Nge(t,e){let r=null;return ti(t?.publicKey,!1)||(r=Wo("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function l8(t){let e=!0;return Y0(t)?t.length&&(e=t.every(r=>ti(r,!1))):e=!1,e}function Uk(t,e,r){let n=null;return Y0(e)&&e.length?e.forEach(i=>{n||Q0(i)||(n=pu("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Q0(t)||(n=pu("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function kk(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=Uk(i,hb(i,s),`${e} ${r}`);o&&(n=o)}),n}function Vk(t,e){let r=null;return Y0(t)?t.forEach(n=>{r||qk(n)||(r=pu("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=pu("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Hk(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Vk(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function Gk(t,e){let r=null;return l8(t?.methods)?l8(t?.events)||(r=pu("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=pu("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function L8(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Gk(n,`${e}, namespace`);i&&(r=i)}),r}function Oge(t,e,r){let n=null;if(t&&bb(t)){let i=L8(t,e);i&&(n=i);let s=kk(t,e,r);s&&(n=s)}else n=Wo("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function zk(t,e){let r=null;if(t&&bb(t)){let n=L8(t,e);n&&(r=n);let i=Hk(t,e);i&&(r=i)}else r=Wo("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function jk(t){return ti(t.protocol,!0)}function Pge(t,e){let r=!1;return e&&!t?r=!0:t&&Y0(t)&&t.length&&t.forEach(n=>{r=jk(n)}),r}function Rge(t){return typeof t=="number"}function Mge(t){return typeof t<"u"&&typeof t!==null}function Dge(t){return!(!t||typeof t!="object"||!t.code||!wb(t.code,!1)||!t.message||!ti(t.message,!1))}function Bge(t){return!(Wa(t)||!ti(t.method,!1))}function Lge(t){return!(Wa(t)||Wa(t.result)&&Wa(t.error)||!wb(t.id,!1)||!ti(t.jsonrpc,!1))}function Fge(t){return!(Wa(t)||!ti(t.name,!1))}function qge(t,e){return!(!Q0(e)||!Pk(t).includes(e))}function Uge(t,e,r){return ti(r,!1)?Rk(t,e).includes(r):!1}function kge(t,e,r){return ti(r,!1)?Mk(t,e).includes(r):!1}function Qk(t,e,r){let n=null,i=Vge(t),s=Hge(e),o=Object.keys(i),c=Object.keys(s),a=oU(Object.keys(t)),u=oU(Object.keys(e)),f=a.filter(p=>!u.includes(p));return f.length&&(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Vo(o,u)||(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),Ka(o,c)||(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${u.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let w=tu(e[d].accounts);w.includes(d)||(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} - Required: ${d} - Approved: ${w.toString()}`))}),o.forEach(d=>{n||(Vo(i[d].methods,s[d].methods)?Vo(i[d].events,s[d].events)||(n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=$s("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Cse(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function YM(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Nse(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:tu(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function xse(t,e){return fy(t,!1)&&t<=e.max&&t>=e.min}function Ose(){let t=Za();return new Promise(e=>{switch(t){case zr.browser:e(L5());break;case zr.reactNative:e(F5());break;case zr.node:e(U5());break;default:e(!0)}})}function L5(){return Vh()&&navigator?.onLine}async function F5(){return ul()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function U5(){return!0}function Dse(t){switch(Za()){case zr.browser:q5(t);break;case zr.reactNative:V5(t);break;case zr.node:break}}function q5(t){!ul()&&Vh()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function V5(t){ul()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var T_={},F_=class{static get(e){return T_[e]}static set(e,r){T_[e]=r}static delete(e){delete T_[e]}};K.BASE10=tT,K.BASE16=Qr,K.BASE64=ry,K.COLON=pte,K.DEFAULT_DEPTH=k_,K.EMPTY_SPACE=Ym,K.ENV_MAP=zr,K.INTERNAL_ERRORS=T5,K.MemoryStore=F_,K.ONE_THOUSAND=mte,K.REACT_NATIVE_PRODUCT=a4,K.RELAYER_DEFAULT_PROTOCOL=m5,K.SDK_ERRORS=_5,K.SDK_TYPE=c4,K.SLASH=u4,K.TYPE_0=rT,K.TYPE_1=dl,K.UTF8=cy,K.addResourceToRecap=l5,K.appendToQueryString=l4,K.assertType=bte,K.assignAbilityToActions=X_,K.base64Decode=u5,K.base64Encode=a5,K.buildApprovedNamespaces=cse,K.buildAuthObject=Cie,K.buildNamespacesFromAuth=lse,K.buildRecapStatement=h5,K.calcExpiry=Bte,K.capitalize=Nte,K.capitalizeWord=m4,K.createDelayedPromise=xte,K.createEncodedRecap=Die,K.createExpiringPromise=Ote,K.createRecap=c5,K.decodeRecap=Ho,K.decodeTypeByte=Hh,K.decrypt=Hie,K.deriveSymKey=Uie,K.deserialize=iT,K.encodeRecap=ay,K.encodeTypeByte=d5,K.encrypt=kie,K.engineEvent=Lte,K.enumify=Cte,K.formatAccountId=n4,K.formatAccountWithChain=ate,K.formatChainId=r4,K.formatExpirerTarget=G_,K.formatIdTarget=Pte,K.formatMessage=n5,K.formatMessageContext=Ste,K.formatRelayParams=v5,K.formatRelayRpcUrl=Ate,K.formatStatementFromRecap=eT,K.formatTopicTarget=Dte,K.formatUA=d4,K.formatUri=ese,K.generateKeyPair=Lie,K.generateRandomBytes32=Fie,K.getAccountsChains=tu,K.getAccountsFromNamespaces=cte,K.getAddressFromAccount=i4,K.getAddressesFromAccounts=ute,K.getAppMetadata=wte,K.getBrowserOnlineStatus=L5,K.getBundleId=yte,K.getChainFromAccount=s4,K.getChainsFromAccounts=o4,K.getChainsFromNamespace=iy,K.getChainsFromNamespaces=lte,K.getChainsFromRecap=Bie,K.getChainsFromRequiredNamespaces=fte,K.getCommonValuesInArrays=C_,K.getDecodedRecapFromResources=i5,K.getDeepLink=Ute,K.getDidAddress=J_,K.getDidAddressSegments=oy,K.getDidChainId=Y_,K.getEnvironment=Za,K.getHttpUrl=Ete,K.getInternalError=$s,K.getJavascriptID=h4,K.getJavascriptOS=f4,K.getLastItems=p4,K.getMethodsFromRecap=Rie,K.getNamespacedDidChainId=_ie,K.getNamespacesChains=A5,K.getNamespacesEventsForChainId=b5,K.getNamespacesFromAccounts=I5,K.getNamespacesMethodsForChainId=E5,K.getNodeOnlineStatus=U5,K.getReCapActions=o5,K.getReactNativeOnlineStatus=F5,K.getRecapAbilitiesFromResource=Oie,K.getRecapFromResources=uy,K.getRecapResource=s5,K.getRelayClientMetadata=vte,K.getRelayProtocolApi=Qie,K.getRelayProtocolName=zie,K.getRequiredNamespacesFromNamespaces=use,K.getSdkError=Xa,K.getUniqueValues=V_,K.handleDeeplinkRedirect=Fte,K.hasOverlap=Vo,K.hashKey=qie,K.hashMessage=Vie,K.isBrowser=Vh,K.isCaipNamespace=sT,K.isConformingNamespaces=M5,K.isExpired=Mte,K.isNode=H_,K.isOnline=Ose,K.isProposalStruct=dse,K.isReactNative=ul,K.isRecap=Z_,K.isSessionCompatible=fse,K.isSessionStruct=gse,K.isTypeOneEnvelope=jie,K.isUndefined=ko,K.isValidAccountId=C5,K.isValidAccounts=O5,K.isValidActions=P5,K.isValidArray=Gh,K.isValidChainId=qh,K.isValidChains=N5,K.isValidController=pse,K.isValidEip1271Signature=t5,K.isValidEip191Signature=e5,K.isValidErrorReason=Ase,K.isValidEvent=Sse,K.isValidId=wse,K.isValidNamespaceAccounts=D5,K.isValidNamespaceActions=oT,K.isValidNamespaceChains=x5,K.isValidNamespaceMethodsOrEvents=L_,K.isValidNamespaces=R5,K.isValidNamespacesChainId=Ise,K.isValidNamespacesEvent=Tse,K.isValidNamespacesRequest=_se,K.isValidNumber=fy,K.isValidObject=ly,K.isValidParams=vse,K.isValidRecap=ps,K.isValidRelay=B5,K.isValidRelays=yse,K.isValidRequest=Ese,K.isValidRequestExpiry=xse,K.isValidRequiredNamespaces=mse,K.isValidResponse=bse,K.isValidString=yn,K.isValidUrl=hse,K.mapEntries=Tte,K.mapToObj=Ite,K.mergeArrays=Ys,K.mergeEncodedRecaps=Pie,K.mergeRecaps=f5,K.normalizeNamespaces=M_,K.objToMap=_te,K.parseAccountId=q_,K.parseChainId=t4,K.parseContextNames=g4,K.parseExpirerTarget=Rte,K.parseNamespaceKey=S5,K.parseRelayParams=y5,K.parseTopic=w5,K.parseUri=Zie,K.populateAuthPayload=Nie,K.recapHasResource=xie,K.serialize=g5,K.subscribeToBrowserNetworkChange=q5,K.subscribeToNetworkChange=Dse,K.subscribeToReactNativeNetworkChange=V5,K.validateDecoding=Gie,K.validateEncoding=p5,K.validateSignedCacao=Tie,K.verifySignature=Z4});var k5,H5,G5,j5,hy,zh,aT,dy,Go,Qh,gy=de(()=>{h();k5="PARSE_ERROR",H5="INVALID_REQUEST",G5="METHOD_NOT_FOUND",j5="INVALID_PARAMS",hy="INTERNAL_ERROR",zh="SERVER_ERROR",aT=[-32700,-32600,-32601,-32602,-32603],dy=[-32e3,-32099],Go={[k5]:{code:-32700,message:"Parse error"},[H5]:{code:-32600,message:"Invalid Request"},[G5]:{code:-32601,message:"Method not found"},[j5]:{code:-32602,message:"Invalid params"},[hy]:{code:-32603,message:"Internal error"},[zh]:{code:-32e3,message:"Server error"}},Qh=zh});function Pse(t){return t<=dy[0]&&t>=dy[1]}function py(t){return aT.includes(t)}function z5(t){return typeof t=="number"}function my(t){return Object.keys(Go).includes(t)?Go[t]:Go[Qh]}function yy(t){let e=Object.values(Go).find(r=>r.code===t);return e||Go[Qh]}function Rse(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!z5(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(py(t.error.code)){let e=yy(t.error.code);if(e.message!==Go[Qh].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function uT(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var cT=de(()=>{h();gy()});var K5=D(jo=>{"use strict";h();Object.defineProperty(jo,"__esModule",{value:!0});jo.isBrowserCryptoAvailable=jo.getSubtleCrypto=jo.getBrowerCrypto=void 0;function lT(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}jo.getBrowerCrypto=lT;function Q5(){let t=lT();return t.subtle||t.webkitSubtle}jo.getSubtleCrypto=Q5;function Bse(){return!!lT()&&!!Q5()}jo.isBrowserCryptoAvailable=Bse});var Y5=D(zo=>{"use strict";h();Object.defineProperty(zo,"__esModule",{value:!0});zo.isBrowser=zo.isNode=zo.isReactNative=void 0;function W5(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zo.isReactNative=W5;function $5(){return typeof S.default<"u"&&typeof S.default.versions<"u"&&typeof S.default.versions.node<"u"}zo.isNode=$5;function Mse(){return!W5()&&!$5()}zo.isBrowser=Mse});var fT=D(wy=>{"use strict";h();Object.defineProperty(wy,"__esModule",{value:!0});var J5=(Oc(),xe(xc));J5.__exportStar(K5(),wy);J5.__exportStar(Y5(),wy)});var br={};Ot(br,{isNodeJs:()=>Z5});var X5,Z5,eL=de(()=>{h();X5=ge(fT());Tr(br,ge(fT()));Z5=X5.isNode});function hT(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function dT(t=6){return BigInt(hT(t))}function gT(t,e,r){return{id:r||hT(),jsonrpc:"2.0",method:t,params:e}}function Lse(t,e){return{id:t,jsonrpc:"2.0",result:e}}function pT(t,e,r){return{id:t,jsonrpc:"2.0",error:tL(e,r)}}function tL(t,e){return typeof t>"u"?my(hy):(typeof t=="string"&&(t=Object.assign(Object.assign({},my(zh)),{message:t})),typeof e<"u"&&(t.data=e),py(t.code)&&(t=yy(t.code)),t)}var rL=de(()=>{h();cT();gy()});function Fse(t){return t.includes("*")?Ay(t):!/\W/g.test(t)}function vy(t){return t==="*"}function Ay(t){return vy(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function Use(t){return!vy(t)&&Ay(t)&&!t.split("*")[0].trim()}function qse(t){return!vy(t)&&Ay(t)&&!t.split("*")[1].trim()}var nL=de(()=>{h()});var Kh,mT,Ey,Wh,iL=de(()=>{h();Kh=class{},mT=class extends Kh{constructor(e){super()}},Ey=class extends Kh{constructor(){super()}},Wh=class extends Ey{constructor(e){super()}}});var sL=de(()=>{h();iL()});function Hse(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function oL(t,e){let r=Hse(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Gse(t){return oL(t,Vse)}function by(t){return oL(t,kse)}function yT(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var Vse,kse,aL=de(()=>{h();Vse="^https?:",kse="^wss?:"});function wT(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function jse(t){return wT(t)&&"method"in t}function vT(t){return wT(t)&&(uL(t)||Sy(t))}function uL(t){return"result"in t}function Sy(t){return"error"in t}function zse(t){return"error"in t&&t.valid===!1}var cL=de(()=>{h()});var Ur={};Ot(Ur,{DEFAULT_ERROR:()=>Qh,IBaseJsonRpcProvider:()=>Ey,IEvents:()=>Kh,IJsonRpcConnection:()=>mT,IJsonRpcProvider:()=>Wh,INTERNAL_ERROR:()=>hy,INVALID_PARAMS:()=>j5,INVALID_REQUEST:()=>H5,METHOD_NOT_FOUND:()=>G5,PARSE_ERROR:()=>k5,RESERVED_ERROR_CODES:()=>aT,SERVER_ERROR:()=>zh,SERVER_ERROR_CODE_RANGE:()=>dy,STANDARD_ERROR_MAP:()=>Go,formatErrorMessage:()=>tL,formatJsonRpcError:()=>pT,formatJsonRpcRequest:()=>gT,formatJsonRpcResult:()=>Lse,getBigIntRpcId:()=>dT,getError:()=>my,getErrorByCode:()=>yy,isHttpUrl:()=>Gse,isJsonRpcError:()=>Sy,isJsonRpcPayload:()=>wT,isJsonRpcRequest:()=>jse,isJsonRpcResponse:()=>vT,isJsonRpcResult:()=>uL,isJsonRpcValidationInvalid:()=>zse,isLocalhostUrl:()=>yT,isNodeJs:()=>Z5,isReservedErrorCode:()=>py,isServerErrorCode:()=>Pse,isValidDefaultRoute:()=>vy,isValidErrorCode:()=>z5,isValidLeadingWildcardRoute:()=>Use,isValidRoute:()=>Fse,isValidTrailingWildcardRoute:()=>qse,isValidWildcardRoute:()=>Ay,isWsUrl:()=>by,parseConnectionError:()=>uT,payloadId:()=>hT,validateJsonRpcError:()=>Rse});var $h=de(()=>{h();gy();cT();eL();Tr(Ur,br);rL();nL();sL();aL();cL()});var fL={};Ot(fL,{JsonRpcProvider:()=>AT,default:()=>AT});var lL,AT,hL=de(()=>{h();lL=ge(Os());$h();AT=class extends Wh{constructor(e){super(e),this.events=new lL.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(gT(e.method,e.params||[],e.id||dT().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Sy(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),vT(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}});var gL=D((HIe,dL)=>{"use strict";h();dL.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var wL={};Ot(wL,{WsConnection:()=>ET,default:()=>ET});var yL,Qse,Kse,pL,mL,Wse,ET,vL=de(()=>{h();yL=ge(Os());Nc();$h();Qse=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:gL(),Kse=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",pL=t=>t.split("?")[0],mL=10,Wse=Qse(),ET=class{constructor(e){if(this.url=e,this.events=new yL.EventEmitter,this.registering=!1,!by(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Si(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!by(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=new URLSearchParams(e).get("origin"),s=(0,Ur.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!yT(e)},o=new Wse(e,[],s);Kse()?o.onerror=u=>{let a=u;n(this.emitError(a.error))}:o.on("error",u=>{n(this.emitError(u))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Po(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=pT(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return uT(e,pL(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>mL&&this.events.setMaxListeners(mL)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${pL(this.url)}`));return this.events.emit("register_error",r),r}}});var eF=D((Yh,pl)=>{h();var $se=200,PT="__lodash_hash_undefined__",Dy=1,DL=2,PL=9007199254740991,Iy="[object Arguments]",_T="[object Array]",Yse="[object AsyncFunction]",RL="[object Boolean]",BL="[object Date]",ML="[object Error]",LL="[object Function]",Jse="[object GeneratorFunction]",_y="[object Map]",FL="[object Number]",Xse="[object Null]",gl="[object Object]",AL="[object Promise]",Zse="[object Proxy]",UL="[object RegExp]",Ty="[object Set]",qL="[object String]",eoe="[object Symbol]",toe="[object Undefined]",TT="[object WeakMap]",VL="[object ArrayBuffer]",Cy="[object DataView]",roe="[object Float32Array]",noe="[object Float64Array]",ioe="[object Int8Array]",soe="[object Int16Array]",ooe="[object Int32Array]",aoe="[object Uint8Array]",uoe="[object Uint8ClampedArray]",coe="[object Uint16Array]",loe="[object Uint32Array]",foe=/[\\^$.*+?()[\]{}|]/g,hoe=/^\[object .+?Constructor\]$/,doe=/^(?:0|[1-9]\d*)$/,Mt={};Mt[roe]=Mt[noe]=Mt[ioe]=Mt[soe]=Mt[ooe]=Mt[aoe]=Mt[uoe]=Mt[coe]=Mt[loe]=!0;Mt[Iy]=Mt[_T]=Mt[VL]=Mt[RL]=Mt[Cy]=Mt[BL]=Mt[ML]=Mt[LL]=Mt[_y]=Mt[FL]=Mt[gl]=Mt[UL]=Mt[Ty]=Mt[qL]=Mt[TT]=!1;var kL=typeof global=="object"&&global&&global.Object===Object&&global,goe=typeof self=="object"&&self&&self.Object===Object&&self,Js=kL||goe||Function("return this")(),HL=typeof Yh=="object"&&Yh&&!Yh.nodeType&&Yh,EL=HL&&typeof pl=="object"&&pl&&!pl.nodeType&&pl,GL=EL&&EL.exports===HL,bT=GL&&kL.process,bL=function(){try{return bT&&bT.binding&&bT.binding("util")}catch{}}(),SL=bL&&bL.isTypedArray;function poe(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function zoe(t,e){var r=this.__data__,n=Ry(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Xs.prototype.clear=koe;Xs.prototype.delete=Hoe;Xs.prototype.get=Goe;Xs.prototype.has=joe;Xs.prototype.set=zoe;function iu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++eu))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,d=!0,w=r&DL?new xy:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=PL}function XL(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Zh(t){return t!=null&&typeof t=="object"}var ZL=SL?voe(SL):uae;function bae(t){return Aae(t)?iae(t):cae(t)}function Sae(){return[]}function Iae(){return!1}pl.exports=Eae});var RT=D((WIe,tF)=>{h();tF.exports=function(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],o=[],u={},a=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:a,headers:{keys:function(){return s},entries:function(){return o},get:function(f){return u[f.toLowerCase()]},has:function(f){return f.toLowerCase()in u}}}};for(var c in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(f,d,w){s.push(d=d.toLowerCase()),o.push([d,w]),u[d]=u[d]?u[d]+","+w:w}),r(a())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(c,e.headers[c]);i.send(e.body||null)})}});var nF=D((YIe,rF)=>{h();rF.exports=self.fetch||(self.fetch=RT().default||RT())});var cU=D(he=>{"use strict";h();Object.defineProperty(he,"__esModule",{value:!0});var ou=Os(),_ae=(s8(),xe(i8)),nd=(S8(),xe(b8)),wt=(xS(),xe(NS)),ws=WS(),iF=(Nc(),xe(r8)),Tae=(lB(),xe(cB)),ne=jh(),Cae=(n_(),xe(r_)),Oe=Bc(),Nae=(hL(),xe(fL)),un=($h(),xe(Ur)),xae=(vL(),xe(wL)),Oae=eF(),Dae=nF();function id(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function Pae(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var Rae=id(ou),Bae=id(_ae),My=Pae(Tae),Mae=id(xae),Lae=id(Oae),Fae=id(Dae);function Uae(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(Q);V!==U;){for(var k=_[V],H=0,q=Q-1;(k!==0||H>>0,L[q]=k%u>>>0,k=k/u>>>0;if(k!==0)throw new Error("Non-zero carry");P=H,V++}for(var v=Q-P;v!==Q&&L[v]===0;)v++;for(var C=a.repeat(N);v>>0,Q=new Uint8Array(U);_[N];){var L=r[_.charCodeAt(N)];if(L===255)return;for(var k=0,H=U-1;(L!==0||k>>0,Q[H]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");V=k,N++}if(_[N]!==" "){for(var q=U-V;q!==U&&Q[q]===0;)q++;for(var v=new Uint8Array(P+(U-q)),C=P;q!==U;)v[C++]=Q[q++];return v}}}function A(_){var N=w(_);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:w,decode:A}}var qae=Uae,Vae=qae,EF=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},kae=t=>new TextEncoder().encode(t),Hae=t=>new TextDecoder().decode(t),LT=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},FT=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return bF(this,e)}},UT=class{constructor(e){this.decoders=e}or(e){return bF(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},bF=(t,e)=>new UT({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),qT=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new LT(e,r,n),this.decoder=new FT(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Yy=({name:t,prefix:e,encode:r,decode:n})=>new qT(t,e,r,n),sd=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Vae(r,e);return Yy({prefix:t,name:e,encode:n,decode:s=>EF(i(s))})},Gae=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(u-=8,o[c++]=255&a>>u)}if(u>=r||255&a<<8-u)throw new SyntaxError("Unexpected end of data");return o},jae=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&u>>o];if(o&&(s+=e[i&u<Yy({prefix:e,name:t,encode(i){return jae(i,n,r)},decode(i){return Gae(i,n,r,t)}}),zae=Yy({prefix:"\0",name:"identity",encode:t=>Hae(t),decode:t=>kae(t)}),Qae=Object.freeze({__proto__:null,identity:zae}),Kae=xr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Wae=Object.freeze({__proto__:null,base2:Kae}),$ae=xr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Yae=Object.freeze({__proto__:null,base8:$ae}),Jae=sd({prefix:"9",name:"base10",alphabet:"0123456789"}),Xae=Object.freeze({__proto__:null,base10:Jae}),Zae=xr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),eue=xr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),tue=Object.freeze({__proto__:null,base16:Zae,base16upper:eue}),rue=xr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nue=xr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iue=xr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sue=xr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oue=xr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aue=xr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uue=xr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cue=xr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lue=xr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),fue=Object.freeze({__proto__:null,base32:rue,base32upper:nue,base32pad:iue,base32padupper:sue,base32hex:oue,base32hexupper:aue,base32hexpad:uue,base32hexpadupper:cue,base32z:lue}),hue=sd({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),due=sd({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),gue=Object.freeze({__proto__:null,base36:hue,base36upper:due}),pue=sd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mue=sd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yue=Object.freeze({__proto__:null,base58btc:pue,base58flickr:mue}),wue=xr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vue=xr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Aue=xr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Eue=xr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),bue=Object.freeze({__proto__:null,base64:wue,base64pad:vue,base64url:Aue,base64urlpad:Eue}),SF=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}"),Sue=SF.reduce((t,e,r)=>(t[r]=e,t),[]),Iue=SF.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function _ue(t){return t.reduce((e,r)=>(e+=Sue[r],e),"")}function Tue(t){let e=[];for(let r of t){let n=Iue[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Cue=Yy({prefix:"\u{1F680}",name:"base256emoji",encode:_ue,decode:Tue}),Nue=Object.freeze({__proto__:null,base256emoji:Cue}),xue=IF,sF=128,Oue=127,Due=~Oue,Pue=Math.pow(2,31);function IF(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Pue;)e[r++]=t&255|sF,t/=128;for(;t&Due;)e[r++]=t&255|sF,t>>>=7;return e[r]=t|0,IF.bytes=r-n+1,e}var Rue=VT,Bue=128,oF=127;function VT(t,n){var r=0,n=n||0,i=0,s=n,o,u=t.length;do{if(s>=u)throw VT.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&oF)<=Bue);return VT.bytes=s-n,r}var Mue=Math.pow(2,7),Lue=Math.pow(2,14),Fue=Math.pow(2,21),Uue=Math.pow(2,28),que=Math.pow(2,35),Vue=Math.pow(2,42),kue=Math.pow(2,49),Hue=Math.pow(2,56),Gue=Math.pow(2,63),jue=function(t){return t(_F.encode(t,e,r),e),uF=t=>_F.encodingLength(t),kT=(t,e)=>{let r=e.byteLength,n=uF(t),i=n+uF(r),s=new Uint8Array(i+r);return aF(t,s,0),aF(r,s,n),s.set(e,i),new HT(t,r,e,s)},HT=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},TF=({name:t,code:e,encode:r})=>new GT(t,e,r),GT=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?kT(this.code,r):r.then(n=>kT(this.code,n))}else throw Error("Unknown type, must be binary type")}},CF=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Que=TF({name:"sha2-256",code:18,encode:CF("SHA-256")}),Kue=TF({name:"sha2-512",code:19,encode:CF("SHA-512")}),Wue=Object.freeze({__proto__:null,sha256:Que,sha512:Kue}),NF=0,$ue="identity",xF=EF,Yue=t=>kT(NF,xF(t)),Jue={code:NF,name:$ue,encode:xF,digest:Yue},Xue=Object.freeze({__proto__:null,identity:Jue});new TextEncoder,new TextDecoder;var cF={...Qae,...Wae,...Yae,...Xae,...tue,...fue,...gue,...yue,...bue,...Nue};({...Wue,...Xue});function Zue(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function OF(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var lF=OF("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),BT=OF("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Zue(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=wt.generateChildLogger(r,this.name)}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},qy=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=BF,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=My.generateKeyPair(i);return My.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ne.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=My.generateKeyPair(s),u=ne.generateRandomBytes32(),a=MF;return await My.signJWT(u,i,a,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let u=this.getPrivateKey(i),a=ne.deriveSymKey(u,s);return this.setSymKey(a,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ne.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let u=ne.validateEncoding(o),a=iF.safeJsonStringify(s);if(ne.isTypeOneEnvelope(u)){let w=u.senderPublicKey,A=u.receiverPublicKey;i=await this.generateSharedKey(w,A)}let c=this.getSymKey(i),{type:f,senderPublicKey:d}=u;return ne.encrypt({type:f,symKey:c,message:a,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let u=ne.validateDecoding(s,o);if(ne.isTypeOneEnvelope(u)){let a=u.receiverPublicKey,c=u.senderPublicKey;i=await this.generateSharedKey(a,c)}try{let a=this.getSymKey(i),c=ne.decrypt({symKey:a,encoded:s});return iF.safeJsonParse(c)}catch(a){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(a)}},this.getPayloadType=i=>{let s=ne.deserialize(i);return ne.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ne.deserialize(i);return s.senderPublicKey?Cae.toString(s.senderPublicKey,ne.BASE16):void 0},this.core=e,this.logger=wt.generateChildLogger(r,this.name),this.keychain=n||new Uy(this.core,this.logger)}get context(){return wt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(jT)}catch{e=ne.generateRandomBytes32(),await this.keychain.set(jT,e)}return tce(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Vy=class extends ws.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=UF,this.version=qF,this.initialized=!1,this.storagePrefix=Zs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ne.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ne.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=wt.generateChildLogger(e,this.name),this.core=r}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},QT=class extends ws.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new ou.EventEmitter,this.name=kF,this.queue=new Map,this.publishTimeout=Oe.toMiliseconds(Oe.ONE_MINUTE),this.failedPublishTimeout=Oe.toMiliseconds(Oe.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});let u=s?.ttl||VF,a=ne.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,d=s?.id||un.getBigIntRpcId().toString(),w={topic:n,message:i,opts:{ttl:u,relay:a,prompt:c,tag:f,id:d}},A=`Failed to publish payload, please try again. id:${d} tag:${f}`,_=Date.now(),N,P=1;try{for(;N===void 0;){if(Date.now()-_>this.publishTimeout)throw new Error(A);this.logger.trace({id:d,attempts:P},`publisher.publish - attempt ${P}`),N=await await ne.createExpiringPromise(this.rpcPublish(n,i,u,a,c,f,d).catch(V=>this.logger.warn(V)),this.publishTimeout,A),P++,N||await new Promise(V=>setTimeout(V,this.failedPublishTimeout))}this.relayer.events.emit(vn.publish,w),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:d,topic:n,message:i,opts:s}})}catch(V){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(V),(o=s?.internal)!=null&&o.throwOnFailedPublish)throw V;this.queue.set(d,w)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=wt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return wt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,u){var a,c,f,d;let w={method:ne.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:u};return ne.isUndefined((a=w.params)==null?void 0:a.prompt)&&((c=w.params)==null||delete c.prompt),ne.isUndefined((f=w.params)==null?void 0:f.tag)&&((d=w.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:w}),this.relayer.request(w)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(vn.connection_stalled);return}this.checkQueue()}),this.relayer.on(vn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},KT=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},oce=Object.defineProperty,ace=Object.defineProperties,uce=Object.getOwnPropertyDescriptors,fF=Object.getOwnPropertySymbols,cce=Object.prototype.hasOwnProperty,lce=Object.prototype.propertyIsEnumerable,hF=(t,e,r)=>e in t?oce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,td=(t,e)=>{for(var r in e||(e={}))cce.call(e,r)&&hF(t,r,e[r]);if(fF)for(var r of fF(e))lce.call(e,r)&&hF(t,r,e[r]);return t},MT=(t,e)=>ace(t,uce(e)),ky=class extends ws.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new KT,this.events=new ou.EventEmitter,this.name=JF,this.version=XF,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Zs,this.subscribeTimeout=Oe.toMiliseconds(Oe.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ne.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let u=await this.rpcSubscribe(n,s);return typeof u=="string"&&(this.onSubscribe(u,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),u}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;let i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{let u=new Oe.Watch;u.start(i);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),u.stop(i),s(!0)),u.elapsed(i)>=ZF&&(clearInterval(a),u.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=wt.generateChildLogger(r,this.name),this.clientId=""}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ne.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ne.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ne.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ne.createExpiringPromise(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?ne.hashMessage(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(vn.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ne.createExpiringPromise(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(vn.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ne.createExpiringPromise(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(vn.connection_stalled)}return i}rpcUnsubscribe(e,r,n){let i={method:ne.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,MT(td({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,td({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,td({},r)),this.topicMap.set(r.topic,e),this.events.emit(xi.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(xi.deleted,MT(td({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(xi.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ne.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>MT(td({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(xi.created,async e=>{let r=xi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(xi.deleted,async e=>{let r=xi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},fce=Object.defineProperty,dF=Object.getOwnPropertySymbols,hce=Object.prototype.hasOwnProperty,dce=Object.prototype.propertyIsEnumerable,gF=(t,e,r)=>e in t?fce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gce=(t,e)=>{for(var r in e||(e={}))hce.call(e,r)&&gF(t,r,e[r]);if(dF)for(var r of dF(e))dce.call(e,r)&&gF(t,r,e[r]);return t},Hy=class extends ws.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new ou.EventEmitter,this.name=jF,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Oe.toMiliseconds(Oe.THIRTY_SECONDS+Oe.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");let s=r.id||un.getBigIntRpcId().toString();await this.toEstablishConnection();try{let o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");let u=await new Promise(async(a,c)=>{let f=()=>{c(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(wn.disconnect,f);let d=await o;this.provider.off(wn.disconnect,f),a(d)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),u}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(ne.isNode())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(vn.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(vn.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(wn.payload,this.onPayloadHandler),this.provider.on(wn.connect,this.onConnectHandler),this.provider.on(wn.disconnect,this.onDisconnectHandler),this.provider.on(wn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?wt.generateChildLogger(e.logger,this.name):wt.pino(wt.getDefaultLoggerOptions({level:e.logger||GF})),this.messages=new Vy(this.logger,e.core),this.subscriber=new ky(this,this.logger),this.publisher=new QT(this,this.logger),this.relayUrl=e?.relayUrl||$T,this.projectId=e.projectId,this.bundleId=ne.getBundleId(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${zT}...`),await this.restartTransport(zT)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},WF)}get context(){return wt.getLoggerContext(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",s,o=u=>{u.topic===e&&(this.subscriber.off(xi.created,o),s())};return await Promise.all([new Promise(u=>{s=u,this.subscriber.on(xi.created,o)}),new Promise(async u=>{i=await this.subscriber.subscribe(e,r)||i,u()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await ne.createExpiringPromise(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{let i=()=>{this.provider.off(wn.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(wn.disconnect,i),await ne.createExpiringPromise(this.provider.connect(),Oe.toMiliseconds(Oe.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);let n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ne.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}let r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(let n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}startPingTimeout(){var e,r,n,i,s;if(ne.isNode())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Nae.JsonRpcProvider(new Mae.default(ne.formatRelayRpcUrl({sdkVersion:KF,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),un.isJsonRpcRequest(e)){if(!e.method.endsWith(zF))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(gce({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else un.isJsonRpcResponse(e)&&this.events.emit(vn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(vn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=un.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(wn.payload,this.onPayloadHandler),this.provider.off(wn.connect,this.onConnectHandler),this.provider.off(wn.disconnect,this.onDisconnectHandler),this.provider.off(wn.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await ne.isOnline();ne.subscribeToNetworkChange(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(vn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Oe.toMiliseconds(QF))}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}},pce=Object.defineProperty,pF=Object.getOwnPropertySymbols,mce=Object.prototype.hasOwnProperty,yce=Object.prototype.propertyIsEnumerable,mF=(t,e,r)=>e in t?pce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yF=(t,e)=>{for(var r in e||(e={}))mce.call(e,r)&&mF(t,r,e[r]);if(pF)for(var r of pF(e))yce.call(e,r)&&mF(t,r,e[r]);return t},Gy=class extends ws.IStore{constructor(e,r,n,i=Zs,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=$F,this.cached=[],this.initialized=!1,this.storagePrefix=Zs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ne.isUndefined(o)?this.map.set(this.getKey(o),o):ne.isProposalStruct(o)?this.map.set(o.id,o):ne.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,u)=>{this.isInitialized(),this.map.has(o)?await this.update(o,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:u}),this.map.set(o,u),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(u=>Object.keys(o).every(a=>Lae.default(u[a],o[a]))):this.values),this.update=async(o,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:u});let a=yF(yF({},this.getData(o)),u);this.map.set(o,a),await this.persist()},this.delete=async(o,u)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:u}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=wt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},jy=class{constructor(e,r){this.core=e,this.logger=r,this.name=eU,this.version=tU,this.events=new Rae.default,this.initialized=!1,this.storagePrefix=Zs,this.ignoredPayloadTypes=[ne.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();let i=ne.generateRandomBytes32(),s=await this.core.crypto.setSymKey(i),o=ne.calcExpiry(Oe.FIVE_MINUTES),u={protocol:HF},a={topic:s,expiry:o,relay:u,active:!1},c=ne.formatUri({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:u,expiryTimestamp:o,methods:n?.methods});return this.core.expirer.set(s,o),await this.pairings.set(s,a),await this.core.relayer.subscribe(s),{topic:s,uri:c}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o,expiryTimestamp:u,methods:a}=ne.parseUri(n.uri),c;if(this.pairings.keys.includes(i)&&(c=this.pairings.get(i),c.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);let f=u||ne.calcExpiry(Oe.FIVE_MINUTES),d={topic:i,relay:o,expiry:f,active:!1,methods:a};return this.core.expirer.set(i,f),await this.pairings.set(i,d),n.activatePairing&&await this.activate({topic:i}),this.events.emit(rd.create,d),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),d},this.activate=async({topic:n})=>{this.isInitialized();let i=ne.calcExpiry(Oe.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:u,reject:a}=ne.createDelayedPromise();this.events.once(ne.engineEvent("pairing_ping",s),({error:c})=>{c?a(c):u()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ne.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=un.formatJsonRpcRequest(i,s),u=await this.core.crypto.encode(n,o),a=yl[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,u,a),o.id},this.sendResult=async(n,i,s)=>{let o=un.formatJsonRpcResult(n,s),u=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),c=yl[a.request.method].res;await this.core.relayer.publish(i,u,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=un.formatJsonRpcError(n,s),u=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),c=yl[a.request.method]?yl[a.request.method].res:yl.unregistered_method.res;await this.core.relayer.publish(i,u,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ne.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ne.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(rd.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{un.isJsonRpcResult(i)?this.events.emit(ne.engineEvent("pairing_ping",s),{}):un.isJsonRpcError(i)&&this.events.emit(ne.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(rd.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let u=ne.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,u),this.logger.error(u)}catch(u){await this.sendError(s,n,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ne.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!ne.isValidParams(n)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!ne.isValidUrl(n.uri)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}let s=ne.parseUri(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(o)}if(!(s!=null&&s.symKey)){let{message:o}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(o)}if(s!=null&&s.expiryTimestamp&&Oe.toMiliseconds(s?.expiryTimestamp){if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ne.isValidString(n,!1)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ne.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ne.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ne.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=wt.generateChildLogger(r,this.name),this.pairings=new Gy(this.core,this.logger,this.name,this.storagePrefix)}get context(){return wt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(vn.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{un.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):un.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(ei.expired,async e=>{let{topic:r}=ne.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(rd.expire,{topic:r}))})}},zy=class extends ws.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new ou.EventEmitter,this.name=rU,this.version=nU,this.cached=[],this.initialized=!1,this.storagePrefix=Zs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ne.calcExpiry(Oe.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Zn.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=un.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Zn.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Zn.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=wt.generateChildLogger(r,this.name)}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:un.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zn.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Zn.created,e=>{let r=Zn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Zn.updated,e=>{let r=Zn.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Zn.deleted,e=>{let r=Zn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{Oe.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Zn.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Qy=class extends ws.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new ou.EventEmitter,this.name=iU,this.version=sU,this.cached=[],this.initialized=!1,this.storagePrefix=Zs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(ei.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(ei.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=wt.generateChildLogger(r,this.name)}get context(){return wt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ne.formatTopicTarget(e);if(typeof e=="number")return ne.formatIdTarget(e);let{message:r}=ne.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ei.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Oe.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(ei.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(nd.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(ei.created,e=>{let r=ei.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ei.expired,e=>{let r=ei.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ei.deleted,e=>{let r=ei.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ky=class extends ws.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=Ly,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||ne.isReactNative()||!ne.isBrowser())return;let i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Fy;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=this.getVerifyUrl(n?.verifyUrl),s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,Fy)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(Oe.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{let o=document.getElementById(Ly);if(o)return this.iframe=o,this.onInit(),s();window.addEventListener("message",i);let u=document.createElement("iframe");u.id=Ly,u.src=`${this.verifyUrl}/${this.projectId}`,u.style.display="none",document.body.append(u),this.iframe=u,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},Oe.toMiliseconds(Oe.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||wl;return oU.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${wl}`),i=wl),i},this.logger=wt.generateChildLogger(r,this.name),this.verifyUrl=wl,this.abortController=new AbortController,this.isDevEnv=ne.isNode()&&S.default.env.IS_VITEST}get context(){return wt.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Oe.toMiliseconds(e))}},Wy=class extends ws.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=aU,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:u=!1}=n,a=`${uU}/${this.projectId}/clients`;await Fae.default(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:u})})},this.logger=wt.generateChildLogger(r,this.context)}},wce=Object.defineProperty,wF=Object.getOwnPropertySymbols,vce=Object.prototype.hasOwnProperty,Ace=Object.prototype.propertyIsEnumerable,vF=(t,e,r)=>e in t?wce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AF=(t,e)=>{for(var r in e||(e={}))vce.call(e,r)&&vF(t,r,e[r]);if(wF)for(var r of wF(e))Ace.call(e,r)&&vF(t,r,e[r]);return t},$y=class t extends ws.ICore{constructor(e){var r;super(e),this.protocol=WT,this.version=DF,this.name=Jy,this.events=new ou.EventEmitter,this.initialized=!1,this.on=(o,u)=>this.events.on(o,u),this.once=(o,u)=>this.events.once(o,u),this.off=(o,u)=>this.events.off(o,u),this.removeListener=(o,u)=>this.events.removeListener(o,u),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||$T,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let n=wt.getDefaultLoggerOptions({level:typeof e?.logger=="string"&&e.logger?e.logger:PF.logger}),{logger:i,chunkLoggerController:s}=wt.generatePlatformLogger({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,u;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((u=this.logChunkController)==null||u.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=wt.generateChildLogger(i,this.name),this.heartbeat=new nd.HeartBeat,this.crypto=new qy(this,this.logger,e?.keychain),this.history=new zy(this,this.logger),this.expirer=new Qy(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Bae.default(AF(AF({},RF),e?.storageOptions)),this.relayer=new Hy({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new jy(this,this.logger),this.verify=new Ky(this.projectId||"",this.logger),this.echoClient=new Wy(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(YF,n),r}get context(){return wt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}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}}},Ece=$y;he.CORE_CONTEXT=Jy,he.CORE_DEFAULT=PF,he.CORE_PROTOCOL=WT,he.CORE_STORAGE_OPTIONS=RF,he.CORE_STORAGE_PREFIX=Zs,he.CORE_VERSION=DF,he.CRYPTO_CLIENT_SEED=jT,he.CRYPTO_CONTEXT=BF,he.CRYPTO_JWT_TTL=MF,he.Core=Ece,he.Crypto=qy,he.ECHO_CONTEXT=aU,he.ECHO_URL=uU,he.EXPIRER_CONTEXT=iU,he.EXPIRER_DEFAULT_TTL=sce,he.EXPIRER_EVENTS=ei,he.EXPIRER_STORAGE_VERSION=sU,he.EchoClient=Wy,he.Expirer=Qy,he.HISTORY_CONTEXT=rU,he.HISTORY_EVENTS=Zn,he.HISTORY_STORAGE_VERSION=nU,he.JsonRpcHistory=zy,he.KEYCHAIN_CONTEXT=LF,he.KEYCHAIN_STORAGE_VERSION=FF,he.KeyChain=Uy,he.MESSAGES_CONTEXT=UF,he.MESSAGES_STORAGE_VERSION=qF,he.MessageTracker=Vy,he.PAIRING_CONTEXT=eU,he.PAIRING_DEFAULT_TTL=ice,he.PAIRING_EVENTS=rd,he.PAIRING_RPC_OPTS=yl,he.PAIRING_STORAGE_VERSION=tU,he.PENDING_SUB_RESOLUTION_TIMEOUT=ZF,he.PUBLISHER_CONTEXT=kF,he.PUBLISHER_DEFAULT_TTL=VF,he.Pairing=jy,he.RELAYER_CONTEXT=jF,he.RELAYER_DEFAULT_LOGGER=GF,he.RELAYER_DEFAULT_PROTOCOL=HF,he.RELAYER_DEFAULT_RELAY_URL=$T,he.RELAYER_EVENTS=vn,he.RELAYER_FAILOVER_RELAY_URL=zT,he.RELAYER_PROVIDER_EVENTS=wn,he.RELAYER_RECONNECT_TIMEOUT=QF,he.RELAYER_SDK_VERSION=KF,he.RELAYER_STORAGE_OPTIONS=rce,he.RELAYER_SUBSCRIBER_SUFFIX=zF,he.RELAYER_TRANSPORT_CUTOFF=WF,he.Relayer=Hy,he.STORE_STORAGE_VERSION=$F,he.SUBSCRIBER_CONTEXT=JF,he.SUBSCRIBER_DEFAULT_TTL=nce,he.SUBSCRIBER_EVENTS=xi,he.SUBSCRIBER_STORAGE_VERSION=XF,he.Store=Gy,he.Subscriber=ky,he.TRUSTED_VERIFY_URLS=oU,he.VERIFY_CONTEXT=Ly,he.VERIFY_FALLBACK_SERVER=Fy,he.VERIFY_SERVER=wl,he.Verify=Ky,he.WALLETCONNECT_CLIENT_ID=YF,he.default=$y});var _U=D(Be=>{"use strict";h();Object.defineProperty(Be,"__esModule",{value:!0});var cn=cU(),Xy=(xS(),xe(NS)),hU=WS(),G=jh(),dU=Os(),je=Bc(),qe=($h(),xe(Ur));function bce(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var Sce=bce(dU),i2="wc",s2=2,o2="client",n1=`${i2}@${s2}:${o2}:`,Zy={name:o2,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},Ice={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",session_authenticate:"session_authenticate",session_request_expire:"session_request_expire"},_ce={database:":memory:"},YT="WALLETCONNECT_DEEPLINK_CHOICE",Tce={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Cce="history",Nce="0.3",gU="proposal",xce=je.THIRTY_DAYS,pU="Proposal expired",mU="session",uu=je.SEVEN_DAYS,yU="engine",Sr={wc_sessionPropose:{req:{ttl:je.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1104},res:{ttl:je.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1106},res:{ttl:je.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:je.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:je.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1112},res:{ttl:je.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:je.ONE_DAY,prompt:!1,tag:1114},res:{ttl:je.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:je.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:je.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:je.FIVE_MINUTES,prompt:!1,tag:1119}}},e1={min:je.FIVE_MINUTES,max:je.SEVEN_DAYS},Oi={idle:"IDLE",active:"ACTIVE"},wU="request",vU=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],AU="wc",Oce=1.5,EU="auth",bU="authKeys",SU="pairingTopics",IU="requests",ad=`${AU}@${1.5}:${EU}:`,od=`${ad}:PUB_KEY`,Dce=Object.defineProperty,Pce=Object.defineProperties,Rce=Object.getOwnPropertyDescriptors,lU=Object.getOwnPropertySymbols,Bce=Object.prototype.hasOwnProperty,Mce=Object.prototype.propertyIsEnumerable,fU=(t,e,r)=>e in t?Dce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gr=(t,e)=>{for(var r in e||(e={}))Bce.call(e,r)&&fU(t,r,e[r]);if(lU)for(var r of lU(e))Mce.call(e,r)&&fU(t,r,e[r]);return t},au=(t,e)=>Pce(t,Rce(e)),JT=class extends hU.IEngine{constructor(e){super(e),this.name=yU,this.events=new Sce.default,this.initialized=!1,this.requestQueue={state:Oi.idle,queue:[]},this.sessionRequestQueue={state:Oi.idle,queue:[]},this.requestQueueDelay=je.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Sr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},je.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=au(gr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:u,relays:a}=n,c=i,f,d=!1;try{c&&(d=this.client.core.pairing.pairings.get(c).active)}catch(L){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),L}if(!c||!d){let{topic:L,uri:k}=await this.client.core.pairing.create();c=L,f=k}if(!c){let{message:L}=G.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(L)}let w=await this.client.core.crypto.generateKeyPair(),A=Sr.wc_sessionPropose.req.ttl||je.FIVE_MINUTES,_=G.calcExpiry(A),N=gr({requiredNamespaces:s,optionalNamespaces:o,relays:a??[{protocol:cn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:w,metadata:this.client.metadata},expiryTimestamp:_,pairingTopic:c},u&&{sessionProperties:u}),{reject:P,resolve:V,done:U}=G.createDelayedPromise(A,pU);this.events.once(G.engineEvent("session_connect"),async({error:L,session:k})=>{if(L)P(L);else if(k){k.self.publicKey=w;let H=au(gr({},k),{pairingTopic:N.pairingTopic,requiredNamespaces:N.requiredNamespaces,optionalNamespaces:N.optionalNamespaces});await this.client.session.set(k.topic,H),await this.setExpiry(k.topic,k.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:k.peer.metadata}),this.cleanupDuplicatePairings(H),V(H)}});let Q=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:N,throwOnFailedPublish:!0});return await this.setProposal(Q,gr({id:Q},N)),{uri:f,approval:U}},this.pair=async r=>{await this.isInitialized();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{await this.isInitialized();try{await this.isValidApprove(r)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),U}let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o,sessionConfig:u}=r,a;try{a=this.client.proposal.get(n)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${n}) failed`),U}let{pairingTopic:c,proposer:f,requiredNamespaces:d,optionalNamespaces:w}=a,A=await this.client.core.crypto.generateKeyPair(),_=f.publicKey,N=await this.client.core.crypto.generateSharedKey(A,_),P=gr(gr({relay:{protocol:i??"irn"},namespaces:s,controller:{publicKey:A,metadata:this.client.metadata},expiry:G.calcExpiry(uu)},o&&{sessionProperties:o}),u&&{sessionConfig:u});await this.client.core.relayer.subscribe(N);let V=au(gr({},P),{topic:N,requiredNamespaces:d,optionalNamespaces:w,pairingTopic:c,acknowledged:!1,self:P.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:A});await this.client.session.set(N,V);try{await this.sendResult({id:n,topic:c,result:{relay:{protocol:i??"irn"},responderPublicKey:A},throwOnFailedPublish:!0}),await this.sendRequest({topic:N,method:"wc_sessionSettle",params:P,throwOnFailedPublish:!0})}catch(U){throw this.client.logger.error(U),this.client.session.delete(N,G.getSdkError("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(N),U}return await this.client.core.pairing.updateMetadata({topic:c,metadata:f.metadata}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:c}),await this.setExpiry(N,G.calcExpiry(uu)),{topic:N,acknowledged:()=>new Promise(U=>setTimeout(()=>U(this.client.session.get(N)),500))}},this.reject=async r=>{await this.isInitialized();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}let{id:n,reason:i}=r,s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Sr.wc_sessionPropose.reject}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized();try{await this.isValidUpdate(r)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}let{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:u}=G.createDelayedPromise(),a=qe.payloadId(),c=qe.getBigIntRpcId().toString(),f=this.client.session.get(n).namespaces;return this.events.once(G.engineEvent("session_update",a),({error:d})=>{d?u(d):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:c}).catch(d=>{this.client.logger.error(d),this.client.session.update(n,{namespaces:f}),u(d)}),{acknowledged:s}},this.extend=async r=>{await this.isInitialized();try{await this.isValidExtend(r)}catch(a){throw this.client.logger.error("extend() -> isValidExtend() failed"),a}let{topic:n}=r,i=qe.payloadId(),{done:s,resolve:o,reject:u}=G.createDelayedPromise();return this.events.once(G.engineEvent("session_extend",i),({error:a})=>{a?u(a):o()}),await this.setExpiry(n,G.calcExpiry(uu)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(a=>{u(a)}),{acknowledged:s}},this.request=async r=>{await this.isInitialized();try{await this.isValidRequest(r)}catch(A){throw this.client.logger.error("request() -> isValidRequest() failed"),A}let{chainId:n,request:i,topic:s,expiry:o=Sr.wc_sessionRequest.req.ttl}=r,u=this.client.session.get(s),a=qe.payloadId(),c=qe.getBigIntRpcId().toString(),{done:f,resolve:d,reject:w}=G.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(G.engineEvent("session_request",a),({error:A,result:_})=>{A?w(A):d(_)}),await Promise.all([new Promise(async A=>{await this.sendRequest({clientRpcId:a,relayRpcId:c,topic:s,method:"wc_sessionRequest",params:{request:au(gr({},i),{expiryTimestamp:G.calcExpiry(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(_=>w(_)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),A()}),new Promise(async A=>{var _;if(!((_=u.sessionConfig)!=null&&_.disableDeepLink)){let N=await G.getDeepLink(this.client.core.storage,YT);G.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:N})}A()}),f()]).then(A=>A[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;qe.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):qe.isJsonRpcError(i)&&await this.sendError({id:s,topic:n,error:i.error}),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=qe.payloadId(),s=qe.getBigIntRpcId().toString(),{done:o,resolve:u,reject:a}=G.createDelayedPromise();this.events.once(G.engineEvent("session_ping",i),({error:c})=>{c?a(c):u()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r,o=qe.getBigIntRpcId().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:G.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{let{message:i}=G.getInternalError("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>G.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async r=>{this.isInitialized(),this.isValidAuthenticate(r);let{chains:n,statement:i="",uri:s,domain:o,nonce:u,type:a,exp:c,nbf:f,methods:d=[],expiry:w}=r,A=[...r.resources||[]],{topic:_,uri:N}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:_,uri:N}});let P=await this.client.core.crypto.generateKeyPair(),V=G.hashKey(P);if(await Promise.all([this.client.auth.authKeys.set(od,{responseTopic:V,publicKey:P}),this.client.auth.pairingTopics.set(V,{topic:V,pairingTopic:_})]),await this.client.core.relayer.subscribe(V),this.client.logger.info(`sending request to new pairing topic: ${_}`),d.length>0){let{namespace:l}=G.parseChainId(n[0]),g=G.createEncodedRecap(l,"request",d);G.getRecapFromResources(A)&&(g=G.mergeEncodedRecaps(g,A.pop())),A.push(g)}let U=w&&w>Sr.wc_sessionAuthenticate.req.ttl?w:Sr.wc_sessionAuthenticate.req.ttl,Q={authPayload:{type:a??"caip122",chains:n,statement:i,aud:s,domain:o,version:"1",nonce:u,iat:new Date().toISOString(),exp:c,nbf:f,resources:A},requester:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:G.calcExpiry(U)},L={eip155:{chains:n,methods:[...new Set(["personal_sign",...d])],events:["chainChanged","accountsChanged"]}},k={requiredNamespaces:{},optionalNamespaces:L,relays:[{protocol:"irn"}],pairingTopic:_,proposer:{publicKey:P,metadata:this.client.metadata},expiryTimestamp:G.calcExpiry(Sr.wc_sessionPropose.req.ttl)},{done:H,resolve:q,reject:v}=G.createDelayedPromise(U,"Request expired"),C=async({error:l,session:g})=>{if(this.events.off(G.engineEvent("session_request",F),R),l)v(l);else if(g){g.self.publicKey=P,await this.client.session.set(g.topic,g),await this.setExpiry(g.topic,g.expiry),_&&await this.client.core.pairing.updateMetadata({topic:_,metadata:g.peer.metadata});let y=this.client.session.get(g.topic);await this.deleteProposal(B),q({session:y})}},R=async l=>{if(await this.deletePendingAuthRequest(F,{message:"fulfilled",code:0}),l.error){let x=G.getSdkError("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return l.error.code===x.code?void 0:(this.events.off(G.engineEvent("session_connect"),C),v(l.error.message))}await this.deleteProposal(B),this.events.off(G.engineEvent("session_connect"),C);let{cacaos:g,responder:y}=l.result,E=[],I=[];for(let x of g){await G.validateSignedCacao({cacao:x,projectId:this.client.core.projectId})||(this.client.logger.error(x,"Signature verification failed"),v(G.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:m}=x,O=G.getRecapFromResources(m.resources),Y=[G.getNamespacedDidChainId(m.iss)],$=G.getDidAddress(m.iss);if(O){let b=G.getMethodsFromRecap(O),j=G.getChainsFromRecap(O);E.push(...b),Y.push(...j)}for(let b of Y)I.push(`${b}:${$}`)}let T=await this.client.core.crypto.generateSharedKey(P,y.publicKey),M;E.length>0&&(M={topic:T,acknowledged:!0,self:{publicKey:P,metadata:this.client.metadata},peer:y,controller:y.publicKey,expiry:G.calcExpiry(uu),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:_,namespaces:G.buildNamespacesFromAuth([...new Set(E)],[...new Set(I)])},await this.client.core.relayer.subscribe(T),await this.client.session.set(T,M),M=this.client.session.get(T)),q({auths:g,session:M})},F=qe.payloadId(),B=qe.payloadId();this.events.once(G.engineEvent("session_connect"),C),this.events.once(G.engineEvent("session_request",F),R);try{await Promise.all([this.sendRequest({topic:_,method:"wc_sessionAuthenticate",params:Q,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:F}),this.sendRequest({topic:_,method:"wc_sessionPropose",params:k,expiry:Sr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:B})])}catch(l){throw this.events.off(G.engineEvent("session_connect"),C),this.events.off(G.engineEvent("session_request",F),R),l}return await this.setProposal(B,gr({id:B},k)),await this.setAuthRequest(F,{request:au(gr({},Q),{verifyContext:{}}),pairingTopic:_}),{uri:N,response:H}},this.approveSessionAuthenticate=async r=>{this.isInitialized();let{id:n,auths:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);let o=s.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),a=G.hashKey(o),c={type:G.TYPE_1,receiverPublicKey:o,senderPublicKey:u},f=[],d=[];for(let _ of i){if(!await G.validateSignedCacao({cacao:_,projectId:this.client.core.projectId})){let Q=G.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:a,error:Q,encodeOpts:c}),new Error(Q.message)}let{p:N}=_,P=G.getRecapFromResources(N.resources),V=[G.getNamespacedDidChainId(N.iss)],U=G.getDidAddress(N.iss);if(P){let Q=G.getMethodsFromRecap(P),L=G.getChainsFromRecap(P);f.push(...Q),V.push(...L)}for(let Q of V)d.push(`${Q}:${U}`)}let w=await this.client.core.crypto.generateSharedKey(u,o),A;return f?.length>0&&(A={topic:w,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:o,metadata:s.requester.metadata},controller:o,expiry:G.calcExpiry(uu),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:G.buildNamespacesFromAuth([...new Set(f)],[...new Set(d)])},await this.client.core.relayer.subscribe(w),await this.client.session.set(w,A)),await this.sendResult({topic:a,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:c,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),{session:A}},this.rejectSessionAuthenticate=async r=>{await this.isInitialized();let{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);let o=s.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),a=G.hashKey(o),c={type:G.TYPE_1,receiverPublicKey:o,senderPublicKey:u};await this.sendError({id:n,topic:a,error:i,encodeOpts:c,rpcOpts:Sr.wc_sessionAuthenticate.reject}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,G.getSdkError("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();let{request:n,iss:i}=r;return G.formatMessage(n,i)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,u;return((o=s.peerMetadata)==null?void 0:o.url)&&((u=s.peerMetadata)==null?void 0:u.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;let{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:u=0}=r,{self:a}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,G.getSdkError("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(YT).catch(c=>this.client.logger.warn(c)),this.getPendingSessionRequests().forEach(c=>{c.topic===i&&this.deletePendingSessionRequest(c.id,G.getSdkError("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=Oi.idle),o&&this.client.events.emit("session_delete",{id:u,topic:i})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,G.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Oi.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,G.calcExpiry(Sr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{let{request:i,pairingTopic:s}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext})},this.setPendingSessionRequest=async r=>{let{id:n,topic:i,params:s,verifyContext:o}=r,u=s.request.expiryTimestamp||G.calcExpiry(Sr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,u),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:u,clientRpcId:a,throwOnFailedPublish:c}=r,f=qe.formatJsonRpcRequest(i,s,a);if(G.isBrowser()&&vU.includes(i)){let A=G.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:A})}let d;try{d=await this.client.core.crypto.encode(n,f)}catch(A){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),A}let w=Sr[i].req;return o&&(w.ttl=o),u&&(w.id=u),this.client.core.history.set(n,f),c?(w.internal=au(gr({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,w)):this.client.core.relayer.publish(n,d,w).catch(A=>this.client.logger.error(A)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:u}=r,a=qe.formatJsonRpcResult(n,s),c;try{c=await this.client.core.crypto.encode(i,a,u)}catch(w){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),w}let f;try{f=await this.client.core.history.get(i,n)}catch(w){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),w}let d=Sr[f.request.method].res;o?(d.internal=au(gr({},d.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,c,d)):this.client.core.relayer.publish(i,c,d).catch(w=>this.client.logger.error(w)),await this.client.core.history.resolve(a)},this.sendError=async r=>{let{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:u}=r,a=qe.formatJsonRpcError(n,s),c;try{c=await this.client.core.crypto.encode(i,a,o)}catch(w){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),w}let f;try{f=await this.client.core.history.get(i,n)}catch(w){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),w}let d=u||Sr[f.request.method].res;this.client.core.relayer.publish(i,c,d),await this.client.core.history.resolve(a)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;G.isExpired(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{G.isExpired(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Oi.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Oi.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Oi.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:s}))switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=G.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{let{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(gr({},n.params));let o=i.expiryTimestamp||G.calcExpiry(Sr.wc_sessionPropose.req.ttl),u=gr({id:s,pairingTopic:r,expiryTimestamp:o},i);await this.setProposal(s,u);let a=G.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(a,u.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:u,verifyContext:c})}catch(o){await this.sendError({id:s,topic:r,error:o,rpcOpts:Sr.wc_sessionPropose.autoReject}),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(qe.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let u=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});let a=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});let c=await this.client.core.crypto.generateSharedKey(u,a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else if(qe.isJsonRpcError(n)){await this.client.proposal.delete(i,G.getSdkError("USER_DISCONNECTED"));let s=G.engineEvent("session_connect");if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners, 954`);this.events.emit(G.engineEvent("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:u,expiry:a,namespaces:c,sessionProperties:f,sessionConfig:d}=n.params,w=gr(gr({topic:r,relay:o,expiry:a,namespaces:c,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},f&&{sessionProperties:f}),d&&{sessionConfig:d});await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0});let A=G.engineEvent("session_connect");if(this.events.listenerCount(A)===0)throw new Error(`emitting ${A} without any listeners 997`);this.events.emit(G.engineEvent("session_connect"),{session:w})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;qe.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(G.engineEvent("session_approve",i),{})):qe.isJsonRpcError(n)&&(await this.client.session.delete(r,G.getSdkError("USER_DISCONNECTED")),this.events.emit(G.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,u=G.MemoryStore.get(o);if(u&&this.isRequestOutOfSync(u,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:G.getSdkError("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(gr({topic:r},i));try{G.MemoryStore.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(a){throw G.MemoryStore.delete(o),a}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_update",i),{}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,G.calcExpiry(uu)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_extend",i),{}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_ping",i),{}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(cn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:G.getSdkError("USER_DISCONNECTED")})])}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{var i;let{id:s,params:o}=n;try{await this.isValidRequest(gr({topic:r},o));let u=G.hashMessage(JSON.stringify(qe.formatJsonRpcRequest("wc_sessionRequest",o,s))),a=this.client.session.get(r),c=await this.getVerifyContext(u,a.peer.metadata),f={id:s,topic:r,params:o,verifyContext:c};await this.setPendingSessionRequest(f),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(f):(this.addSessionRequestToSessionRequestQueue(f),this.processSessionRequestQueue())}catch(u){await this.sendError({id:s,topic:r,error:u}),this.client.logger.error(u)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n,s=G.engineEvent("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,u=G.MemoryStore.get(o);if(u&&this.isRequestOutOfSync(u,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(gr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),G.MemoryStore.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{let{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),qe.isJsonRpcResult(n)?this.events.emit(G.engineEvent("session_request",i),{result:n.result}):qe.isJsonRpcError(n)&&this.events.emit(G.engineEvent("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async(r,n)=>{try{let{requester:i,authPayload:s,expiryTimestamp:o}=n.params,u=G.hashMessage(JSON.stringify(n)),a=await this.getVerifyContext(u,this.client.metadata),c={requester:i,pairingTopic:r,id:n.id,authPayload:s,verifyContext:a,expiryTimestamp:o};await this.setAuthRequest(n.id,{request:c,pairingTopic:r}),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id})}catch(i){this.client.logger.error(i);let s=n.params.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),u={type:G.TYPE_1,receiverPublicKey:s,senderPublicKey:o};await this.sendError({id:n.id,topic:r,error:i,encodeOpts:u,rpcOpts:Sr.wc_sessionAuthenticate.autoReject})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Oi.idle,this.processSessionRequestQueue()},je.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{let i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{let o=s.request.id,u=G.engineEvent("session_request",o);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(G.engineEvent("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Oi.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Oi.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,qe.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!G.isValidParams(r)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:u}=r;if(G.isUndefined(n)||await this.isValidPairingTopic(n),!G.isValidRelays(u,!0)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(a)}!G.isUndefined(i)&&G.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!G.isUndefined(s)&&G.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=G.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!G.isValidParams(r))throw new Error(G.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);let u=this.client.proposal.get(n),a=G.isValidNamespaces(i,"approve()");if(a)throw new Error(a.message);let c=G.isConformingNamespaces(u.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!G.isValidString(s,!0)){let{message:f}=G.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}G.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!G.isValidParams(r)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!G.isValidErrorReason(i)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!G.isValidParams(r)){let{message:c}=G.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!G.isValidRelay(n)){let{message:c}=G.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let u=G.isValidController(i,"onSessionSettleRequest()");if(u)throw new Error(u.message);let a=G.isValidNamespaces(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);if(G.isExpired(o)){let{message:c}=G.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!G.isValidParams(r)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(a)}let{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=G.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let u=G.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!G.isValidParams(r)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(a)}let{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let{namespaces:u}=this.client.session.get(n);if(!G.isValidNamespacesChainId(u,s)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!G.isValidRequest(i)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!G.isValidNamespacesRequest(u,s,i.method)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(a)}if(o&&!G.isValidRequestExpiry(o,e1)){let{message:a}=G.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${e1.min} and ${e1.max}`);throw new Error(a)}},this.isValidRespond=async r=>{var n;if(!G.isValidParams(r)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!G.isValidResponse(s)){let{message:o}=G.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!G.isValidParams(r)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(u)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!G.isValidNamespacesChainId(o,s)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(u)}if(!G.isValidEvent(i)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}if(!G.isValidNamespacesEvent(o,s,i.name)){let{message:u}=G.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}},this.isValidDisconnect=async r=>{if(!G.isValidParams(r)){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{let{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!G.isValidString(i,!1))throw new Error("uri is required parameter");if(!G.isValidString(s,!1))throw new Error("domain is required parameter");if(!G.isValidString(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(a=>G.parseChainId(a).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:u}=G.parseChainId(n[0]);if(u!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||cn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!G.isValidString(i,!1)){let{message:s}=G.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{let n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0,s=this.recentlyDeletedLimit/2;for(let o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{let n=this.recentlyDeletedMap.get(r);if(n){let{message:i}=G.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){let{message:e}=G.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(cn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(od)?this.client.auth.authKeys.get(od):{responseTopic:void 0,publicKey:void 0},s=await this.client.core.crypto.decode(r,n,{receiverPublicKey:i});try{qe.isJsonRpcRequest(s)?(this.client.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):qe.isJsonRpcResponse(s)?(await this.client.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.client.core.history.delete(r,s.id)):this.onRelayEventUnknownPayload({topic:r,payload:s})}catch(o){this.client.logger.error(o)}})}registerExpirerEvents(){this.client.core.expirer.on(cn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=G.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,G.getInternalError("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,G.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(cn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(cn.PAIRING_EVENTS.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=G.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!G.isValidString(e,!1)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:r}=G.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),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(G.isValidString(e,!1)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=G.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!G.isValidId(e)){let{message:r}=G.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=G.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(G.isExpired(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:r}=G.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},XT=class extends cn.Store{constructor(e,r){super(e,r,gU,n1),this.core=e,this.logger=r}},t1=class extends cn.Store{constructor(e,r){super(e,r,mU,n1),this.core=e,this.logger=r}},ZT=class extends cn.Store{constructor(e,r){super(e,r,wU,n1,n=>n.id),this.core=e,this.logger=r}},e2=class extends cn.Store{constructor(e,r){super(e,r,bU,ad,()=>od),this.core=e,this.logger=r}},t2=class extends cn.Store{constructor(e,r){super(e,r,SU,ad),this.core=e,this.logger=r}},r2=class extends cn.Store{constructor(e,r){super(e,r,IU,ad,n=>n.id),this.core=e,this.logger=r}},n2=class{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new e2(this.core,this.logger),this.pairingTopics=new t2(this.core,this.logger),this.requests=new r2(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}},r1=class t extends hU.ISignClient{constructor(e){super(e),this.protocol=i2,this.version=s2,this.name=Zy.name,this.events=new dU.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async n=>{try{return await this.engine.authenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||Zy.name,this.metadata=e?.metadata||G.getAppMetadata(),this.signConfig=e?.signConfig;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xy.pino(Xy.getDefaultLoggerOptions({level:e?.logger||Zy.logger}));this.core=e?.core||new cn.Core(e),this.logger=Xy.generateChildLogger(r,this.name),this.session=new t1(this.core,this.logger),this.proposal=new XT(this.core,this.logger),this.pendingRequest=new ZT(this.core,this.logger),this.engine=new JT(this),this.auth=new n2(this.core,this.logger)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Xy.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(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},Lce=t1,Fce=r1;Be.AUTH_CONTEXT=EU,Be.AUTH_KEYS_CONTEXT=bU,Be.AUTH_PAIRING_TOPIC_CONTEXT=SU,Be.AUTH_PROTOCOL=AU,Be.AUTH_PUBLIC_KEY_NAME=od,Be.AUTH_REQUEST_CONTEXT=IU,Be.AUTH_STORAGE_PREFIX=ad,Be.AUTH_VERSION=Oce,Be.ENGINE_CONTEXT=yU,Be.ENGINE_QUEUE_STATES=Oi,Be.ENGINE_RPC_OPTS=Sr,Be.HISTORY_CONTEXT=Cce,Be.HISTORY_EVENTS=Tce,Be.HISTORY_STORAGE_VERSION=Nce,Be.METHODS_TO_VERIFY=vU,Be.PROPOSAL_CONTEXT=gU,Be.PROPOSAL_EXPIRY=xce,Be.PROPOSAL_EXPIRY_MESSAGE=pU,Be.REQUEST_CONTEXT=wU,Be.SESSION_CONTEXT=mU,Be.SESSION_EXPIRY=uu,Be.SESSION_REQUEST_EXPIRY_BOUNDARIES=e1,Be.SIGN_CLIENT_CONTEXT=o2,Be.SIGN_CLIENT_DEFAULT=Zy,Be.SIGN_CLIENT_EVENTS=Ice,Be.SIGN_CLIENT_PROTOCOL=i2,Be.SIGN_CLIENT_STORAGE_OPTIONS=_ce,Be.SIGN_CLIENT_STORAGE_PREFIX=n1,Be.SIGN_CLIENT_VERSION=s2,Be.SessionStore=Lce,Be.SignClient=Fce,Be.WALLETCONNECT_DEEPLINK_CHOICE=YT,Be.default=r1});var i1=D(Wo=>{"use strict";h();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.OptionalOperation=Wo.Operation=void 0;var Uce;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(Uce=Wo.Operation||(Wo.Operation={}));var qce;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(qce=Wo.OptionalOperation||(Wo.OptionalOperation={}))});var a2=D(vs=>{"use strict";h();Object.defineProperty(vs,"__esModule",{value:!0});vs.WALLETCONNECT_SIGN_LOGIN_DELAY=vs.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=vs.WALLETCONNECT_MULTIVERSX_METHODS=vs.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var TU=i1();vs.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";vs.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(TU.Operation);vs.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(TU.OptionalOperation);vs.WALLETCONNECT_SIGN_LOGIN_DELAY=500});var l2=D(Di=>{"use strict";h();Object.defineProperty(Di,"__esModule",{value:!0});Di.WalletConnectV2ProviderErrorMessagesEnum=Di.ErrBadAddress=Di.ErrNotImplemented=Di.Err=void 0;var ud=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Di.Err=ud;var u2=class extends ud{constructor(){super("Method not yet implemented")}};Di.ErrNotImplemented=u2;var c2=class extends ud{constructor(e,r){super(`Bad address: ${e}`,r)}};Di.ErrBadAddress=c2;var Vce;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(Vce=Di.WalletConnectV2ProviderErrorMessagesEnum||(Di.WalletConnectV2ProviderErrorMessagesEnum={}))});var h2=D(s1=>{"use strict";h();Object.defineProperty(s1,"__esModule",{value:!0});s1.Logger=void 0;var f2=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};s1.Logger=f2});var CU=D(()=>{"use strict";h();global.Buffer||(global.Buffer=no().Buffer)});var p2=D(vl=>{"use strict";h();Object.defineProperty(vl,"__esModule",{value:!0});vl.SmartContractQueryResponse=vl.SmartContractQuery=void 0;var d2=class{constructor(e){this.contract=e.contract,this.caller=e.caller,this.value=e.value,this.function=e.function,this.arguments=e.arguments}};vl.SmartContractQuery=d2;var g2=class{constructor(e){this.function=e.function,this.returnCode=e.returnCode,this.returnMessage=e.returnMessage,this.returnDataParts=e.returnDataParts}};vl.SmartContractQueryResponse=g2});var xU=D(o1=>{"use strict";h();Object.defineProperty(o1,"__esModule",{value:!0});o1.QueryRunnerAdapter=void 0;var NU=ke(),kce=p2(),m2=class{constructor(e){this.networkProvider=e.networkProvider}async runQuery(e){let r={address:NU.Address.fromBech32(e.contract),caller:e.caller?NU.Address.fromBech32(e.caller):void 0,func:e.function,value:e.value,getEncodedArguments:()=>e.arguments.map(i=>p.Buffer.from(i).toString("hex"))},n=await this.networkProvider.queryContract(r);return new kce.SmartContractQueryResponse({function:e.function,returnCode:n.returnCode.toString(),returnMessage:n.returnMessage,returnDataParts:n.getReturnDataParts()})}};o1.QueryRunnerAdapter=m2});var OU=D(cu=>{"use strict";h();var Hce=cu&&cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gce=cu&&cu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hce(e,t,r)};Object.defineProperty(cu,"__esModule",{value:!0});Gce(xU(),cu)});var DU=D(lu=>{"use strict";h();var jce=lu&&lu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zce=lu&&lu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jce(e,t,r)};Object.defineProperty(lu,"__esModule",{value:!0});zce(ab(),lu)});var RU=D(fu=>{"use strict";h();Object.defineProperty(fu,"__esModule",{value:!0});fu.GasEstimator=fu.DefaultGasConfiguration=void 0;fu.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var Qce=1e5,PU=8e5,y2=class{constructor(e){this.gasConfiguration=e||fu.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+Qce}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+PU}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+PU)*r+this.gasConfiguration.gasPerDataByte*e}};fu.GasEstimator=y2});var MU=D(BU=>{"use strict";h();Object.defineProperty(BU,"__esModule",{value:!0})});var FU=D(LU=>{"use strict";h();Object.defineProperty(LU,"__esModule",{value:!0})});var UU=D(a1=>{"use strict";h();Object.defineProperty(a1,"__esModule",{value:!0});a1.RelayedTransactionV1Builder=void 0;var w2=ke(),Kce=Ie(),Wce=en(),$ce=Bs(),Yce=mE(),v2=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new Kce.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${p.Buffer.from(e).toString("hex")}`,n=new $ce.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new Wce.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new w2.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new w2.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:BigInt(this.innerTransaction.getValue().toString()),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:p.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new w2.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?p.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?p.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return Yce.stringify(e)}};a1.RelayedTransactionV1Builder=v2});var VU=D(u1=>{"use strict";h();Object.defineProperty(u1,"__esModule",{value:!0});u1.RelayedTransactionV2Builder=void 0;var qU=Ie(),cd=Vn(),Jce=en(),Xce=Bs(),A2=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new qU.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new qU.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new cd.ArgSerializer().valuesToString([new cd.AddressValue(this.innerTransaction.getReceiver()),new cd.U64Value(this.innerTransaction.getNonce().valueOf()),new cd.BytesValue(this.innerTransaction.getData().valueOf()),new cd.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new Xce.TransactionPayload(r),i=new Jce.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID,version:this.innerTransaction.getVersion(),options:this.innerTransaction.getOptions()});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};u1.RelayedTransactionV2Builder=A2});var HU=D(l1=>{"use strict";h();Object.defineProperty(l1,"__esModule",{value:!0});l1.SmartContractQueriesController=void 0;var kU=Ie(),Zce=p2(),c1=Vn(),ele=$t(),E2=class{constructor(e){this.abi=e.abi,this.queryRunner=e.queryRunner,this.legacyResultsParser=new c1.ResultsParser}async query(e){let r=this.createQuery(e),n=await this.runQuery(r);return this.raiseForStatus(n),this.parseQueryResponse(n)}raiseForStatus(e){if(!(e.returnCode==="ok"))throw new kU.ErrSmartContractQuery(e.returnCode,e.returnMessage)}createQuery(e){let r=this.encodeArguments(e.function,e.arguments);return new Zce.SmartContractQuery({contract:e.contract,caller:e.caller,function:e.function,arguments:r,value:e.value})}encodeArguments(e,r){let n=this.abi?.getEndpoint(e);if(n){let i=c1.NativeSerializer.nativeToTypedValues(r,n);return new c1.ArgSerializer().valuesToBuffers(i)}if(this.areArgsOfTypedValue(r))return new c1.ArgSerializer().valuesToBuffers(r);if(this.areArgsBuffers(r))return r.map(i=>p.Buffer.from(i));throw new kU.Err("cannot encode arguments: when ABI is not available, they must be either typed values or buffers")}areArgsOfTypedValue(e){return e.every(r=>ele.isTyped(r))}areArgsBuffers(e){for(let r of e)if(!ArrayBuffer.isView(r))return!1;return!0}async runQuery(e){return await this.queryRunner.runQuery(e)}parseQueryResponse(e){if(!this.abi)return e.returnDataParts;let r={returnCode:e.returnCode,returnMessage:e.returnMessage,getReturnDataParts:()=>e.returnDataParts.map(u=>p.Buffer.from(u))},n=e.function,i=this.abi.getEndpoint(n);return this.legacyResultsParser.parseQueryResponse(r,i).values.map(u=>u.valueOf())}};l1.SmartContractQueriesController=E2});var GU=D(Ve=>{"use strict";h();var tle=Ve&&Ve.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xt=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tle(e,t,r)};Object.defineProperty(Ve,"__esModule",{value:!0});CU();xt(Sc(),Ve);xt(OU(),Ve);xt(ke(),Ve);xt(Wb(),Ve);xt(Wd(),Ve);xt(DU(),Ve);xt(Ie(),Ve);xt(RU(),Ve);xt(MU(),Ve);xt(FU(),Ve);xt(so(),Ve);xt(zb(),Ve);xt(Jl(),Ve);xt(UU(),Ve);xt(VU(),Ve);xt(H0(),Ve);xt(HU(),Ve);xt(Vn(),Ve);xt(Fb(),Ve);xt(Ia(),Ve);xt(en(),Ve);xt(N0(),Ve);xt(Bs(),Ve);xt(V0(),Ve);xt(d0(),Ve);xt(Hb(),Ve);xt(Bn(),Ve)});var $U=D(cr=>{"use strict";h();var rle=cr&&cr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(cr,"__esModule",{value:!0});cr.sleep=cr.getMetadata=cr.applyTransactionSignature=cr.getAddressFromSession=cr.addressIsValid=cr.getConnectionParams=cr.getCurrentTopic=cr.getCurrentSession=void 0;var QU=GU(),jU=Yf(),nle=jh(),f1=a2(),eo=l2(),b2=h2(),zU=i1();function KU(t,e){if(!e)throw new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(WU(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw b2.Logger.error(eo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}cr.getCurrentSession=KU;function ile(t,e){if(!e)throw new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=KU(t,e);if(!r?.topic)throw new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}cr.getCurrentTopic=ile;function WU(t,e){var r,n,i;let s=[...f1.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(zU.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(zU.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${f1.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],u=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[f1.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:u}}}}cr.getConnectionParams=WU;function sle(t){try{return!QU.Address.fromBech32(t).isEmpty()}catch{return!1}}cr.addressIsValid=sle;function ole(t){let e=t.namespaces[f1.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}cr.getAddressFromSession=ole;function ale({transaction:t,response:e}){if(!e)throw b2.Logger.error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,u=t.getGuardian().bech32();if(u&&u!==o)throw b2.Logger.error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(eo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(QU.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new jU.Signature(r)),n&&t.applyGuardianSignature(new jU.Signature(n)),t}cr.applyTransactionSignature=ale;function ule(t){if(t)return Object.assign(Object.assign({},t),{url:nle.getAppMetadata().url})}cr.getMetadata=ule;function cle(t){return rle(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}cr.sleep=cle});var ld=D(ln=>{"use strict";h();var rr=ln&&ln.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})},lle=ln&&ln.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ln,"__esModule",{value:!0});ln.WalletConnectV2Provider=ln.OptionalOperation=ln.Operation=ln.WalletConnectV2ProviderErrorMessagesEnum=void 0;var fle=Yf(),hle=lle(_U()),S2=jh(),hu=a2(),fe=l2();Object.defineProperty(ln,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return fe.WalletConnectV2ProviderErrorMessagesEnum}});var Me=h2(),$o=i1();Object.defineProperty(ln,"Operation",{enumerable:!0,get:function(){return $o.Operation}});Object.defineProperty(ln,"OptionalOperation",{enumerable:!0,get:function(){return $o.OptionalOperation}});var Or=$U(),I2=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return rr(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Or.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield hle.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=Or.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},i))}catch{if(e?.topic)try{(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.expirer)===null||n===void 0||n.set(e.topic,0)}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}throw this.reset(),Me.Logger.error(e?.topic?fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:fe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return rr(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield Or.sleep(hu.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Or.getAddressFromSession(n),o=n.namespaces[hu.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes($o.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?$o.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:$o.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:u}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!u)throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:u})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Or.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:S2.getSdkError("USER_DISCONNECTED")});else{let r=Or.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:S2.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$o.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new fle.Signature(n))}catch{throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$o.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Or.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$o.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Or.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${hu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Or.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Or.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return rr(this,void 0,void 0,function*(){return e?Or.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Me.Logger.error(`${fe.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return rr(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Or.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return rr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&Or.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return rr(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:u})=>{var a;if(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)return;let{namespaces:c}=u,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>rr(this,void 0,void 0,function*(){var u;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)&&(Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>rr(this,void 0,void 0,function*(){var u;!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o||(Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return rr(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(fe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Or.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,u,a,c;return rr(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!S2.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(c=(a=(u=this.walletConnector.core)===null||u===void 0?void 0:u.relayer)===null||a===void 0?void 0:a.subscriber)===null||c===void 0?void 0:c.unsubscribe(d.topic)}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Me.Logger.error(fe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};ln.WalletConnectV2Provider=I2});var JU=D((q_e,YU)=>{"use strict";h();YU.exports=Error});var ZU=D((k_e,XU)=>{"use strict";h();XU.exports=EvalError});var tq=D((G_e,eq)=>{"use strict";h();eq.exports=RangeError});var nq=D((z_e,rq)=>{"use strict";h();rq.exports=ReferenceError});var _2=D((K_e,iq)=>{"use strict";h();iq.exports=SyntaxError});var Al=D(($_e,sq)=>{"use strict";h();sq.exports=TypeError});var aq=D((J_e,oq)=>{"use strict";h();oq.exports=URIError});var cq=D((Z_e,uq)=>{"use strict";h();uq.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var hq=D((tTe,fq)=>{"use strict";h();var lq=typeof Symbol<"u"&&Symbol,dle=cq();fq.exports=function(){return typeof lq!="function"||typeof Symbol!="function"||typeof lq("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:dle()}});var gq=D((nTe,dq)=>{"use strict";h();var T2={__proto__:null,foo:{}},gle=Object;dq.exports=function(){return{__proto__:T2}.foo===T2.foo&&!(T2 instanceof gle)}});var yq=D((sTe,mq)=>{"use strict";h();var ple="Function.prototype.bind called on incompatible ",mle=Object.prototype.toString,yle=Math.max,wle="[object Function]",pq=function(e,r){for(var n=[],i=0;i{"use strict";h();var Ele=yq();wq.exports=Function.prototype.bind||Ele});var Aq=D((cTe,vq)=>{"use strict";h();var ble=Function.prototype.call,Sle=Object.prototype.hasOwnProperty,Ile=h1();vq.exports=Ile.call(ble,Sle)});var pu=D((fTe,_q)=>{"use strict";h();var Re,_le=JU(),Tle=ZU(),Cle=tq(),Nle=nq(),Il=_2(),Sl=Al(),xle=aq(),Iq=Function,C2=function(t){try{return Iq('"use strict"; return ('+t+").constructor;")()}catch{}},du=Object.getOwnPropertyDescriptor;if(du)try{du({},"")}catch{du=null}var N2=function(){throw new Sl},Ole=du?function(){try{return arguments.callee,N2}catch{try{return du(arguments,"callee").get}catch{return N2}}}():N2,El=hq()(),Dle=gq()(),Ir=Object.getPrototypeOf||(Dle?function(t){return t.__proto__}:null),bl={},Ple=typeof Uint8Array>"u"||!Ir?Re:Ir(Uint8Array),gu={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Re:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Re:ArrayBuffer,"%ArrayIteratorPrototype%":El&&Ir?Ir([][Symbol.iterator]()):Re,"%AsyncFromSyncIteratorPrototype%":Re,"%AsyncFunction%":bl,"%AsyncGenerator%":bl,"%AsyncGeneratorFunction%":bl,"%AsyncIteratorPrototype%":bl,"%Atomics%":typeof Atomics>"u"?Re:Atomics,"%BigInt%":typeof BigInt>"u"?Re:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Re:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Re:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Re:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":_le,"%eval%":eval,"%EvalError%":Tle,"%Float32Array%":typeof Float32Array>"u"?Re:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Re:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Re:FinalizationRegistry,"%Function%":Iq,"%GeneratorFunction%":bl,"%Int8Array%":typeof Int8Array>"u"?Re:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Re:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Re:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":El&&Ir?Ir(Ir([][Symbol.iterator]())):Re,"%JSON%":typeof JSON=="object"?JSON:Re,"%Map%":typeof Map>"u"?Re:Map,"%MapIteratorPrototype%":typeof Map>"u"||!El||!Ir?Re:Ir(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Re:Promise,"%Proxy%":typeof Proxy>"u"?Re:Proxy,"%RangeError%":Cle,"%ReferenceError%":Nle,"%Reflect%":typeof Reflect>"u"?Re:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Re:Set,"%SetIteratorPrototype%":typeof Set>"u"||!El||!Ir?Re:Ir(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Re:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":El&&Ir?Ir(""[Symbol.iterator]()):Re,"%Symbol%":El?Symbol:Re,"%SyntaxError%":Il,"%ThrowTypeError%":Ole,"%TypedArray%":Ple,"%TypeError%":Sl,"%Uint8Array%":typeof Uint8Array>"u"?Re:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Re:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Re:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Re:Uint32Array,"%URIError%":xle,"%WeakMap%":typeof WeakMap>"u"?Re:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Re:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Re:WeakSet};if(Ir)try{null.error}catch(t){Eq=Ir(Ir(t)),gu["%Error.prototype%"]=Eq}var Eq,Rle=function t(e){var r;if(e==="%AsyncFunction%")r=C2("async function () {}");else if(e==="%GeneratorFunction%")r=C2("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=C2("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ir&&(r=Ir(i.prototype))}return gu[e]=r,r},bq={__proto__:null,"%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"]},fd=h1(),d1=Aq(),Ble=fd.call(Function.call,Array.prototype.concat),Mle=fd.call(Function.apply,Array.prototype.splice),Sq=fd.call(Function.call,String.prototype.replace),g1=fd.call(Function.call,String.prototype.slice),Lle=fd.call(Function.call,RegExp.prototype.exec),Fle=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ule=/\\(\\)?/g,qle=function(e){var r=g1(e,0,1),n=g1(e,-1);if(r==="%"&&n!=="%")throw new Il("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Il("invalid intrinsic syntax, expected opening `%`");var i=[];return Sq(e,Fle,function(s,o,u,a){i[i.length]=u?Sq(a,Ule,"$1"):o||s}),i},Vle=function(e,r){var n=e,i;if(d1(bq,n)&&(i=bq[n],n="%"+i[0]+"%"),d1(gu,n)){var s=gu[n];if(s===bl&&(s=Rle(n)),typeof s>"u"&&!r)throw new Sl("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Il("intrinsic "+e+" does not exist!")};_q.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Sl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Sl('"allowMissing" argument must be a boolean');if(Lle(/^%?[^%]*%?$/,e)===null)throw new Il("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=qle(e),i=n.length>0?n[0]:"",s=Vle("%"+i+"%",r),o=s.name,u=s.value,a=!1,c=s.alias;c&&(i=c[0],Mle(n,Ble([0,1],c)));for(var f=1,d=!0;f=n.length){var N=du(u,w);d=!!N,d&&"get"in N&&!("originalValue"in N.get)?u=N.get:u=u[w]}else d=d1(u,w),u=u[w];d&&!a&&(gu[o]=u)}}return u}});var m1=D((dTe,Tq)=>{"use strict";h();var kle=pu(),p1=kle("%Object.defineProperty%",!0)||!1;if(p1)try{p1({},"a",{value:1})}catch{p1=!1}Tq.exports=p1});var x2=D((pTe,Cq)=>{"use strict";h();var Hle=pu(),y1=Hle("%Object.getOwnPropertyDescriptor%",!0);if(y1)try{y1([],"length")}catch{y1=null}Cq.exports=y1});var Dq=D((yTe,Oq)=>{"use strict";h();var Nq=m1(),Gle=_2(),_l=Al(),xq=x2();Oq.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new _l("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new _l("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new _l("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new _l("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new _l("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new _l("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,a=!!xq&&xq(e,r);if(Nq)Nq(e,r,{configurable:o===null&&a?a.configurable:!o,enumerable:i===null&&a?a.enumerable:!i,value:n,writable:s===null&&a?a.writable:!s});else if(u||!i&&!s&&!o)e[r]=n;else throw new Gle("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Bq=D((vTe,Rq)=>{"use strict";h();var O2=m1(),Pq=function(){return!!O2};Pq.hasArrayLengthDefineBug=function(){if(!O2)return null;try{return O2([],"length",{value:1}).length!==1}catch{return!0}};Rq.exports=Pq});var qq=D((ETe,Uq)=>{"use strict";h();var jle=pu(),Mq=Dq(),zle=Bq()(),Lq=x2(),Fq=Al(),Qle=jle("%Math.floor%");Uq.exports=function(e,r){if(typeof e!="function")throw new Fq("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Qle(r)!==r)throw new Fq("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Lq){var o=Lq(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(zle?Mq(e,"length",r,!0,!0):Mq(e,"length",r)),e}});var zq=D((STe,w1)=>{"use strict";h();var D2=h1(),v1=pu(),Kle=qq(),Wle=Al(),Hq=v1("%Function.prototype.apply%"),Gq=v1("%Function.prototype.call%"),jq=v1("%Reflect.apply%",!0)||D2.call(Gq,Hq),Vq=m1(),$le=v1("%Math.max%");w1.exports=function(e){if(typeof e!="function")throw new Wle("a function is required");var r=jq(D2,Gq,arguments);return Kle(r,1+$le(0,e.length-(arguments.length-1)),!0)};var kq=function(){return jq(D2,Hq,arguments)};Vq?Vq(w1.exports,"apply",{value:kq}):w1.exports.apply=kq});var $q=D((_Te,Wq)=>{"use strict";h();var Qq=pu(),Kq=zq(),Yle=Kq(Qq("String.prototype.indexOf"));Wq.exports=function(e,r){var n=Qq(e,!!r);return typeof n=="function"&&Yle(e,".prototype.")>-1?Kq(n):n}});var Yq=D(()=>{h()});var m7=D((OTe,p7)=>{h();var k2=typeof Map=="function"&&Map.prototype,P2=Object.getOwnPropertyDescriptor&&k2?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,E1=k2&&P2&&typeof P2.get=="function"?P2.get:null,Jq=k2&&Map.prototype.forEach,H2=typeof Set=="function"&&Set.prototype,R2=Object.getOwnPropertyDescriptor&&H2?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,b1=H2&&R2&&typeof R2.get=="function"?R2.get:null,Xq=H2&&Set.prototype.forEach,Jle=typeof WeakMap=="function"&&WeakMap.prototype,dd=Jle?WeakMap.prototype.has:null,Xle=typeof WeakSet=="function"&&WeakSet.prototype,gd=Xle?WeakSet.prototype.has:null,Zle=typeof WeakRef=="function"&&WeakRef.prototype,Zq=Zle?WeakRef.prototype.deref:null,efe=Boolean.prototype.valueOf,tfe=Object.prototype.toString,rfe=Function.prototype.toString,nfe=String.prototype.match,G2=String.prototype.slice,Jo=String.prototype.replace,ife=String.prototype.toUpperCase,e7=String.prototype.toLowerCase,c7=RegExp.prototype.test,t7=Array.prototype.concat,As=Array.prototype.join,sfe=Array.prototype.slice,r7=Math.floor,L2=typeof BigInt=="function"?BigInt.prototype.valueOf:null,B2=Object.getOwnPropertySymbols,F2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Tl=typeof Symbol=="function"&&typeof Symbol.iterator=="object",qr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Tl||!0)?Symbol.toStringTag:null,l7=Object.prototype.propertyIsEnumerable,n7=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function i7(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||c7.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-r7(-t):r7(t);if(n!==t){var i=String(n),s=G2.call(e,i.length+1);return Jo.call(i,r,"$&_")+"."+Jo.call(Jo.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Jo.call(e,r,"$&_")}var U2=Yq(),s7=U2.custom,o7=h7(s7)?s7:null;p7.exports=function t(e,r,n,i){var s=r||{};if(Yo(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Yo(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=Yo(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(Yo(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(Yo(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=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 g7(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return u?i7(e,a):a}if(typeof e=="bigint"){var c=String(e)+"n";return u?i7(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return q2(e)?"[Array]":"[Object]";var d=Sfe(s,n);if(typeof i>"u")i=[];else if(d7(i,e)>=0)return"[Circular]";function w(l,g,y){if(g&&(i=sfe.call(i),i.push(g)),y){var E={depth:s.depth};return Yo(s,"quoteStyle")&&(E.quoteStyle=s.quoteStyle),t(l,E,n+1,i)}return t(l,s,n+1,i)}if(typeof e=="function"&&!a7(e)){var A=gfe(e),_=A1(e,w);return"[Function"+(A?": "+A:" (anonymous)")+"]"+(_.length>0?" { "+As.call(_,", ")+" }":"")}if(h7(e)){var N=Tl?Jo.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):F2.call(e);return typeof e=="object"&&!Tl?hd(N):N}if(Afe(e)){for(var P="<"+e7.call(String(e.nodeName)),V=e.attributes||[],U=0;U",P}if(q2(e)){if(e.length===0)return"[]";var Q=A1(e,w);return d&&!bfe(Q)?"["+V2(Q,d)+"]":"[ "+As.call(Q,", ")+" ]"}if(ufe(e)){var L=A1(e,w);return!("cause"in Error.prototype)&&"cause"in e&&!l7.call(e,"cause")?"{ ["+String(e)+"] "+As.call(t7.call("[cause]: "+w(e.cause),L),", ")+" }":L.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+As.call(L,", ")+" }"}if(typeof e=="object"&&o){if(o7&&typeof e[o7]=="function"&&U2)return U2(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(pfe(e)){var k=[];return Jq&&Jq.call(e,function(l,g){k.push(w(g,e,!0)+" => "+w(l,e))}),u7("Map",E1.call(e),k,d)}if(wfe(e)){var H=[];return Xq&&Xq.call(e,function(l){H.push(w(l,e))}),u7("Set",b1.call(e),H,d)}if(mfe(e))return M2("WeakMap");if(vfe(e))return M2("WeakSet");if(yfe(e))return M2("WeakRef");if(lfe(e))return hd(w(Number(e)));if(hfe(e))return hd(w(L2.call(e)));if(ffe(e))return hd(efe.call(e));if(cfe(e))return hd(w(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!afe(e)&&!a7(e)){var q=A1(e,w),v=n7?n7(e)===Object.prototype:e instanceof Object||e.constructor===Object,C=e instanceof Object?"":"null prototype",R=!v&&qr&&Object(e)===e&&qr in e?G2.call(Xo(e),8,-1):C?"Object":"",F=v||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",B=F+(R||C?"["+As.call(t7.call([],R||[],C||[]),": ")+"] ":"");return q.length===0?B+"{}":d?B+"{"+V2(q,d)+"}":B+"{ "+As.call(q,", ")+" }"}return String(e)};function f7(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function ofe(t){return Jo.call(String(t),/"/g,""")}function q2(t){return Xo(t)==="[object Array]"&&(!qr||!(typeof t=="object"&&qr in t))}function afe(t){return Xo(t)==="[object Date]"&&(!qr||!(typeof t=="object"&&qr in t))}function a7(t){return Xo(t)==="[object RegExp]"&&(!qr||!(typeof t=="object"&&qr in t))}function ufe(t){return Xo(t)==="[object Error]"&&(!qr||!(typeof t=="object"&&qr in t))}function cfe(t){return Xo(t)==="[object String]"&&(!qr||!(typeof t=="object"&&qr in t))}function lfe(t){return Xo(t)==="[object Number]"&&(!qr||!(typeof t=="object"&&qr in t))}function ffe(t){return Xo(t)==="[object Boolean]"&&(!qr||!(typeof t=="object"&&qr in t))}function h7(t){if(Tl)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!F2)return!1;try{return F2.call(t),!0}catch{}return!1}function hfe(t){if(!t||typeof t!="object"||!L2)return!1;try{return L2.call(t),!0}catch{}return!1}var dfe=Object.prototype.hasOwnProperty||function(t){return t in this};function Yo(t,e){return dfe.call(t,e)}function Xo(t){return tfe.call(t)}function gfe(t){if(t.name)return t.name;var e=nfe.call(rfe.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function d7(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return g7(G2.call(t,0,e.maxStringLength),e)+n}var i=Jo.call(Jo.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Efe);return f7(i,"single",e)}function Efe(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+ife.call(e.toString(16))}function hd(t){return"Object("+t+")"}function M2(t){return t+" { ? }"}function u7(t,e,r,n){var i=n?V2(r,n):As.call(r,", ");return t+" ("+e+") {"+i+"}"}function bfe(t){for(var e=0;e=0)return!1;return!0}function Sfe(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=As.call(Array(t.indent+1)," ");else return null;return{base:r,prev:As.call(Array(e+1),r)}}function V2(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+As.call(t,","+r)+` -`+e.prev}function A1(t,e){var r=q2(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";h();var y7=pu(),Cl=$q(),Ife=m7(),_fe=Al(),S1=y7("%WeakMap%",!0),I1=y7("%Map%",!0),Tfe=Cl("WeakMap.prototype.get",!0),Cfe=Cl("WeakMap.prototype.set",!0),Nfe=Cl("WeakMap.prototype.has",!0),xfe=Cl("Map.prototype.get",!0),Ofe=Cl("Map.prototype.set",!0),Dfe=Cl("Map.prototype.has",!0),j2=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Pfe=function(t,e){var r=j2(t,e);return r&&r.value},Rfe=function(t,e,r){var n=j2(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Bfe=function(t,e){return!!j2(t,e)};w7.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new _fe("Side channel does not contain "+Ife(s))},get:function(s){if(S1&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Tfe(e,s)}else if(I1){if(r)return xfe(r,s)}else if(n)return Pfe(n,s)},has:function(s){if(S1&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Nfe(e,s)}else if(I1){if(r)return Dfe(r,s)}else if(n)return Bfe(n,s);return!1},set:function(s,o){S1&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new S1),Cfe(e,s,o)):I1?(r||(r=new I1),Ofe(r,s,o)):(n||(n={key:{},next:null}),Rfe(n,s,o))}};return i}});var _1=D((BTe,A7)=>{"use strict";h();var Mfe=String.prototype.replace,Lfe=/%20/g,z2={RFC1738:"RFC1738",RFC3986:"RFC3986"};A7.exports={default:z2.RFC3986,formatters:{RFC1738:function(t){return Mfe.call(t,Lfe,"+")},RFC3986:function(t){return String(t)}},RFC1738:z2.RFC1738,RFC3986:z2.RFC3986}});var K2=D((LTe,b7)=>{"use strict";h();var Ffe=_1(),Q2=Object.prototype.hasOwnProperty,mu=Array.isArray,Es=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Ufe=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(mu(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===Ffe.RFC1738&&(c===40||c===41)){u+=o.charAt(a);continue}if(c<128){u=u+Es[c];continue}if(c<2048){u=u+(Es[192|c>>6]+Es[128|c&63]);continue}if(c<55296||c>=57344){u=u+(Es[224|c>>12]+Es[128|c>>6&63]+Es[128|c&63]);continue}a+=1,c=65536+((c&1023)<<10|o.charCodeAt(a)&1023),u+=Es[240|c>>18]+Es[128|c>>12&63]+Es[128|c>>6&63]+Es[128|c&63]}return u},Gfe=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";h();var _7=v7(),$2=K2(),pd=_1(),Wfe=Object.prototype.hasOwnProperty,S7={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},yu=Array.isArray,$fe=String.prototype.split,Yfe=Array.prototype.push,T7=function(t,e){Yfe.apply(t,yu(e)?e:[e])},Jfe=Date.prototype.toISOString,I7=pd.default,Dr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:$2.encode,encodeValuesOnly:!1,format:I7,formatter:pd.formatters[I7],indices:!1,serializeDate:function(e){return Jfe.call(e)},skipNulls:!1,strictNullHandling:!1},Xfe=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},W2={},Zfe=function t(e,r,n,i,s,o,u,a,c,f,d,w,A,_,N){for(var P=e,V=N,U=0,Q=!1;(V=V.get(W2))!==void 0&&!Q;){var L=V.get(e);if(U+=1,typeof L<"u"){if(L===U)throw new RangeError("Cyclic object value");Q=!0}typeof V.get(W2)>"u"&&(U=0)}if(typeof u=="function"?P=u(r,P):P instanceof Date?P=f(P):n==="comma"&&yu(P)&&(P=$2.maybeMap(P,function(I){return I instanceof Date?f(I):I})),P===null){if(i)return o&&!A?o(r,Dr.encoder,_,"key",d):r;P=""}if(Xfe(P)||$2.isBuffer(P)){if(o){var k=A?r:o(r,Dr.encoder,_,"key",d);if(n==="comma"&&A){for(var H=$fe.call(String(P),","),q="",v=0;v"u")return C;var R;if(n==="comma"&&yu(P))R=[{value:P.length>0?P.join(",")||null:void 0}];else if(yu(u))R=u;else{var F=Object.keys(P);R=a?F.sort(a):F}for(var B=0;B"u"?Dr.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Dr.charsetSentinel,delimiter:typeof e.delimiter>"u"?Dr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Dr.encode,encoder:typeof e.encoder=="function"?e.encoder:Dr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Dr.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Dr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Dr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Dr.strictNullHandling}};C7.exports=function(t,e){var r=t,n=ehe(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):yu(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var u;e&&e.arrayFormat in S7?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var a=S7[u];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=_7(),f=0;f0?A+w:""}});var D7=D((VTe,O7)=>{"use strict";h();var Nl=K2(),Y2=Object.prototype.hasOwnProperty,the=Array.isArray,_r={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Nl.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},rhe=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},x7=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},nhe="utf8=%26%2310003%3B",ihe="utf8=%E2%9C%93",she=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),u=-1,a,c=r.charset;if(r.charsetSentinel)for(a=0;a-1&&(_=the(_)?[_]:_),Y2.call(n,A)?n[A]=Nl.combine(n[A],_):n[A]=_}return n},ohe=function(t,e,r,n){for(var i=n?e:x7(e,r),s=t.length-1;s>=0;--s){var o,u=t[s];if(u==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var a=u.charAt(0)==="["&&u.charAt(u.length-1)==="]"?u.slice(1,-1):u,c=parseInt(a,10);!r.parseArrays&&a===""?o={0:i}:!isNaN(c)&&u!==a&&String(c)===a&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):a!=="__proto__"&&(o[a]=i)}i=o}return i},ahe=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,u=/(\[[^[\]]*])/g,a=n.depth>0&&o.exec(s),c=a?s.slice(0,a.index):s,f=[];if(c){if(!n.plainObjects&&Y2.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var d=0;n.depth>0&&(a=u.exec(s))!==null&&d"u"?_r.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?_r.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:_r.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:_r.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:_r.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:_r.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:_r.comma,decoder:typeof e.decoder=="function"?e.decoder:_r.decoder,delimiter:typeof e.delimiter=="string"||Nl.isRegExp(e.delimiter)?e.delimiter:_r.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:_r.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:_r.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:_r.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:_r.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:_r.strictNullHandling}};O7.exports=function(t,e){var r=uhe(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?she(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";h();var che=N7(),lhe=D7(),fhe=_1();P7.exports={formats:fhe,parse:lhe,stringify:che}});var J2=D(ze=>{"use strict";h();Object.defineProperty(ze,"__esModule",{value:!0});ze.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ze.WALLET_PROVIDER_CALLBACK_PARAM=ze.WALLET_PROVIDER_SIGN_MESSAGE_URL=ze.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ze.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ze.WALLET_PROVIDER_SEND_TRANSACTION_URL=ze.WALLET_PROVIDER_DISCONNECT_URL=ze.WALLET_PROVIDER_CONNECT_URL=ze.XALIAS_PROVIDER_TESTNET=ze.XALIAS_PROVIDER_DEVNET=ze.XALIAS_PROVIDER_MAINNET=ze.WALLET_PROVIDER_TESTNET=ze.WALLET_PROVIDER_DEVNET=ze.WALLET_PROVIDER_MAINNET=void 0;ze.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ze.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ze.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ze.XALIAS_PROVIDER_MAINNET="https://xalias.com";ze.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";ze.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";ze.WALLET_PROVIDER_CONNECT_URL="hook/login";ze.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ze.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ze.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ze.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ze.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ze.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ze.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var B7=D(xl=>{"use strict";h();Object.defineProperty(xl,"__esModule",{value:!0});xl.ErrCannotSignedMessage=xl.ErrCannotGetSignedTransactions=void 0;var X2=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};xl.ErrCannotGetSignedTransactions=X2;var Z2=class extends Error{constructor(){super("Cannot get signed message")}};xl.ErrCannotSignedMessage=Z2});var M7=D(T1=>{"use strict";h();Object.defineProperty(T1,"__esModule",{value:!0});T1.PlainSignedTransaction=void 0;var eC=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};T1.PlainSignedTransaction=eC});var Ol=D(ta=>{"use strict";h();var Zo=ta&&ta.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})},hhe=ta&&ta.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ta,"__esModule",{value:!0});ta.WalletProvider=void 0;var tC=hhe(R7()),ea=J2(),rC=B7(),dhe=M7(),nC=class t{constructor(e){this.walletUrl=e}login(e){return Zo(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ea.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Zo(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return Zo(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Zo(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ea.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Zo(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ea.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=tC.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new rC.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Zo(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ea.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Zo(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ea.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Zo(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(e=window.location.search){let r=tC.default.parse(e.slice(1));return t.isTxSignReturnSuccess(r)?this.getTxSignReturnValue(r):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ea.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ea.WALLET_PROVIDER_CALLBACK_PARAM]===ea.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new rC.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new rC.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let u=t.prepareWalletTransaction(o);for(let a in u)u.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(u[a])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};ta.WalletProvider=nC});var p9=D((XTe,g9)=>{"use strict";h();function K7(t,e){return function(){return t.apply(e,arguments)}}var{toString:ghe}=Object.prototype,{getPrototypeOf:pC}=Object,O1=(t=>e=>{let r=ghe.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Ss=t=>(t=t.toLowerCase(),e=>O1(e)===t),D1=t=>e=>typeof e===t,{isArray:Bl}=Array,yd=D1("undefined");function phe(t){return t!==null&&!yd(t)&&t.constructor!==null&&!yd(t.constructor)&&ti(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var W7=Ss("ArrayBuffer");function mhe(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&W7(t.buffer),e}var yhe=D1("string"),ti=D1("function"),$7=D1("number"),P1=t=>t!==null&&typeof t=="object",whe=t=>t===!0||t===!1,C1=t=>{if(O1(t)!=="object")return!1;let e=pC(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},vhe=Ss("Date"),Ahe=Ss("File"),Ehe=Ss("Blob"),bhe=Ss("FileList"),She=t=>P1(t)&&ti(t.pipe),Ihe=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ti(t.append)&&((e=O1(t))==="formdata"||e==="object"&&ti(t.toString)&&t.toString()==="[object FormData]"))},_he=Ss("URLSearchParams"),The=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wd(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Bl(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}var J7=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,X7=t=>!yd(t)&&t!==J7;function uC(){let{caseless:t}=X7(this)&&this||{},e={},r=(n,i)=>{let s=t&&Y7(e,i)||i;C1(e[s])&&C1(n)?e[s]=uC(e[s],n):C1(n)?e[s]=uC({},n):Bl(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(wd(e,(i,s)=>{r&&ti(i)?t[s]=K7(i,r):t[s]=i},{allOwnKeys:n}),t),Nhe=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),xhe=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Ohe=(t,e,r,n)=>{let i,s,o,u={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!n||n(o,t,e))&&!u[o]&&(e[o]=t[o],u[o]=!0);t=r!==!1&&pC(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Dhe=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},Phe=t=>{if(!t)return null;if(Bl(t))return t;let e=t.length;if(!$7(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Rhe=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&pC(Uint8Array)),Bhe=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),i;for(;(i=n.next())&&!i.done;){let s=i.value;e.call(t,s[0],s[1])}},Mhe=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Lhe=Ss("HTMLFormElement"),Fhe=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),L7=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Uhe=Ss("RegExp"),Z7=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};wd(r,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(n[s]=o||i)}),Object.defineProperties(t,n)},qhe=t=>{Z7(t,(e,r)=>{if(ti(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(ti(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Vhe=(t,e)=>{let r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Bl(t)?n(t):n(String(t).split(e)),r},khe=()=>{},Hhe=(t,e)=>(t=+t,Number.isFinite(t)?t:e),iC="abcdefghijklmnopqrstuvwxyz",F7="0123456789",e9={DIGIT:F7,ALPHA:iC,ALPHA_DIGIT:iC+iC.toUpperCase()+F7},Ghe=(t=16,e=e9.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function jhe(t){return!!(t&&ti(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var zhe=t=>{let e=new Array(10),r=(n,i)=>{if(P1(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let s=Bl(n)?[]:{};return wd(n,(o,u)=>{let a=r(o,i+1);!yd(a)&&(s[u]=a)}),e[i]=void 0,s}}return n};return r(t,0)},Qhe=Ss("AsyncFunction"),Khe=t=>t&&(P1(t)||ti(t))&&ti(t.then)&&ti(t.catch),re={isArray:Bl,isArrayBuffer:W7,isBuffer:phe,isFormData:Ihe,isArrayBufferView:mhe,isString:yhe,isNumber:$7,isBoolean:whe,isObject:P1,isPlainObject:C1,isUndefined:yd,isDate:vhe,isFile:Ahe,isBlob:Ehe,isRegExp:Uhe,isFunction:ti,isStream:She,isURLSearchParams:_he,isTypedArray:Rhe,isFileList:bhe,forEach:wd,merge:uC,extend:Che,trim:The,stripBOM:Nhe,inherits:xhe,toFlatObject:Ohe,kindOf:O1,kindOfTest:Ss,endsWith:Dhe,toArray:Phe,forEachEntry:Bhe,matchAll:Mhe,isHTMLForm:Lhe,hasOwnProperty:L7,hasOwnProp:L7,reduceDescriptors:Z7,freezeMethods:qhe,toObjectSet:Vhe,toCamelCase:Fhe,noop:khe,toFiniteNumber:Hhe,findKey:Y7,global:J7,isContextDefined:X7,ALPHABET:e9,generateString:Ghe,isSpecCompliantForm:jhe,toJSONObject:zhe,isAsyncFn:Qhe,isThenable:Khe};function Le(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}re.inherits(Le,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var t9=Le.prototype,r9={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{r9[t]={value:t}});Object.defineProperties(Le,r9);Object.defineProperty(t9,"isAxiosError",{value:!0});Le.from=(t,e,r,n,i,s)=>{let o=Object.create(t9);return re.toFlatObject(t,o,function(a){return a!==Error.prototype},u=>u!=="isAxiosError"),Le.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};var Whe=null;function cC(t){return re.isPlainObject(t)||re.isArray(t)}function n9(t){return re.endsWith(t,"[]")?t.slice(0,-2):t}function U7(t,e,r){return t?t.concat(e).map(function(i,s){return i=n9(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function $he(t){return re.isArray(t)&&!t.some(cC)}var Yhe=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function R1(t,e,r){if(!re.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=re.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,P){return!re.isUndefined(P[N])});let n=r.metaTokens,i=r.visitor||f,s=r.dots,o=r.indexes,a=(r.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function c(_){if(_===null)return"";if(re.isDate(_))return _.toISOString();if(!a&&re.isBlob(_))throw new Le("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(_)||re.isTypedArray(_)?a&&typeof Blob=="function"?new Blob([_]):p.Buffer.from(_):_}function f(_,N,P){let V=_;if(_&&!P&&typeof _=="object"){if(re.endsWith(N,"{}"))N=n?N:N.slice(0,-2),_=JSON.stringify(_);else if(re.isArray(_)&&$he(_)||(re.isFileList(_)||re.endsWith(N,"[]"))&&(V=re.toArray(_)))return N=n9(N),V.forEach(function(Q,L){!(re.isUndefined(Q)||Q===null)&&e.append(o===!0?U7([N],L,s):o===null?N:N+"[]",c(Q))}),!1}return cC(_)?!0:(e.append(U7(P,N,s),c(_)),!1)}let d=[],w=Object.assign(Yhe,{defaultVisitor:f,convertValue:c,isVisitable:cC});function A(_,N){if(!re.isUndefined(_)){if(d.indexOf(_)!==-1)throw Error("Circular reference detected in "+N.join("."));d.push(_),re.forEach(_,function(V,U){(!(re.isUndefined(V)||V===null)&&i.call(e,V,re.isString(U)?U.trim():U,N,w))===!0&&A(V,N?N.concat(U):[U])}),d.pop()}}if(!re.isObject(t))throw new TypeError("data must be an object");return A(t),e}function q7(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function mC(t,e){this._pairs=[],t&&R1(t,this,e)}var i9=mC.prototype;i9.append=function(e,r){this._pairs.push([e,r])};i9.toString=function(e){let r=e?function(n){return e.call(this,n,q7)}:q7;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Jhe(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function s9(t,e,r){if(!e)return t;let n=r&&r.encode||Jhe,i=r&&r.serialize,s;if(i?s=i(e,r):s=re.isURLSearchParams(e)?e.toString():new mC(e,r).toString(n),s){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}var lC=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(n){n!==null&&e(n)})}},V7=lC,o9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xhe=typeof URLSearchParams<"u"?URLSearchParams:mC,Zhe=typeof FormData<"u"?FormData:null,ede=typeof Blob<"u"?Blob:null,tde={isBrowser:!0,classes:{URLSearchParams:Xhe,FormData:Zhe,Blob:ede},protocols:["http","https","file","blob","url","data"]},a9=typeof window<"u"&&typeof document<"u",rde=(t=>a9&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),nde=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ide=Object.freeze({__proto__:null,hasBrowserEnv:a9,hasStandardBrowserWebWorkerEnv:nde,hasStandardBrowserEnv:rde}),bs={...ide,...tde};function sde(t,e){return R1(t,new bs.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return bs.isNode&&re.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function ode(t){return re.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function ade(t){let e={},r=Object.keys(t),n,i=r.length,s;for(n=0;n=r.length;return o=!o&&re.isArray(i)?i.length:o,a?(re.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!u):((!i[o]||!re.isObject(i[o]))&&(i[o]=[]),e(r,n,i[o],s)&&re.isArray(i[o])&&(i[o]=ade(i[o])),!u)}if(re.isFormData(t)&&re.isFunction(t.entries)){let r={};return re.forEachEntry(t,(n,i)=>{e(ode(n),i,r,0)}),r}return null}function ude(t,e,r){if(re.isString(t))try{return(e||JSON.parse)(t),re.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var yC={transitional:o9,adapter:["xhr","http"],transformRequest:[function(e,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=re.isObject(e);if(s&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(u9(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return sde(e,this.formSerializer).toString();if((u=re.isFileList(e))||n.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return R1(u?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),ude(e)):e}],transformResponse:[function(e){let r=this.transitional||yC.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&re.isString(e)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(u){if(o)throw u.name==="SyntaxError"?Le.from(u,Le.ERR_BAD_RESPONSE,this,null,this.response):u}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bs.classes.FormData,Blob:bs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],t=>{yC.headers[t]={}});var wC=yC,cde=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),lde=t=>{let e={},r,n,i;return t&&t.split(` -`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||e[r]&&cde[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},k7=Symbol("internals");function md(t){return t&&String(t).trim().toLowerCase()}function N1(t){return t===!1||t==null?t:re.isArray(t)?t.map(N1):String(t)}function fde(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var hde=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function sC(t,e,r,n,i){if(re.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!re.isString(e)){if(re.isString(n))return e.indexOf(n)!==-1;if(re.isRegExp(n))return n.test(e)}}function dde(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function gde(t,e){let r=re.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,o){return this[n].call(this,e,i,s,o)},configurable:!0})})}var Dl=class{constructor(e){e&&this.set(e)}set(e,r,n){let i=this;function s(u,a,c){let f=md(a);if(!f)throw new Error("header name must be a non-empty string");let d=re.findKey(i,f);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||a]=N1(u))}let o=(u,a)=>re.forEach(u,(c,f)=>s(c,f,a));return re.isPlainObject(e)||e instanceof this.constructor?o(e,r):re.isString(e)&&(e=e.trim())&&!hde(e)?o(lde(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=md(e),e){let n=re.findKey(this,e);if(n){let i=this[n];if(!r)return i;if(r===!0)return fde(i);if(re.isFunction(r))return r.call(this,i,n);if(re.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=md(e),e){let n=re.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||sC(this,this[n],n,r)))}return!1}delete(e,r){let n=this,i=!1;function s(o){if(o=md(o),o){let u=re.findKey(n,o);u&&(!r||sC(n,n[u],u,r))&&(delete n[u],i=!0)}}return re.isArray(e)?e.forEach(s):s(e),i}clear(e){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let s=r[n];(!e||sC(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){let r=this,n={};return re.forEach(this,(i,s)=>{let o=re.findKey(n,s);if(o){r[o]=N1(i),delete r[s];return}let u=e?dde(s):String(s).trim();u!==s&&delete r[s],r[u]=N1(i),n[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return re.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&re.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[k7]=this[k7]={accessors:{}}).accessors,i=this.prototype;function s(o){let u=md(o);n[u]||(gde(i,o),n[u]=!0)}return re.isArray(e)?e.forEach(s):s(e),this}};Dl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);re.reduceDescriptors(Dl.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});re.freezeMethods(Dl);var to=Dl;function oC(t,e){let r=this||wC,n=e||r,i=to.from(n.headers),s=n.data;return re.forEach(t,function(u){s=u.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function c9(t){return!!(t&&t.__CANCEL__)}function vd(t,e,r){Le.call(this,t??"canceled",Le.ERR_CANCELED,e,r),this.name="CanceledError"}re.inherits(vd,Le,{__CANCEL__:!0});function pde(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Le("Request failed with status code "+r.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var mde=bs.hasStandardBrowserEnv?{write(t,e,r,n,i,s){let o=[t+"="+encodeURIComponent(e)];re.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),re.isString(n)&&o.push("path="+n),re.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function yde(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function wde(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function l9(t,e){return t&&!yde(e)?wde(t,e):e}var vde=bs.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(o){let u=re.isString(o)?i(o):o;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}();function Ade(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Ede(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,s=0,o;return e=e!==void 0?e:1e3,function(a){let c=Date.now(),f=n[s];o||(o=c),r[i]=a,n[i]=c;let d=s,w=0;for(;d!==i;)w+=r[d++],d=d%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o{let s=i.loaded,o=i.lengthComputable?i.total:void 0,u=s-r,a=n(u),c=s<=o;r=s;let f={loaded:s,total:o,progress:o?s/o:void 0,bytes:u,rate:a||void 0,estimated:a&&o&&c?(o-s)/a:void 0,event:i};f[e?"download":"upload"]=!0,t(f)}}var bde=typeof XMLHttpRequest<"u",Sde=bde&&function(t){return new Promise(function(r,n){let i=t.data,s=to.from(t.headers).normalize(),{responseType:o,withXSRFToken:u}=t,a;function c(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a)}let f;if(re.isFormData(i)){if(bs.hasStandardBrowserEnv||bs.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((f=s.getContentType())!==!1){let[N,...P]=f?f.split(";").map(V=>V.trim()).filter(Boolean):[];s.setContentType([N||"multipart/form-data",...P].join("; "))}}let d=new XMLHttpRequest;if(t.auth){let N=t.auth.username||"",P=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(N+":"+P))}let w=l9(t.baseURL,t.url);d.open(t.method.toUpperCase(),s9(w,t.params,t.paramsSerializer),!0),d.timeout=t.timeout;function A(){if(!d)return;let N=to.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),V={data:!o||o==="text"||o==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:N,config:t,request:d};pde(function(Q){r(Q),c()},function(Q){n(Q),c()},V),d=null}if("onloadend"in d?d.onloadend=A:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(A)},d.onabort=function(){d&&(n(new Le("Request aborted",Le.ECONNABORTED,t,d)),d=null)},d.onerror=function(){n(new Le("Network Error",Le.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let P=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",V=t.transitional||o9;t.timeoutErrorMessage&&(P=t.timeoutErrorMessage),n(new Le(P,V.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,t,d)),d=null},bs.hasStandardBrowserEnv&&(u&&re.isFunction(u)&&(u=u(t)),u||u!==!1&&vde(w))){let N=t.xsrfHeaderName&&t.xsrfCookieName&&mde.read(t.xsrfCookieName);N&&s.set(t.xsrfHeaderName,N)}i===void 0&&s.setContentType(null),"setRequestHeader"in d&&re.forEach(s.toJSON(),function(P,V){d.setRequestHeader(V,P)}),re.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),o&&o!=="json"&&(d.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&d.addEventListener("progress",H7(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",H7(t.onUploadProgress)),(t.cancelToken||t.signal)&&(a=N=>{d&&(n(!N||N.type?new vd(null,t,d):N),d.abort(),d=null)},t.cancelToken&&t.cancelToken.subscribe(a),t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a)));let _=Ade(w);if(_&&bs.protocols.indexOf(_)===-1){n(new Le("Unsupported protocol "+_+":",Le.ERR_BAD_REQUEST,t));return}d.send(i||null)})},fC={http:Whe,xhr:Sde};re.forEach(fC,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var G7=t=>`- ${t}`,Ide=t=>re.isFunction(t)||t===null||t===!1,f9={getAdapter:t=>{t=re.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let s=0;s`adapter ${u} `+(a===!1?"is not supported by the environment":"is not available in the build")),o=e?s.length>1?`since : -`+s.map(G7).join(` -`):" "+G7(s[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:fC};function aC(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new vd(null,t)}function j7(t){return aC(t),t.headers=to.from(t.headers),t.data=oC.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),f9.getAdapter(t.adapter||wC.adapter)(t).then(function(n){return aC(t),n.data=oC.call(t,t.transformResponse,n),n.headers=to.from(n.headers),n},function(n){return c9(n)||(aC(t),n&&n.response&&(n.response.data=oC.call(t,t.transformResponse,n.response),n.response.headers=to.from(n.response.headers))),Promise.reject(n)})}var z7=t=>t instanceof to?{...t}:t;function Pl(t,e){e=e||{};let r={};function n(c,f,d){return re.isPlainObject(c)&&re.isPlainObject(f)?re.merge.call({caseless:d},c,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function i(c,f,d){if(re.isUndefined(f)){if(!re.isUndefined(c))return n(void 0,c,d)}else return n(c,f,d)}function s(c,f){if(!re.isUndefined(f))return n(void 0,f)}function o(c,f){if(re.isUndefined(f)){if(!re.isUndefined(c))return n(void 0,c)}else return n(void 0,f)}function u(c,f,d){if(d in e)return n(c,f);if(d in t)return n(void 0,c)}let a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u,headers:(c,f)=>i(z7(c),z7(f),!0)};return re.forEach(Object.keys(Object.assign({},t,e)),function(f){let d=a[f]||i,w=d(t[f],e[f],f);re.isUndefined(w)&&d!==u||(r[f]=w)}),r}var h9="1.6.8",vC={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{vC[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Q7={};vC.transitional=function(e,r,n){function i(s,o){return"[Axios v"+h9+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,u)=>{if(e===!1)throw new Le(i(o," has been removed"+(r?" in "+r:"")),Le.ERR_DEPRECATED);return r&&!Q7[o]&&(Q7[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,u):!0}};function _de(t,e,r){if(typeof t!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let s=n[i],o=e[s];if(o){let u=t[s],a=u===void 0||o(u,s,t);if(a!==!0)throw new Le("option "+s+" must be "+a,Le.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Le("Unknown option "+s,Le.ERR_BAD_OPTION)}}var hC={assertOptions:_de,validators:vC},ra=hC.validators,Rl=class{constructor(e){this.defaults=e,this.interceptors={request:new V7,response:new V7}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let s=i.stack?i.stack.replace(/^.+\n/,""):"";n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Pl(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&hC.assertOptions(n,{silentJSONParsing:ra.transitional(ra.boolean),forcedJSONParsing:ra.transitional(ra.boolean),clarifyTimeoutError:ra.transitional(ra.boolean)},!1),i!=null&&(re.isFunction(i)?r.paramsSerializer={serialize:i}:hC.assertOptions(i,{encode:ra.function,serialize:ra.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&re.merge(s.common,s[r.method]);s&&re.forEach(["delete","get","head","post","put","patch","common"],_=>{delete s[_]}),r.headers=to.concat(o,s);let u=[],a=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(r)===!1||(a=a&&N.synchronous,u.unshift(N.fulfilled,N.rejected))});let c=[];this.interceptors.response.forEach(function(N){c.push(N.fulfilled,N.rejected)});let f,d=0,w;if(!a){let _=[j7.bind(this),void 0];for(_.unshift.apply(_,u),_.push.apply(_,c),w=_.length,f=Promise.resolve(r);d{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(u=>{n.subscribe(u),s=u}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,u){n.reason||(n.reason=new vd(s,o,u),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Tde=dC;function Cde(t){return function(r){return t.apply(null,r)}}function Nde(t){return re.isObject(t)&&t.isAxiosError===!0}var gC={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gC).forEach(([t,e])=>{gC[e]=t});var xde=gC;function d9(t){let e=new x1(t),r=K7(x1.prototype.request,e);return re.extend(r,x1.prototype,e,{allOwnKeys:!0}),re.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return d9(Pl(t,i))},r}var lr=d9(wC);lr.Axios=x1;lr.CanceledError=vd;lr.CancelToken=Tde;lr.isCancel=c9;lr.VERSION=h9;lr.toFormData=R1;lr.AxiosError=Le;lr.Cancel=lr.CanceledError;lr.all=function(e){return Promise.all(e)};lr.spread=Cde;lr.isAxiosError=Nde;lr.mergeConfig=Pl;lr.AxiosHeaders=to;lr.formToJSON=t=>u9(re.isHTMLForm(t)?new FormData(t):t);lr.getAdapter=f9.getAdapter;lr.HttpStatusCode=xde;lr.default=lr;g9.exports=lr});var m9=D(B1=>{"use strict";h();Object.defineProperty(B1,"__esModule",{value:!0});B1.NativeAuthClientConfig=void 0;var AC=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};B1.NativeAuthClientConfig=AC});var bC=D(Ml=>{"use strict";h();var wu=Ml&&Ml.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ml,"__esModule",{value:!0});Ml.NativeAuthClient=void 0;var Ode=p9(),Dde=m9(),EC=class{constructor(e){this.config=Object.assign(new Dde.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return wu(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return wu(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return wu(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return wu(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return wu(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return wu(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(p.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return wu(this,void 0,void 0,function*(){return yield Ode.default.get(e,{headers:this.config.extraRequestHeaders})})}};Ml.NativeAuthClient=EC});var A9=D(L1=>{"use strict";h();Object.defineProperty(L1,"__esModule",{value:!0});L1.TransactionStatus=void 0;var IC=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};L1.TransactionStatus=IC});var b9=D(F1=>{"use strict";h();Object.defineProperty(F1,"__esModule",{value:!0});F1.TransactionReceipt=void 0;var E9=_c(),_C=class t{constructor(){this.value="",this.sender=new E9.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new E9.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};F1.TransactionReceipt=_C});var S9=D(Is=>{"use strict";h();Object.defineProperty(Is,"__esModule",{value:!0});Is.ErrContractQuery=Is.ErrNetworkProvider=Is.ErrUnexpectedCondition=Is.Err=void 0;var Fl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Is.Err=Fl;var TC=class extends Fl{constructor(e){super(`Unexpected condition: [${e}]`)}};Is.ErrUnexpectedCondition=TC;var CC=class extends Fl{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Is.ErrNetworkProvider=CC;var NC=class extends Fl{constructor(e){super(e.message.replace("executeQuery:",""))}};Is.ErrContractQuery=NC});var _9=D(na=>{"use strict";h();Object.defineProperty(na,"__esModule",{value:!0});na.TransactionEventTopic=na.TransactionEventData=na.TransactionEvent=void 0;var I9=_c(),xC=class t{constructor(e){this.address=new I9.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new Ul(p.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new I9.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new U1(n)),r.dataPayload=Ul.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(Ul.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};na.TransactionEvent=xC;var Ul=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(p.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};na.TransactionEventData=Ul;var U1=class{constructor(e){this.raw=p.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};na.TransactionEventTopic=U1});var DC=D(q1=>{"use strict";h();Object.defineProperty(q1,"__esModule",{value:!0});q1.TransactionLogs=void 0;var Bde=S9(),T9=_c(),Mde=_9(),OC=class t{constructor(e){this.address=new T9.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new T9.Address(e.address),r.events=(e.events||[]).map(n=>Mde.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new Bde.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};q1.TransactionLogs=OC});var N9=D(ql=>{"use strict";h();Object.defineProperty(ql,"__esModule",{value:!0});ql.ContractResultItem=ql.ContractResults=void 0;var C9=DC(),V1=_c(),PC=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>Ad.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Ad.fromApiHttpResponse(n));return new t(r)}};ql.ContractResults=PC;var Ad=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new V1.Address(""),this.sender=new V1.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new C9.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=p.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new V1.Address(e.receiver),r.sender=new V1.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=C9.TransactionLogs.fromHttpResponse(e.logs||{}),r}};ql.ContractResultItem=Ad});var x9=D(k1=>{"use strict";h();Object.defineProperty(k1,"__esModule",{value:!0});k1.ContractQueryRequest=void 0;var RC=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};k1.ContractQueryRequest=RC});var k9=D((tCe,V9)=>{h();V9.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ia=D(Au=>{h();var BC,Lde=[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];Au.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};Au.getSymbolTotalCodewords=function(e){return Lde[e]};Au.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Au.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');BC=e};Au.isKanjiModeEnabled=function(){return typeof BC<"u"};Au.toSJIS=function(e){return BC(e)}});var z1=D(ri=>{h();ri.L={bit:1};ri.M={bit:0};ri.Q={bit:3};ri.H={bit:2};function Fde(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return ri.L;case"m":case"medium":return ri.M;case"q":case"quartile":return ri.Q;case"h":case"high":return ri.H;default:throw new Error("Unknown EC Level: "+t)}}ri.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};ri.from=function(e,r){if(ri.isValid(e))return e;try{return Fde(e)}catch{return r}}});var j9=D((aCe,G9)=>{h();function H9(){this.buffer=[],this.length=0}H9.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};G9.exports=H9});var Q9=D((cCe,z9)=>{h();function Ed(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Ed.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Ed.prototype.get=function(t,e){return this.data[t*this.size+e]};Ed.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Ed.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};z9.exports=Ed});var K9=D(Q1=>{h();var Ude=ia().getSymbolSize;Q1.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=Ude(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{h();var qde=ia().getSymbolSize,W9=7;$9.getPositions=function(e){let r=qde(e);return[[0,0],[r-W9,0],[0,r-W9]]}});var J9=D(Bt=>{h();Bt.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Eu={N1:3,N2:3,N3:40,N4:10};Bt.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};Bt.from=function(e){return Bt.isValid(e)?parseInt(e,10):void 0};Bt.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,u=null;for(let a=0;a=5&&(n+=Eu.N1+(i-5)),o=f,i=1),f=e.get(c,a),f===u?s++:(s>=5&&(n+=Eu.N1+(s-5)),u=f,s=1)}i>=5&&(n+=Eu.N1+(i-5)),s>=5&&(n+=Eu.N1+(s-5))}return n};Bt.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(u,o),u>=10&&(s===1488||s===93)&&n++}return n*Eu.N3};Bt.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{h();var sa=z1(),K1=[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],W1=[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];MC.getBlocksCount=function(e,r){switch(r){case sa.L:return K1[(e-1)*4+0];case sa.M:return K1[(e-1)*4+1];case sa.Q:return K1[(e-1)*4+2];case sa.H:return K1[(e-1)*4+3];default:return}};MC.getTotalCodewordsCount=function(e,r){switch(r){case sa.L:return W1[(e-1)*4+0];case sa.M:return W1[(e-1)*4+1];case sa.Q:return W1[(e-1)*4+2];case sa.H:return W1[(e-1)*4+3];default:return}}});var X9=D(Y1=>{h();var bd=new Uint8Array(512),$1=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)bd[r]=e,$1[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)bd[r]=bd[r-255]})();Y1.log=function(e){if(e<1)throw new Error("log("+e+")");return $1[e]};Y1.exp=function(e){return bd[e]};Y1.mul=function(e,r){return e===0||r===0?0:bd[$1[e]+$1[r]]}});var Z9=D(Sd=>{h();var FC=X9();Sd.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{h();var eV=Z9();function UC(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}UC.prototype.initialize=function(e){this.degree=e,this.genPoly=eV.generateECPolynomial(this.degree)};UC.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=eV.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};tV.exports=UC});var qC=D(nV=>{h();nV.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var VC=D(ro=>{h();var iV="[0-9]+",kde="[A-Z $%*+\\-./:]+",Id="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Id=Id.replace(/u/g,"\\u");var Hde="(?:(?![A-Z0-9 $%*+\\-./:]|"+Id+`)(?:.|[\r -]))+`;ro.KANJI=new RegExp(Id,"g");ro.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ro.BYTE=new RegExp(Hde,"g");ro.NUMERIC=new RegExp(iV,"g");ro.ALPHANUMERIC=new RegExp(kde,"g");var Gde=new RegExp("^"+Id+"$"),jde=new RegExp("^"+iV+"$"),zde=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ro.testKanji=function(e){return Gde.test(e)};ro.testNumeric=function(e){return jde.test(e)};ro.testAlphanumeric=function(e){return zde.test(e)}});var oa=D(fr=>{h();var Qde=qC(),kC=VC();fr.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};fr.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};fr.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};fr.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};fr.MIXED={bit:-1};fr.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Qde.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};fr.getBestModeForData=function(e){return kC.testNumeric(e)?fr.NUMERIC:kC.testAlphanumeric(e)?fr.ALPHANUMERIC:kC.testKanji(e)?fr.KANJI:fr.BYTE};fr.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};fr.isValid=function(e){return e&&e.bit&&e.ccBits};function Kde(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return fr.NUMERIC;case"alphanumeric":return fr.ALPHANUMERIC;case"kanji":return fr.KANJI;case"byte":return fr.BYTE;default:throw new Error("Unknown mode: "+t)}}fr.from=function(e,r){if(fr.isValid(e))return e;try{return Kde(e)}catch{return r}}});var cV=D(bu=>{h();var J1=ia(),Wde=LC(),sV=z1(),aa=oa(),HC=qC(),aV=7973,oV=J1.getBCHDigit(aV);function $de(t,e,r){for(let n=1;n<=40;n++)if(e<=bu.getCapacity(n,r,t))return n}function uV(t,e){return aa.getCharCountIndicator(t,e)+4}function Yde(t,e){let r=0;return t.forEach(function(n){let i=uV(n.mode,e);r+=i+n.getBitsLength()}),r}function Jde(t,e){for(let r=1;r<=40;r++)if(Yde(t,r)<=bu.getCapacity(r,e,aa.MIXED))return r}bu.from=function(e,r){return HC.isValid(e)?parseInt(e,10):r};bu.getCapacity=function(e,r,n){if(!HC.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=aa.BYTE);let i=J1.getSymbolTotalCodewords(e),s=Wde.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===aa.MIXED)return o;let u=o-uV(n,e);switch(n){case aa.NUMERIC:return Math.floor(u/10*3);case aa.ALPHANUMERIC:return Math.floor(u/11*2);case aa.KANJI:return Math.floor(u/13);case aa.BYTE:default:return Math.floor(u/8)}};bu.getBestVersionForData=function(e,r){let n,i=sV.from(r,sV.M);if(Array.isArray(e)){if(e.length>1)return Jde(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return $de(n.mode,n.getLength(),i)};bu.getEncodedBits=function(e){if(!HC.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;J1.getBCHDigit(r)-oV>=0;)r^=aV<{h();var GC=ia(),fV=1335,Xde=21522,lV=GC.getBCHDigit(fV);hV.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;GC.getBCHDigit(i)-lV>=0;)i^=fV<{h();var Zde=oa();function kl(t){this.mode=Zde.NUMERIC,this.data=t.toString()}kl.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};kl.prototype.getLength=function(){return this.data.length};kl.prototype.getBitsLength=function(){return kl.getBitsLength(this.data.length)};kl.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};gV.exports=kl});var yV=D((FCe,mV)=>{h();var ege=oa(),jC=["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 Hl(t){this.mode=ege.ALPHANUMERIC,this.data=t}Hl.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Hl.prototype.getLength=function(){return this.data.length};Hl.prototype.getBitsLength=function(){return Hl.getBitsLength(this.data.length)};Hl.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=jC.indexOf(this.data[r])*45;n+=jC.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(jC.indexOf(this.data[r]),6)};mV.exports=Hl});var vV=D((qCe,wV)=>{"use strict";h();wV.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var EV=D((kCe,AV)=>{h();var tge=vV(),rge=oa();function Gl(t){this.mode=rge.BYTE,typeof t=="string"&&(t=tge(t)),this.data=new Uint8Array(t)}Gl.getBitsLength=function(e){return e*8};Gl.prototype.getLength=function(){return this.data.length};Gl.prototype.getBitsLength=function(){return Gl.getBitsLength(this.data.length)};Gl.prototype.write=function(t){for(let e=0,r=this.data.length;e{h();var nge=oa(),ige=ia();function jl(t){this.mode=nge.KANJI,this.data=t}jl.getBitsLength=function(e){return e*13};jl.prototype.getLength=function(){return this.data.length};jl.prototype.getBitsLength=function(){return jl.getBitsLength(this.data.length)};jl.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};bV.exports=jl});var IV=D((zCe,zC)=>{"use strict";h();var _d={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=_d.PriorityQueue.make();s.push(e,0);for(var o,u,a,c,f,d,w,A,_;!s.empty();){o=s.pop(),u=o.value,c=o.cost,f=t[u]||{};for(a in f)f.hasOwnProperty(a)&&(d=f[a],w=c+d,A=i[a],_=typeof i[a]>"u",(_||A>w)&&(i[a]=w,s.push(a,w),n[a]=u))}if(typeof r<"u"&&typeof i[r]>"u"){var N=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(N)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=_d.single_source_shortest_paths(t,e,r);return _d.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=_d.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof zC<"u"&&(zC.exports=_d)});var PV=D(zl=>{h();var Qe=oa(),CV=pV(),NV=yV(),xV=EV(),OV=SV(),Td=VC(),X1=ia(),sge=IV();function _V(t){return unescape(encodeURIComponent(t)).length}function Cd(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function DV(t){let e=Cd(Td.NUMERIC,Qe.NUMERIC,t),r=Cd(Td.ALPHANUMERIC,Qe.ALPHANUMERIC,t),n,i;return X1.isKanjiModeEnabled()?(n=Cd(Td.BYTE,Qe.BYTE,t),i=Cd(Td.KANJI,Qe.KANJI,t)):(n=Cd(Td.BYTE_KANJI,Qe.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,u){return o.index-u.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function QC(t,e){switch(e){case Qe.NUMERIC:return CV.getBitsLength(t);case Qe.ALPHANUMERIC:return NV.getBitsLength(t);case Qe.KANJI:return OV.getBitsLength(t);case Qe.BYTE:return xV.getBitsLength(t)}}function oge(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function age(t){let e=[];for(let r=0;r{h();var ew=ia(),KC=z1(),cge=j9(),lge=Q9(),fge=K9(),hge=Y9(),YC=J9(),JC=LC(),dge=rV(),Z1=cV(),gge=dV(),pge=oa(),WC=PV();function mge(t,e){let r=t.size,n=hge.getPositions(e);for(let i=0;i=0&&u<=6&&(a===0||a===6)||a>=0&&a<=6&&(u===0||u===6)||u>=2&&u<=4&&a>=2&&a<=4?t.set(s+u,o+a,!0,!0):t.set(s+u,o+a,!1,!0))}}function yge(t){let e=t.size;for(let r=8;r>u&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function $C(t,e,r){let n=t.size,i=gge.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function Age(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let u=r-1;u>0;u-=2)for(u===6&&u--;;){for(let a=0;a<2;a++)if(!t.isReserved(i,u-a)){let c=!1;o>>s&1)===1),t.set(i,u-a,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Ege(t,e,r){let n=new cge;r.forEach(function(a){n.put(a.mode.bit,4),n.put(a.getLength(),pge.getCharCountIndicator(a.mode,t)),a.write(n)});let i=ew.getSymbolTotalCodewords(t),s=JC.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let u=(o-n.getLengthInBits())/8;for(let a=0;a{if(!p.includes(":")||n)return;let S=yu(e[p].accounts);S.includes(p)||(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${p} + Required: ${p} + Approved: ${S.toString()}`))}),o.forEach(p=>{n||(Ka(i[p].methods,s[p].methods)?Ka(i[p].events,s[p].events)||(n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${p}`)):n=Wo("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${p}`))}),n}function Vge(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function oU(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Hge(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:yu(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function Gge(t,e){return wb(t,!1)&&t<=e.max&&t>=e.min}function zge(){let t=gu();return new Promise(e=>{switch(t){case _n.browser:e(Kk());break;case _n.reactNative:e(Wk());break;case _n.node:e($k());break;default:e(!0)}})}function Kk(){return K0()&&navigator?.onLine}async function Wk(){return rd()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function $k(){return!0}function jge(t){switch(gu()){case _n.browser:Yk(t);break;case _n.reactNative:Jk(t);break;case _n.node:break}}function Yk(t){!rd()&&K0()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Jk(t){rd()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var t8={},f8=class{static get(e){return t8[e]}static set(e,r){t8[e]=r}static delete(e){delete t8[e]}};K.BASE10=N8,K.BASE16=Tn,K.BASE64=O8,K.BASE64URL=Vpe,K.COLON=vde,K.DEFAULT_DEPTH=p8,K.EMPTY_SPACE=ib,K.ENV_MAP=_n,K.INTERNAL_ERRORS=Fk,K.MemoryStore=f8,K.ONE_THOUSAND=bde,K.REACT_NATIVE_PRODUCT=mU,K.RELAYER_DEFAULT_PROTOCOL=Ck,K.SDK_ERRORS=Lk,K.SDK_TYPE=vU,K.SLASH=yU,K.TYPE_0=P8,K.TYPE_1=cd,K.TYPE_2=$0,K.UTF8=ad,K.addResourceToRecap=Ek,K.appendToQueryString=bU,K.assertType=Tde,K.assignAbilityToActions=I8,K.base64Decode=wk,K.base64Encode=bk,K.buildApprovedNamespaces=Sge,K.buildAuthObject=Mpe,K.buildNamespacesFromAuth=_ge,K.buildRecapStatement=_k,K.calcExpiry=Fde,K.capitalize=Pde,K.capitalizeWord=TU,K.createDelayedPromise=Rde,K.createEncodedRecap=Fpe,K.createExpiringPromise=Mde,K.createRecap=Ak,K.decodeRecap=$a,K.decodeTypeByte=hu,K.decodeTypeTwoEnvelope=Jpe,K.decrypt=Ype,K.deriveSymKey=jpe,K.deserialize=vb,K.encodeRecap=mb,K.encodeTypeByte=M8,K.encodeTypeTwoEnvelope=$pe,K.encrypt=Wpe,K.engineEvent=Ude,K.enumify=Ode,K.formatAccountId=dU,K.formatAccountWithChain=lde,K.formatChainId=fU,K.formatDeeplinkUrl=IU,K.formatExpirerTarget=m8,K.formatIdTarget=Bde,K.formatMessage=gk,K.formatMessageContext=Ide,K.formatRelayParams=Ok,K.formatRelayRpcUrl=Sde,K.formatStatementFromRecap=x8,K.formatTopicTarget=Dde,K.formatUA=EU,K.formatUri=hge,K.fromBase64=y8,K.generateKeyPair=Gpe,K.generateRandomBytes32=zpe,K.getAccountsChains=yu,K.getAccountsFromNamespaces=dde,K.getAddressFromAccount=hU,K.getAddressesFromAccounts=fde,K.getAppMetadata=Ade,K.getBrowserOnlineStatus=Kk,K.getBundleId=wde,K.getChainFromAccount=pU,K.getChainsFromAccounts=gU,K.getChainsFromNamespace=hb,K.getChainsFromNamespaces=hde,K.getChainsFromRecap=kpe,K.getChainsFromRequiredNamespaces=pde,K.getCommonValuesInArrays=r8,K.getCryptoKeyFromKeyData=Ik,K.getDecodedRecapFromResources=mk,K.getDeepLink=Vde,K.getDidAddress=T8,K.getDidAddressSegments=gb,K.getDidChainId=_8,K.getEnvironment=gu,K.getHttpUrl=_de,K.getInternalError=Wo,K.getJavascriptID=AU,K.getJavascriptOS=wU,K.getLastItems=_U,K.getLinkModeURL=pge,K.getMethodsFromRecap=Upe,K.getNamespacedDidChainId=Ppe,K.getNamespacesChains=Pk,K.getNamespacesEventsForChainId=Mk,K.getNamespacesFromAccounts=Bk,K.getNamespacesMethodsForChainId=Rk,K.getNodeOnlineStatus=$k,K.getReCapActions=vk,K.getReactNativeOnlineStatus=Wk,K.getRecapAbilitiesFromResource=Lpe,K.getRecapFromResources=yb,K.getRecapResource=yk,K.getRelayClientMetadata=Ede,K.getRelayProtocolApi=sge,K.getRelayProtocolName=ige,K.getRequiredNamespacesFromNamespaces=Ege,K.getSdkError=pu,K.getSearchParamFromURL=Hde,K.getUniqueValues=h8,K.handleDeeplinkRedirect=kde,K.hasOverlap=Ka,K.hashKey=Qpe,K.hashMessage=Kpe,K.isBrowser=K0,K.isCaipNamespace=B8,K.isConformingNamespaces=Qk,K.isExpired=qde,K.isNode=g8,K.isOnline=zge,K.isProposalStruct=Cge,K.isReactNative=rd,K.isRecap=C8,K.isSessionCompatible=Tge,K.isSessionStruct=xge,K.isTelegram=CU,K.isTestRun=zde,K.isTypeOneEnvelope=Zpe,K.isTypeTwoEnvelope=ege,K.isUndefined=Wa,K.isValidAccountId=qk,K.isValidAccounts=Vk,K.isValidActions=Gk,K.isValidArray=Y0,K.isValidChainId=Q0,K.isValidChains=Uk,K.isValidController=Nge,K.isValidEip1271Signature=hk,K.isValidEip191Signature=dk,K.isValidErrorReason=Dge,K.isValidEvent=Fge,K.isValidId=Rge,K.isValidNamespaceAccounts=Hk,K.isValidNamespaceActions=L8,K.isValidNamespaceChains=kk,K.isValidNamespaceMethodsOrEvents=l8,K.isValidNamespaces=zk,K.isValidNamespacesChainId=qge,K.isValidNamespacesEvent=kge,K.isValidNamespacesRequest=Uge,K.isValidNumber=wb,K.isValidObject=bb,K.isValidParams=Mge,K.isValidRecap=uo,K.isValidRelay=jk,K.isValidRelays=Pge,K.isValidRequest=Bge,K.isValidRequestExpiry=Gge,K.isValidRequiredNamespaces=Oge,K.isValidResponse=Lge,K.isValidString=ti,K.isValidUrl=Ige,K.mapEntries=Nde,K.mapToObj=Cde,K.mergeArrays=$o,K.mergeEncodedRecaps=qpe,K.mergeRecaps=Sk,K.normalizeNamespaces=u8,K.objToMap=xde,K.parseAccountId=d8,K.parseChainId=lU,K.parseContextNames=SU,K.parseExpirerTarget=Lde,K.parseNamespaceKey=Dk,K.parseRelayParams=xk,K.parseTopic=Nk,K.parseUri=dge,K.populateAuthPayload=Dpe,K.recapHasResource=Bpe,K.serialize=D8,K.subscribeToBrowserNetworkChange=Yk,K.subscribeToNetworkChange=jge,K.subscribeToReactNativeNetworkChange=Jk,K.toBase64=xU,K.uuidv4=Gde,K.validateDecoding=Xpe,K.validateEncoding=Tk,K.validateSignedCacao=Rpe,K.verifyP256Jwt=nge,K.verifySignature=fk});var Xk,Zk,eV,tV,Ab,X0,F8,Eb,Ya,Z0,Sb=pe(()=>{h();Xk="PARSE_ERROR",Zk="INVALID_REQUEST",eV="METHOD_NOT_FOUND",tV="INVALID_PARAMS",Ab="INTERNAL_ERROR",X0="SERVER_ERROR",F8=[-32700,-32600,-32601,-32602,-32603],Eb=[-32e3,-32099],Ya={[Xk]:{code:-32700,message:"Parse error"},[Zk]:{code:-32600,message:"Invalid Request"},[eV]:{code:-32601,message:"Method not found"},[tV]:{code:-32602,message:"Invalid params"},[Ab]:{code:-32603,message:"Internal error"},[X0]:{code:-32e3,message:"Server error"}},Z0=X0});function Qge(t){return t<=Eb[0]&&t>=Eb[1]}function _b(t){return F8.includes(t)}function rV(t){return typeof t=="number"}function Tb(t){return Object.keys(Ya).includes(t)?Ya[t]:Ya[Z0]}function Ib(t){let e=Object.values(Ya).find(r=>r.code===t);return e||Ya[Z0]}function Kge(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!rV(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(_b(t.error.code)){let e=Ib(t.error.code);if(e.message!==Ya[Z0].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function q8(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var U8=pe(()=>{h();Sb()});var iV=L(Ja=>{"use strict";h();Object.defineProperty(Ja,"__esModule",{value:!0});Ja.isBrowserCryptoAvailable=Ja.getSubtleCrypto=Ja.getBrowerCrypto=void 0;function k8(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Ja.getBrowerCrypto=k8;function nV(){let t=k8();return t.subtle||t.webkitSubtle}Ja.getSubtleCrypto=nV;function Wge(){return!!k8()&&!!nV()}Ja.isBrowserCryptoAvailable=Wge});var aV=L(Xa=>{"use strict";h();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.isBrowser=Xa.isNode=Xa.isReactNative=void 0;function sV(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Xa.isReactNative=sV;function oV(){return typeof O.default<"u"&&typeof O.default.versions<"u"&&typeof O.default.versions.node<"u"}Xa.isNode=oV;function $ge(){return!sV()&&!oV()}Xa.isBrowser=$ge});var V8=L(Cb=>{"use strict";h();Object.defineProperty(Cb,"__esModule",{value:!0});var cV=(hf(),qe(df));cV.__exportStar(iV(),Cb);cV.__exportStar(aV(),Cb)});var Qr={};Zt(Qr,{isNodeJs:()=>lV});var uV,lV,fV=pe(()=>{h();uV=ge(V8());$r(Qr,ge(V8()));lV=uV.isNode});function H8(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function G8(t=6){return BigInt(H8(t))}function z8(t,e,r){return{id:r||H8(),jsonrpc:"2.0",method:t,params:e}}function Yge(t,e){return{id:t,jsonrpc:"2.0",result:e}}function j8(t,e,r){return{id:t,jsonrpc:"2.0",error:dV(e,r)}}function dV(t,e){return typeof t>"u"?Tb(Ab):(typeof t=="string"&&(t=Object.assign(Object.assign({},Tb(X0)),{message:t})),typeof e<"u"&&(t.data=e),_b(t.code)&&(t=Ib(t.code)),t)}var hV=pe(()=>{h();U8();Sb()});function Jge(t){return t.includes("*")?Nb(t):!/\W/g.test(t)}function xb(t){return t==="*"}function Nb(t){return xb(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function Xge(t){return!xb(t)&&Nb(t)&&!t.split("*")[0].trim()}function Zge(t){return!xb(t)&&Nb(t)&&!t.split("*")[1].trim()}var pV=pe(()=>{h()});var ep,Q8,Ob,tp,gV=pe(()=>{h();ep=class{},Q8=class extends ep{constructor(e){super()}},Ob=class extends ep{constructor(){super()}},tp=class extends Ob{constructor(e){super()}}});var mV=pe(()=>{h();gV()});function rme(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function yV(t,e){let r=rme(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function nme(t){return yV(t,eme)}function Pb(t){return yV(t,tme)}function K8(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var eme,tme,vV=pe(()=>{h();eme="^https?:",tme="^wss?:"});function W8(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function ime(t){return W8(t)&&"method"in t}function $8(t){return W8(t)&&(bV(t)||Rb(t))}function bV(t){return"result"in t}function Rb(t){return"error"in t}function sme(t){return"error"in t&&t.valid===!1}var wV=pe(()=>{h()});var yn={};Zt(yn,{DEFAULT_ERROR:()=>Z0,IBaseJsonRpcProvider:()=>Ob,IEvents:()=>ep,IJsonRpcConnection:()=>Q8,IJsonRpcProvider:()=>tp,INTERNAL_ERROR:()=>Ab,INVALID_PARAMS:()=>tV,INVALID_REQUEST:()=>Zk,METHOD_NOT_FOUND:()=>eV,PARSE_ERROR:()=>Xk,RESERVED_ERROR_CODES:()=>F8,SERVER_ERROR:()=>X0,SERVER_ERROR_CODE_RANGE:()=>Eb,STANDARD_ERROR_MAP:()=>Ya,formatErrorMessage:()=>dV,formatJsonRpcError:()=>j8,formatJsonRpcRequest:()=>z8,formatJsonRpcResult:()=>Yge,getBigIntRpcId:()=>G8,getError:()=>Tb,getErrorByCode:()=>Ib,isHttpUrl:()=>nme,isJsonRpcError:()=>Rb,isJsonRpcPayload:()=>W8,isJsonRpcRequest:()=>ime,isJsonRpcResponse:()=>$8,isJsonRpcResult:()=>bV,isJsonRpcValidationInvalid:()=>sme,isLocalhostUrl:()=>K8,isNodeJs:()=>lV,isReservedErrorCode:()=>_b,isServerErrorCode:()=>Qge,isValidDefaultRoute:()=>xb,isValidErrorCode:()=>rV,isValidLeadingWildcardRoute:()=>Xge,isValidRoute:()=>Jge,isValidTrailingWildcardRoute:()=>Zge,isValidWildcardRoute:()=>Nb,isWsUrl:()=>Pb,parseConnectionError:()=>q8,payloadId:()=>H8,validateJsonRpcError:()=>Kge});var rp=pe(()=>{h();Sb();U8();fV();$r(yn,Qr);hV();pV();mV();vV();wV()});var EV={};Zt(EV,{JsonRpcProvider:()=>Y8,default:()=>Y8});var AV,Y8,SV=pe(()=>{h();AV=ge(_o());rp();Y8=class extends tp{constructor(e){super(e),this.events=new AV.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(z8(e.method,e.params||[],e.id||G8().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Rb(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),$8(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}});var TV=L((EPe,_V)=>{"use strict";h();_V.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var NV={};Zt(NV,{WsConnection:()=>J8,default:()=>J8});var xV,ome,ame,IV,CV,cme,J8,OV=pe(()=>{h();xV=ge(_o());vf();rp();ome=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:TV(),ame=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",IV=t=>t.split("?")[0],CV=10,cme=ome(),J8=class{constructor(e){if(this.url=e,this.events=new xV.EventEmitter,this.registering=!1,!Pb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ns(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!Pb(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=new URLSearchParams(e).get("origin"),s=(0,yn.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!K8(e)},o=new cme(e,[],s);ame()?o.onerror=c=>{let a=c;n(this.emitError(a.error))}:o.on("error",c=>{n(this.emitError(c))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Ra(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=j8(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return q8(e,IV(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>CV&&this.events.setMaxListeners(CV)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${IV(this.url)}`));return this.events.emit("register_error",r),r}}});var fH=L((np,ld)=>{h();var ume=200,c4="__lodash_hash_undefined__",kb=1,HV=2,GV=9007199254740991,Mb="[object Arguments]",t4="[object Array]",lme="[object AsyncFunction]",zV="[object Boolean]",jV="[object Date]",QV="[object Error]",KV="[object Function]",fme="[object GeneratorFunction]",Db="[object Map]",WV="[object Number]",dme="[object Null]",ud="[object Object]",PV="[object Promise]",hme="[object Proxy]",$V="[object RegExp]",Bb="[object Set]",YV="[object String]",pme="[object Symbol]",gme="[object Undefined]",r4="[object WeakMap]",JV="[object ArrayBuffer]",Lb="[object DataView]",mme="[object Float32Array]",yme="[object Float64Array]",vme="[object Int8Array]",bme="[object Int16Array]",wme="[object Int32Array]",Ame="[object Uint8Array]",Eme="[object Uint8ClampedArray]",Sme="[object Uint16Array]",_me="[object Uint32Array]",Tme=/[\\^$.*+?()[\]{}|]/g,Ime=/^\[object .+?Constructor\]$/,Cme=/^(?:0|[1-9]\d*)$/,sr={};sr[mme]=sr[yme]=sr[vme]=sr[bme]=sr[wme]=sr[Ame]=sr[Eme]=sr[Sme]=sr[_me]=!0;sr[Mb]=sr[t4]=sr[JV]=sr[zV]=sr[Lb]=sr[jV]=sr[QV]=sr[KV]=sr[Db]=sr[WV]=sr[ud]=sr[$V]=sr[Bb]=sr[YV]=sr[r4]=!1;var XV=typeof global=="object"&&global&&global.Object===Object&&global,xme=typeof self=="object"&&self&&self.Object===Object&&self,Yo=XV||xme||Function("return this")(),ZV=typeof np=="object"&&np&&!np.nodeType&&np,RV=ZV&&typeof ld=="object"&&ld&&!ld.nodeType&&ld,eH=RV&&RV.exports===ZV,X8=eH&&XV.process,MV=function(){try{return X8&&X8.binding&&X8.binding("util")}catch{}}(),DV=MV&&MV.isTypedArray;function Nme(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function s1e(t,e){var r=this.__data__,n=Hb(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Jo.prototype.clear=t1e;Jo.prototype.delete=r1e;Jo.prototype.get=n1e;Jo.prototype.has=i1e;Jo.prototype.set=s1e;function wu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ec))return!1;var u=s.get(t);if(u&&s.get(e))return u==e;var f=-1,p=!0,S=r&HV?new qb:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=GV}function uH(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function op(t){return t!=null&&typeof t=="object"}var lH=DV?Mme(DV):E1e;function L1e(t){return D1e(t)?v1e(t):S1e(t)}function F1e(){return[]}function q1e(){return!1}ld.exports=B1e});var SG=L(le=>{"use strict";h();Object.defineProperty(le,"__esModule",{value:!0});var Eu=_o(),pd=(GD(),qe(HD)),U1e=(c9(),qe(a9)),Vt=(N6(),qe(x6)),gs=$6(),Ge=yf(),u4=(vf(),qe(s9)),d4=($T(),qe(WT)),ne=J0(),k1e=(aI(),qe(oI)),V1e=(SV(),qe(EV)),zn=(rp(),qe(yn)),H1e=(OV(),qe(NV)),G1e=fH();function sw(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function z1e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var j1e=sw(Eu),Q1e=sw(U1e),zb=z1e(d4),K1e=sw(H1e),W1e=sw(G1e),T4="wc",I4=2,ow="core",ps=`${T4}@2:${ow}:`,OH={name:ow,logger:"error"},PH={database:":memory:"},RH="crypto",h4="client_ed25519_seed",MH=Ge.ONE_DAY,DH="keychain",BH="0.3",LH="messages",FH="0.3",qH=Ge.SIX_HOURS,UH="publisher",kH="irn",VH="error",C4="wss://relay.walletconnect.org",HH="relayer",jn={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},GH="_subscription",ri={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},zH=.1,$1e={database:":memory:"},jb="2.17.0",Y1e=1e4,tc={link_mode:"link_mode",relay:"relay"},jH="0.3",QH="WALLETCONNECT_CLIENT_ID",p4="WALLETCONNECT_LINK_MODE_APPS",hs={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},J1e=Ge.THIRTY_DAYS,KH="subscription",WH="0.3",$H=Ge.FIVE_SECONDS*1e3,YH="pairing",JH="0.3",X1e=Ge.THIRTY_DAYS,dd={wc_pairingDelete:{req:{ttl:Ge.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Ge.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Ge.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Ge.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Ge.ONE_DAY,prompt:!1,tag:0},res:{ttl:Ge.ONE_DAY,prompt:!1,tag:0}}},hd={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Bi={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},XH="history",ZH="0.3",eG="expirer",Li={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},tG="0.3",Z1e=Ge.ONE_DAY,rG="verify-api",eye="https://verify.walletconnect.com",nG="https://verify.walletconnect.org",lp=nG,iG=`${lp}/v3`,sG=[eye,nG],oG="echo",aG="https://echo.walletconnect.com",tye="event-client",ho={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Xo={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},rye={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},nye={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},iye={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},sye={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},cG=.1,uG="event-client",lG=86400,fG="https://pulse.walletconnect.org/batch";function oye(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,H=new Uint8Array(z);U!==k;){for(var F=N[U],V=0,q=z-1;(F!==0||V>>0,H[q]=F%c>>>0,F=F/c>>>0;if(F!==0)throw new Error("Non-zero carry");D=V,U++}for(var C=z-D;C!==z&&H[C]===0;)C++;for(var B=a.repeat(R);C>>0,z=new Uint8Array(k);N[R];){var H=r[N.charCodeAt(R)];if(H===255)return;for(var F=0,V=k-1;(H!==0||F>>0,z[V]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");U=F,R++}if(N[R]!==" "){for(var q=k-U;q!==k&&z[q]===0;)q++;for(var C=new Uint8Array(D+(k-q)),B=D;q!==k;)C[B++]=z[q++];return C}}}function I(N){var R=S(N);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:S,decode:I}}var aye=oye,cye=aye,dG=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},uye=t=>new TextEncoder().encode(t),lye=t=>new TextDecoder().decode(t),g4=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},m4=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hG(this,e)}},y4=class{constructor(e){this.decoders=e}or(e){return hG(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},hG=(t,e)=>new y4({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),v4=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new g4(e,r,n),this.decoder=new m4(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},aw=({name:t,prefix:e,encode:r,decode:n})=>new v4(t,e,r,n),fp=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=cye(r,e);return aw({prefix:t,name:e,encode:n,decode:s=>dG(i(s))})},fye=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(c-=8,o[u++]=255&a>>c)}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return o},dye=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&c>>o];if(o&&(s+=e[i&c<aw({prefix:e,name:t,encode(i){return dye(i,n,r)},decode(i){return fye(i,n,r,t)}}),hye=aw({prefix:"\0",name:"identity",encode:t=>lye(t),decode:t=>uye(t)}),pye=Object.freeze({__proto__:null,identity:hye}),gye=en({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),mye=Object.freeze({__proto__:null,base2:gye}),yye=en({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),vye=Object.freeze({__proto__:null,base8:yye}),bye=fp({prefix:"9",name:"base10",alphabet:"0123456789"}),wye=Object.freeze({__proto__:null,base10:bye}),Aye=en({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Eye=en({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Sye=Object.freeze({__proto__:null,base16:Aye,base16upper:Eye}),_ye=en({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Tye=en({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Iye=en({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cye=en({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),xye=en({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Nye=en({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Oye=en({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Pye=en({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Rye=en({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Mye=Object.freeze({__proto__:null,base32:_ye,base32upper:Tye,base32pad:Iye,base32padupper:Cye,base32hex:xye,base32hexupper:Nye,base32hexpad:Oye,base32hexpadupper:Pye,base32z:Rye}),Dye=fp({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Bye=fp({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Lye=Object.freeze({__proto__:null,base36:Dye,base36upper:Bye}),Fye=fp({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),qye=fp({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Uye=Object.freeze({__proto__:null,base58btc:Fye,base58flickr:qye}),kye=en({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Vye=en({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Hye=en({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gye=en({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),zye=Object.freeze({__proto__:null,base64:kye,base64pad:Vye,base64url:Hye,base64urlpad:Gye}),pG=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}"),jye=pG.reduce((t,e,r)=>(t[r]=e,t),[]),Qye=pG.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Kye(t){return t.reduce((e,r)=>(e+=jye[r],e),"")}function Wye(t){let e=[];for(let r of t){let n=Qye[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var $ye=aw({prefix:"\u{1F680}",name:"base256emoji",encode:Kye,decode:Wye}),Yye=Object.freeze({__proto__:null,base256emoji:$ye}),Jye=gG,dH=128,Xye=127,Zye=~Xye,eve=Math.pow(2,31);function gG(t,e,r){e=e||[],r=r||0;for(var n=r;t>=eve;)e[r++]=t&255|dH,t/=128;for(;t&Zye;)e[r++]=t&255|dH,t>>>=7;return e[r]=t|0,gG.bytes=r-n+1,e}var tve=b4,rve=128,hH=127;function b4(t,n){var r=0,n=n||0,i=0,s=n,o,c=t.length;do{if(s>=c)throw b4.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&hH)<=rve);return b4.bytes=s-n,r}var nve=Math.pow(2,7),ive=Math.pow(2,14),sve=Math.pow(2,21),ove=Math.pow(2,28),ave=Math.pow(2,35),cve=Math.pow(2,42),uve=Math.pow(2,49),lve=Math.pow(2,56),fve=Math.pow(2,63),dve=function(t){return t(mG.encode(t,e,r),e),gH=t=>mG.encodingLength(t),w4=(t,e)=>{let r=e.byteLength,n=gH(t),i=n+gH(r),s=new Uint8Array(i+r);return pH(t,s,0),pH(r,s,n),s.set(e,i),new A4(t,r,e,s)},A4=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},yG=({name:t,code:e,encode:r})=>new E4(t,e,r),E4=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?w4(this.code,r):r.then(n=>w4(this.code,n))}else throw Error("Unknown type, must be binary type")}},vG=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),pve=yG({name:"sha2-256",code:18,encode:vG("SHA-256")}),gve=yG({name:"sha2-512",code:19,encode:vG("SHA-512")}),mve=Object.freeze({__proto__:null,sha256:pve,sha512:gve}),bG=0,yve="identity",wG=dG,vve=t=>w4(bG,wG(t)),bve={code:bG,name:yve,encode:wG,digest:vve},wve=Object.freeze({__proto__:null,identity:bve});new TextEncoder,new TextDecoder;var mH={...pye,...mye,...vye,...wye,...Sye,...Mye,...Lye,...Uye,...zye,...Yye};({...mve,...wve});function Ave(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function AG(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var yH=AG("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),l4=AG("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ave(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Vt.generateChildLogger(r,this.name)}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Kb=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=RH,this.randomSessionIdentifier=ne.generateRandomBytes32(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=zb.generateKeyPair(i);return zb.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ne.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=zb.generateKeyPair(s),c=this.randomSessionIdentifier,a=MH;return await zb.signJWT(c,i,a,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let c=this.getPrivateKey(i),a=ne.deriveSymKey(c,s);return this.setSymKey(a,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ne.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let c=ne.validateEncoding(o),a=u4.safeJsonStringify(s);if(ne.isTypeTwoEnvelope(c))return ne.encodeTypeTwoEnvelope(a,o?.encoding);if(ne.isTypeOneEnvelope(c)){let S=c.senderPublicKey,I=c.receiverPublicKey;i=await this.generateSharedKey(S,I)}let u=this.getSymKey(i),{type:f,senderPublicKey:p}=c;return ne.encrypt({type:f,symKey:u,message:a,senderPublicKey:p,encoding:o?.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();let c=ne.validateDecoding(s,o);if(ne.isTypeTwoEnvelope(c)){let a=ne.decodeTypeTwoEnvelope(s,o?.encoding);return u4.safeJsonParse(a)}if(ne.isTypeOneEnvelope(c)){let a=c.receiverPublicKey,u=c.senderPublicKey;i=await this.generateSharedKey(a,u)}try{let a=this.getSymKey(i),u=ne.decrypt({symKey:a,encoded:s,encoding:o?.encoding});return u4.safeJsonParse(u)}catch(a){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(a)}},this.getPayloadType=(i,s=ne.BASE64)=>{let o=ne.deserialize({encoded:i,encoding:s});return ne.decodeTypeByte(o.type)},this.getPayloadSenderPublicKey=(i,s=ne.BASE64)=>{let o=ne.deserialize({encoded:i,encoding:s});return o.senderPublicKey?k1e.toString(o.senderPublicKey,ne.BASE16):void 0},this.core=e,this.logger=Vt.generateChildLogger(r,this.name),this.keychain=n||new Qb(this.core,this.logger)}get context(){return Vt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(h4)}catch{e=ne.generateRandomBytes32(),await this.keychain.set(h4,e)}return Sve(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Wb=class extends gs.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=LH,this.version=FH,this.initialized=!1,this.storagePrefix=ps,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ne.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ne.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Vt.generateChildLogger(e,this.name),this.core=r}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ne.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ne.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},S4=class extends gs.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Eu.EventEmitter,this.name=UH,this.queue=new Map,this.publishTimeout=Ge.toMiliseconds(Ge.ONE_MINUTE),this.failedPublishTimeout=Ge.toMiliseconds(Ge.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});let c=s?.ttl||qH,a=ne.getRelayProtocolName(s),u=s?.prompt||!1,f=s?.tag||0,p=s?.id||zn.getBigIntRpcId().toString(),S={topic:n,message:i,opts:{ttl:c,relay:a,prompt:u,tag:f,id:p,attestation:s?.attestation}},I=`Failed to publish payload, please try again. id:${p} tag:${f}`,N=Date.now(),R,D=1;try{for(;R===void 0;){if(Date.now()-N>this.publishTimeout)throw new Error(I);this.logger.trace({id:p,attempts:D},`publisher.publish - attempt ${D}`),R=await await ne.createExpiringPromise(this.rpcPublish(n,i,c,a,u,f,p,s?.attestation).catch(U=>this.logger.warn(U)),this.publishTimeout,I),D++,R||await new Promise(U=>setTimeout(U,this.failedPublishTimeout))}this.relayer.events.emit(jn.publish,S),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:p,topic:n,message:i,opts:s}})}catch(U){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(U),(o=s?.internal)!=null&&o.throwOnFailedPublish)throw U;this.queue.set(p,S)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Vt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Vt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,c,a){var u,f,p,S;let I={method:ne.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:a},id:c};return ne.isUndefined((u=I.params)==null?void 0:u.prompt)&&((f=I.params)==null||delete f.prompt),ne.isUndefined((p=I.params)==null?void 0:p.tag)&&((S=I.params)==null||delete S.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:I}),this.relayer.request(I)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(jn.connection_stalled);return}this.checkQueue()}),this.relayer.on(jn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},_4=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},_ve=Object.defineProperty,Tve=Object.defineProperties,Ive=Object.getOwnPropertyDescriptors,vH=Object.getOwnPropertySymbols,Cve=Object.prototype.hasOwnProperty,xve=Object.prototype.propertyIsEnumerable,bH=(t,e,r)=>e in t?_ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cp=(t,e)=>{for(var r in e||(e={}))Cve.call(e,r)&&bH(t,r,e[r]);if(vH)for(var r of vH(e))xve.call(e,r)&&bH(t,r,e[r]);return t},f4=(t,e)=>Tve(t,Ive(e)),$b=class extends gs.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new _4,this.events=new Eu.EventEmitter,this.name=KH,this.version=WH,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ps,this.subscribeTimeout=Ge.toMiliseconds(Ge.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ne.getRelayProtocolName(i),o={topic:n,relay:s,transportType:i?.transportType};this.pending.set(n,o);let c=await this.rpcSubscribe(n,s,i?.transportType);return typeof c=="string"&&(this.onSubscribe(c,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),c}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;let i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{let c=new Ge.Watch;c.start(i);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),c.stop(i),s(!0)),c.elapsed(i)>=$H&&(clearInterval(a),c.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Vt.generateChildLogger(r,this.name),this.clientId=""}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ne.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ne.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n=tc.relay){n===tc.relay&&await this.restartToComplete();let i={method:ne.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{let s=ne.hashMessage(e+this.clientId);return n===tc.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch(o=>this.logger.warn(o))},Ge.toMiliseconds(Ge.ONE_SECOND)),s):await await ne.createExpiringPromise(this.relayer.request(i).catch(o=>this.logger.warn(o)),this.subscribeTimeout)?s:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(jn.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ne.createExpiringPromise(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(jn.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;let r=e[0].relay,n={method:ne.getRelayProtocolApi(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ne.createExpiringPromise(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(jn.connection_stalled)}return i}rpcUnsubscribe(e,r,n){let i={method:ne.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,f4(cp({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,cp({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,cp({},r)),this.topicMap.set(r.topic,e),this.events.emit(hs.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(hs.deleted,f4(cp({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(hs.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ne.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>f4(cp({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(hs.created,async e=>{let r=hs.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(hs.deleted,async e=>{let r=hs.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},Nve=Object.defineProperty,wH=Object.getOwnPropertySymbols,Ove=Object.prototype.hasOwnProperty,Pve=Object.prototype.propertyIsEnumerable,AH=(t,e,r)=>e in t?Nve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rve=(t,e)=>{for(var r in e||(e={}))Ove.call(e,r)&&AH(t,r,e[r]);if(wH)for(var r of wH(e))Pve.call(e,r)&&AH(t,r,e[r]);return t},Yb=class extends gs.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Eu.EventEmitter,this.name=HH,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=Ge.toMiliseconds(Ge.THIRTY_SECONDS+Ge.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");let s=r.id||zn.getBigIntRpcId().toString();await this.toEstablishConnection();try{let o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");let c=await new Promise(async(a,u)=>{let f=()=>{u(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(ri.disconnect,f);let p=await o;this.provider.off(ri.disconnect,f),a(p)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(ne.isNode())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(jn.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(jn.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(ri.payload,this.onPayloadHandler),this.provider.on(ri.connect,this.onConnectHandler),this.provider.on(ri.disconnect,this.onDisconnectHandler),this.provider.on(ri.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Vt.generateChildLogger(e.logger,this.name):Vt.pino(Vt.getDefaultLoggerOptions({level:e.logger||VH})),this.messages=new Wb(this.logger,e.core),this.subscriber=new $b(this,this.logger),this.publisher=new S4(this,this.logger),this.relayUrl=e?.relayUrl||C4,this.projectId=e.projectId,this.bundleId=ne.getBundleId(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Vt.getLoggerContext(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:tc.relay})}async subscribe(e,r){var n;this.isInitialized(),r?.transportType==="relay"&&await this.toEstablishConnection();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",s,o=c=>{c.topic===e&&(this.subscriber.off(hs.created,o),s())};return await Promise.all([new Promise(c=>{s=c,this.subscriber.on(hs.created,o)}),new Promise(async c=>{i=await this.subscriber.subscribe(e,r)||i,c()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await ne.createExpiringPromise(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{let i=()=>{this.provider.off(ri.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(ri.disconnect,i),await ne.createExpiringPromise(this.provider.connect(),Ge.toMiliseconds(Ge.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);let n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ne.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}let r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(let n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){let{topic:n}=e;if(!r.sessionExists){let i=ne.calcExpiry(Ge.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(jn.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(ne.isNode())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new V1e.JsonRpcProvider(new K1e.default(ne.formatRelayRpcUrl({sdkVersion:jb,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),zn.isJsonRpcRequest(e)){if(!e.method.endsWith(GH))return;let r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,c={topic:n,message:i,publishedAt:s,transportType:tc.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Rve({type:"event",event:r.id},c)),this.events.emit(r.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else zn.isJsonRpcResponse(e)&&this.events.emit(jn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(jn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=zn.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(ri.payload,this.onPayloadHandler),this.provider.off(ri.connect,this.onConnectHandler),this.provider.off(ri.disconnect,this.onDisconnectHandler),this.provider.off(ri.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await ne.isOnline();ne.subscribeToNetworkChange(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(jn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},Ge.toMiliseconds(zH))))}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}},Mve=Object.defineProperty,EH=Object.getOwnPropertySymbols,Dve=Object.prototype.hasOwnProperty,Bve=Object.prototype.propertyIsEnumerable,SH=(t,e,r)=>e in t?Mve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_H=(t,e)=>{for(var r in e||(e={}))Dve.call(e,r)&&SH(t,r,e[r]);if(EH)for(var r of EH(e))Bve.call(e,r)&&SH(t,r,e[r]);return t},Jb=class extends gs.IStore{constructor(e,r,n,i=ps,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=jH,this.cached=[],this.initialized=!1,this.storagePrefix=ps,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ne.isUndefined(o)?this.map.set(this.getKey(o),o):ne.isProposalStruct(o)?this.map.set(o.id,o):ne.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),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(c=>Object.keys(o).every(a=>W1e.default(c[a],o[a]))):this.values),this.update=async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});let a=_H(_H({},this.getData(o)),c);this.map.set(o,a),await this.persist()},this.delete=async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=Vt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Xb=class{constructor(e,r){this.core=e,this.logger=r,this.name=YH,this.version=JH,this.events=new j1e.default,this.initialized=!1,this.storagePrefix=ps,this.ignoredPayloadTypes=[ne.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();let i=ne.generateRandomBytes32(),s=await this.core.crypto.setSymKey(i),o=ne.calcExpiry(Ge.FIVE_MINUTES),c={protocol:kH},a={topic:s,expiry:o,relay:c,active:!1,methods:n?.methods},u=ne.formatUri({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:c,expiryTimestamp:o,methods:n?.methods});return this.events.emit(hd.create,a),this.core.expirer.set(s,o),await this.pairings.set(s,a),await this.core.relayer.subscribe(s,{transportType:n?.transportType}),{topic:s,uri:u}},this.pair=async n=>{this.isInitialized();let i=this.core.eventClient.createEvent({properties:{topic:n?.uri,trace:[ho.pairing_started]}});this.isValidPair(n,i);let{topic:s,symKey:o,relay:c,expiryTimestamp:a,methods:u}=ne.parseUri(n.uri);i.props.properties.topic=s,i.addTrace(ho.pairing_uri_validation_success),i.addTrace(ho.pairing_uri_not_expired);let f;if(this.pairings.keys.includes(s)){if(f=this.pairings.get(s),i.addTrace(ho.existing_pairing),f.active)throw i.setError(Xo.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(ho.pairing_not_expired)}let p=a||ne.calcExpiry(Ge.FIVE_MINUTES),S={topic:s,relay:c,expiry:p,active:!1,methods:u};this.core.expirer.set(s,p),await this.pairings.set(s,S),i.addTrace(ho.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(hd.create,S),i.addTrace(ho.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(ho.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Xo.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(I){throw i.setError(Xo.subscribe_pairing_topic_failure),I}return i.addTrace(ho.subscribe_pairing_topic_success),S},this.activate=async({topic:n})=>{this.isInitialized();let i=ne.calcExpiry(Ge.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:c,reject:a}=ne.createDelayedPromise();this.events.once(ne.engineEvent("pairing_ping",s),({error:u})=>{u?a(u):c()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ne.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();let{topic:i,relay:s,expiry:o,methods:c}=n,a=this.core.crypto.keychain.get(i);return ne.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:a,relay:s,expiryTimestamp:o,methods:c})},this.sendRequest=async(n,i,s)=>{let o=zn.formatJsonRpcRequest(i,s),c=await this.core.crypto.encode(n,o),a=dd[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,a),o.id},this.sendResult=async(n,i,s)=>{let o=zn.formatJsonRpcResult(n,s),c=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),u=dd[a.request.method].res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=zn.formatJsonRpcError(n,s),c=await this.core.crypto.encode(i,o),a=await this.core.history.get(i,n),u=dd[a.request.method]?dd[a.request.method].res:dd.unregistered_method.res;await this.core.relayer.publish(i,c,u),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ne.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ne.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(hd.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{zn.isJsonRpcResult(i)?this.events.emit(ne.engineEvent("pairing_ping",s),{}):zn.isJsonRpcError(i)&&this.events.emit(ne.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(hd.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let c=ne.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ne.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!ne.isValidParams(n)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Xo.malformed_pairing_uri),new Error(c)}if(!ne.isValidUrl(n.uri)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Xo.malformed_pairing_uri),new Error(c)}let o=ne.parseUri(n?.uri);if(!((s=o?.relay)!=null&&s.protocol)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Xo.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){let{message:c}=ne.getInternalError("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Xo.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&Ge.toMiliseconds(o?.expiryTimestamp){if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ne.isValidParams(n)){let{message:s}=ne.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ne.isValidString(n,!1)){let{message:i}=ne.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ne.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ne.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ne.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Vt.generateChildLogger(r,this.name),this.pairings=new Jb(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Vt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(jn.message,async e=>{let{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===tc.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let s=await this.core.crypto.decode(r,n);try{zn.isJsonRpcRequest(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):zn.isJsonRpcResponse(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Li.expired,async e=>{let{topic:r}=ne.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(hd.expire,{topic:r}))})}},Zb=class extends gs.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Eu.EventEmitter,this.name=XH,this.version=ZH,this.cached=[],this.initialized=!1,this.storagePrefix=ps,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ne.calcExpiry(Ge.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Bi.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=zn.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Bi.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Bi.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Vt.generateChildLogger(r,this.name)}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:zn.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Bi.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Bi.created,e=>{let r=Bi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Bi.updated,e=>{let r=Bi.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Bi.deleted,e=>{let r=Bi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{Ge.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Bi.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ew=class extends gs.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Eu.EventEmitter,this.name=eG,this.version=tG,this.cached=[],this.initialized=!1,this.storagePrefix=ps,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Li.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Li.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Vt.generateChildLogger(r,this.name)}get context(){return Vt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ne.formatTopicTarget(e);if(typeof e=="number")return ne.formatIdTarget(e);let{message:r}=ne.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Li.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ne.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ne.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;Ge.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Li.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Li.created,e=>{let r=Li.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Li.expired,e=>{let r=Li.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Li.deleted,e=>{let r=Li.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ne.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},or={};Object.defineProperty(or,"__esModule",{value:!0}),or.getLocalStorage=or.getLocalStorageOrThrow=or.getCrypto=or.getCryptoOrThrow=or.getLocation=or.getLocationOrThrow=or.getNavigator=or.getNavigatorOrThrow=EG=or.getDocument=or.getDocumentOrThrow=or.getFromWindowOrThrow=or.getFromWindow=void 0;function Su(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}or.getFromWindow=Su;function gd(t){let e=Su(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}or.getFromWindowOrThrow=gd;function Lve(){return gd("document")}or.getDocumentOrThrow=Lve;function Fve(){return Su("document")}var EG=or.getDocument=Fve;function qve(){return gd("navigator")}or.getNavigatorOrThrow=qve;function Uve(){return Su("navigator")}or.getNavigator=Uve;function kve(){return gd("location")}or.getLocationOrThrow=kve;function Vve(){return Su("location")}or.getLocation=Vve;function Hve(){return gd("crypto")}or.getCryptoOrThrow=Hve;function Gve(){return Su("crypto")}or.getCrypto=Gve;function zve(){return gd("localStorage")}or.getLocalStorageOrThrow=zve;function jve(){return Su("localStorage")}or.getLocalStorage=jve;var tw=class extends gs.IVerify{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=rG,this.verifyUrlV3=iG,this.storagePrefix=ps,this.version=I4,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Ge.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!ne.isBrowser()||this.isDevEnv)return;let s=window.location.origin,{id:o,decryptedId:c}=i,a=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{let u=EG(),f=this.startAbortTimer(Ge.ONE_SECOND*5),p=await new Promise((S,I)=>{let N=()=>{window.removeEventListener("message",D),u.body.removeChild(R),I("attestation aborted")};this.abortController.signal.addEventListener("abort",N);let R=u.createElement("iframe");R.src=a,R.style.display="none",R.addEventListener("error",N,{signal:this.abortController.signal});let D=U=>{if(U.data&&typeof U.data=="string")try{let k=JSON.parse(U.data);if(k.type==="verify_attestation"){if(d4.decodeJWT(k.attestation).payload.id!==o)return;clearInterval(f),u.body.removeChild(R),this.abortController.signal.removeEventListener("abort",N),window.removeEventListener("message",D),S(k.attestation===null?"":k.attestation)}}catch(k){this.logger.warn(k)}};u.body.appendChild(R),window.addEventListener("message",D,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",p),p}catch(u){this.logger.warn(u)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";let{attestationId:s,hash:o,encryptedId:c}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(d4.decodeJWT(s).payload.id!==c)return;let u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;let a=this.getVerifyUrl(i?.verifyUrl);return this.fetchAttestation(o,a)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);let o=this.startAbortTimer(Ge.ONE_SECOND*5),c=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0},this.getVerifyUrl=i=>{let s=i||lp;return sG.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${lp}`),s=lp),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let i=this.startAbortTimer(Ge.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{let s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}let o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{let o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});let i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{let o=ne.verifyP256Jwt(i,s.publicKey),c={hasExpired:Ge.toMiliseconds(o.exp)this.abortController.abort(),Ge.toMiliseconds(e))}},rw=class extends gs.IEchoClient{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=oG,this.registerDeviceToken=async n=>{let{clientId:i,token:s,notificationType:o,enableEncrypted:c=!1}=n,a=`${aG}/${this.projectId}/clients`;await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:c})})},this.logger=Vt.generateChildLogger(r,this.context)}},Qve=Object.defineProperty,TH=Object.getOwnPropertySymbols,Kve=Object.prototype.hasOwnProperty,Wve=Object.prototype.propertyIsEnumerable,IH=(t,e,r)=>e in t?Qve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,up=(t,e)=>{for(var r in e||(e={}))Kve.call(e,r)&&IH(t,r,e[r]);if(TH)for(var r of TH(e))Wve.call(e,r)&&IH(t,r,e[r]);return t},nw=class extends gs.IEventClient{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=uG,this.storagePrefix=ps,this.storageVersion=cG,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!ne.isTestRun())try{let i={eventId:ne.uuidv4(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:ne.formatUA(this.core.relayer.protocol,this.core.relayer.version,jb)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{let{event:s="ERROR",type:o="",properties:{topic:c,trace:a}}=i,u=ne.uuidv4(),f=this.core.projectId||"",p=Date.now(),S=up({eventId:u,timestamp:p,props:{event:s,type:o,properties:{topic:c,trace:a}},bundleId:f,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,S),this.shouldPersist=!0),S},this.getEvent=i=>{let{eventId:s,topic:o}=i;if(s)return this.events.get(s);let c=Array.from(this.events.values()).find(a=>a.props.properties.topic===o);if(c)return up(up({},c),this.setMethods(c.eventId))},this.deleteEvent=i=>{let{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(pd.HEARTBEAT_EVENTS.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{Ge.fromMiliseconds(Date.now())-Ge.fromMiliseconds(i.timestamp)>lG&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{let o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{let o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{let i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,up(up({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;let i=[];for(let[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(let s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{let s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${fG}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${jb}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>ne.getAppMetadata().url,this.logger=Vt.generateChildLogger(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}},$ve=Object.defineProperty,CH=Object.getOwnPropertySymbols,Yve=Object.prototype.hasOwnProperty,Jve=Object.prototype.propertyIsEnumerable,xH=(t,e,r)=>e in t?$ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,NH=(t,e)=>{for(var r in e||(e={}))Yve.call(e,r)&&xH(t,r,e[r]);if(CH)for(var r of CH(e))Jve.call(e,r)&&xH(t,r,e[r]);return t},iw=class t extends gs.ICore{constructor(e){var r;super(e),this.protocol=T4,this.version=I4,this.name=ow,this.events=new Eu.EventEmitter,this.initialized=!1,this.on=(o,c)=>this.events.on(o,c),this.once=(o,c)=>this.events.once(o,c),this.off=(o,c)=>this.events.off(o,c),this.removeListener=(o,c)=>this.events.removeListener(o,c),this.dispatchEnvelope=({topic:o,message:c,sessionExists:a})=>{if(!o||!c)return;let u={topic:o,message:c,publishedAt:Date.now(),transportType:tc.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:a})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||C4,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let n=Vt.getDefaultLoggerOptions({level:typeof e?.logger=="string"&&e.logger?e.logger:OH.logger}),{logger:i,chunkLoggerController:s}=Vt.generatePlatformLogger({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,c;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Vt.generateChildLogger(i,this.name),this.heartbeat=new pd.HeartBeat,this.crypto=new Kb(this,this.logger,e?.keychain),this.history=new Zb(this,this.logger),this.expirer=new ew(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Q1e.default(NH(NH({},PH),e?.storageOptions)),this.relayer=new Yb({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Xb(this,this.logger),this.verify=new tw(this,this.logger,this.storage),this.echoClient=new rw(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new nw(this,this.logger,e?.telemetryEnabled)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(QH,n),r}get context(){return Vt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(p4,this.linkModeSupportedApps))}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.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(p4)||[],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}}},Xve=iw;le.CORE_CONTEXT=ow,le.CORE_DEFAULT=OH,le.CORE_PROTOCOL=T4,le.CORE_STORAGE_OPTIONS=PH,le.CORE_STORAGE_PREFIX=ps,le.CORE_VERSION=I4,le.CRYPTO_CLIENT_SEED=h4,le.CRYPTO_CONTEXT=RH,le.CRYPTO_JWT_TTL=MH,le.Core=Xve,le.Crypto=Kb,le.ECHO_CONTEXT=oG,le.ECHO_URL=aG,le.EVENTS_CLIENT_API_URL=fG,le.EVENTS_STORAGE_CLEANUP_INTERVAL=lG,le.EVENTS_STORAGE_CONTEXT=uG,le.EVENTS_STORAGE_VERSION=cG,le.EVENT_CLIENT_AUTHENTICATE_ERRORS=sye,le.EVENT_CLIENT_AUTHENTICATE_TRACES=iye,le.EVENT_CLIENT_CONTEXT=tye,le.EVENT_CLIENT_PAIRING_ERRORS=Xo,le.EVENT_CLIENT_PAIRING_TRACES=ho,le.EVENT_CLIENT_SESSION_ERRORS=nye,le.EVENT_CLIENT_SESSION_TRACES=rye,le.EXPIRER_CONTEXT=eG,le.EXPIRER_DEFAULT_TTL=Z1e,le.EXPIRER_EVENTS=Li,le.EXPIRER_STORAGE_VERSION=tG,le.EchoClient=rw,le.EventClient=nw,le.Expirer=ew,le.HISTORY_CONTEXT=XH,le.HISTORY_EVENTS=Bi,le.HISTORY_STORAGE_VERSION=ZH,le.JsonRpcHistory=Zb,le.KEYCHAIN_CONTEXT=DH,le.KEYCHAIN_STORAGE_VERSION=BH,le.KeyChain=Qb,le.MESSAGES_CONTEXT=LH,le.MESSAGES_STORAGE_VERSION=FH,le.MessageTracker=Wb,le.PAIRING_CONTEXT=YH,le.PAIRING_DEFAULT_TTL=X1e,le.PAIRING_EVENTS=hd,le.PAIRING_RPC_OPTS=dd,le.PAIRING_STORAGE_VERSION=JH,le.PENDING_SUB_RESOLUTION_TIMEOUT=$H,le.PUBLISHER_CONTEXT=UH,le.PUBLISHER_DEFAULT_TTL=qH,le.Pairing=Xb,le.RELAYER_CONTEXT=HH,le.RELAYER_DEFAULT_LOGGER=VH,le.RELAYER_DEFAULT_PROTOCOL=kH,le.RELAYER_DEFAULT_RELAY_URL=C4,le.RELAYER_EVENTS=jn,le.RELAYER_PROVIDER_EVENTS=ri,le.RELAYER_RECONNECT_TIMEOUT=zH,le.RELAYER_SDK_VERSION=jb,le.RELAYER_STORAGE_OPTIONS=$1e,le.RELAYER_SUBSCRIBER_SUFFIX=GH,le.RELAYER_TRANSPORT_CUTOFF=Y1e,le.Relayer=Yb,le.STORE_STORAGE_VERSION=jH,le.SUBSCRIBER_CONTEXT=KH,le.SUBSCRIBER_DEFAULT_TTL=J1e,le.SUBSCRIBER_EVENTS=hs,le.SUBSCRIBER_STORAGE_VERSION=WH,le.Store=Jb,le.Subscriber=$b,le.TRANSPORT_TYPES=tc,le.TRUSTED_VERIFY_URLS=sG,le.VERIFY_CONTEXT=rG,le.VERIFY_SERVER=lp,le.VERIFY_SERVER_V3=iG,le.Verify=tw,le.WALLETCONNECT_CLIENT_ID=QH,le.WALLETCONNECT_LINK_MODE_APPS=p4,le.default=iw});var UG=L(Xe=>{"use strict";h();Object.defineProperty(Xe,"__esModule",{value:!0});var he=SG(),cw=(N6(),qe(x6)),IG=$6(),j=J0(),CG=_o(),Ht=yf(),tt=(rp(),qe(yn));function Zve(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ebe=Zve(CG),L4="wc",F4=2,q4="client",hw=`${L4}@${F4}:${q4}:`,uw={name:q4,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},tbe={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",session_authenticate:"session_authenticate",session_request_expire:"session_request_expire"},rbe={database:":memory:"},x4="WALLETCONNECT_DEEPLINK_CHOICE",nbe={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},ibe="history",sbe="0.3",xG="proposal",obe=Ht.THIRTY_DAYS,NG="Proposal expired",OG="session",_u=Ht.SEVEN_DAYS,PG="engine",Br={wc_sessionPropose:{req:{ttl:Ht.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Ht.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Ht.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Ht.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Ht.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Ht.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Ht.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Ht.FIVE_MINUTES,prompt:!1,tag:1119}}},lw={min:Ht.FIVE_MINUTES,max:Ht.SEVEN_DAYS},ys={idle:"IDLE",active:"ACTIVE"},RG="request",MG=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],DG="wc",abe=1.5,BG="auth",LG="authKeys",FG="pairingTopics",qG="requests",hp=`${DG}@${1.5}:${BG}:`,dp=`${hp}:PUB_KEY`,cbe=Object.defineProperty,ube=Object.defineProperties,lbe=Object.getOwnPropertyDescriptors,_G=Object.getOwnPropertySymbols,fbe=Object.prototype.hasOwnProperty,dbe=Object.prototype.propertyIsEnumerable,TG=(t,e,r)=>e in t?cbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,br=(t,e)=>{for(var r in e||(e={}))fbe.call(e,r)&&TG(t,r,e[r]);if(_G)for(var r of _G(e))dbe.call(e,r)&&TG(t,r,e[r]);return t},ms=(t,e)=>ube(t,lbe(e)),N4=class extends IG.IEngine{constructor(e){super(e),this.name=PG,this.events=new ebe.default,this.initialized=!1,this.requestQueue={state:ys.idle,queue:[]},this.sessionRequestQueue={state:ys.idle,queue:[]},this.requestQueueDelay=Ht.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Br)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Ht.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let n=ms(br({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,relays:a}=n,u=i,f,p=!1;try{u&&(p=this.client.core.pairing.pairings.get(u).active)}catch(H){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),H}if(!u||!p){let{topic:H,uri:F}=await this.client.core.pairing.create();u=H,f=F}if(!u){let{message:H}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(H)}let S=await this.client.core.crypto.generateKeyPair(),I=Br.wc_sessionPropose.req.ttl||Ht.FIVE_MINUTES,N=j.calcExpiry(I),R=br({requiredNamespaces:s,optionalNamespaces:o,relays:a??[{protocol:he.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:S,metadata:this.client.metadata},expiryTimestamp:N,pairingTopic:u},c&&{sessionProperties:c}),{reject:D,resolve:U,done:k}=j.createDelayedPromise(I,NG);this.events.once(j.engineEvent("session_connect"),async({error:H,session:F})=>{if(H)D(H);else if(F){F.self.publicKey=S;let V=ms(br({},F),{pairingTopic:R.pairingTopic,requiredNamespaces:R.requiredNamespaces,optionalNamespaces:R.optionalNamespaces,transportType:he.TRANSPORT_TYPES.relay});await this.client.session.set(F.topic,V),await this.setExpiry(F.topic,F.expiry),u&&await this.client.core.pairing.updateMetadata({topic:u,metadata:F.peer.metadata}),this.cleanupDuplicatePairings(V),U(V)}});let z=await this.sendRequest({topic:u,method:"wc_sessionPropose",params:R,throwOnFailedPublish:!0});return await this.setProposal(z,br({id:z},R)),{uri:f,approval:k}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;let o=this.client.core.eventClient.createEvent({properties:{topic:(n=r?.id)==null?void 0:n.toString(),trace:[he.EVENT_CLIENT_SESSION_TRACES.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(C){throw o.setError(he.EVENT_CLIENT_SESSION_ERRORS.no_internet_connection),C}try{await this.isValidProposalId(r?.id)}catch(C){throw this.client.logger.error(`approve() -> proposal.get(${r?.id}) failed`),o.setError(he.EVENT_CLIENT_SESSION_ERRORS.proposal_not_found),C}try{await this.isValidApprove(r)}catch(C){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(he.EVENT_CLIENT_SESSION_ERRORS.session_approve_namespace_validation_failure),C}let{id:c,relayProtocol:a,namespaces:u,sessionProperties:f,sessionConfig:p}=r,S=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});let{pairingTopic:I,proposer:N,requiredNamespaces:R,optionalNamespaces:D}=S,U=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:I});U||(U=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:he.EVENT_CLIENT_SESSION_TRACES.session_approve_started,properties:{topic:I,trace:[he.EVENT_CLIENT_SESSION_TRACES.session_approve_started,he.EVENT_CLIENT_SESSION_TRACES.session_namespaces_validation_success]}}));let k=await this.client.core.crypto.generateKeyPair(),z=N.publicKey,H=await this.client.core.crypto.generateSharedKey(k,z),F=br(br({relay:{protocol:a??"irn"},namespaces:u,controller:{publicKey:k,metadata:this.client.metadata},expiry:j.calcExpiry(_u)},f&&{sessionProperties:f}),p&&{sessionConfig:p}),V=he.TRANSPORT_TYPES.relay;U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.subscribing_session_topic);try{await this.client.core.relayer.subscribe(H,{transportType:V})}catch(C){throw U.setError(he.EVENT_CLIENT_SESSION_ERRORS.subscribe_session_topic_failure),C}U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.subscribe_session_topic_success);let q=ms(br({},F),{topic:H,requiredNamespaces:R,optionalNamespaces:D,pairingTopic:I,acknowledged:!1,self:F.controller,peer:{publicKey:N.publicKey,metadata:N.metadata},controller:k,transportType:he.TRANSPORT_TYPES.relay});await this.client.session.set(H,q),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.store_session);try{U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.publishing_session_settle),await this.sendRequest({topic:H,method:"wc_sessionSettle",params:F,throwOnFailedPublish:!0}).catch(C=>{throw U?.setError(he.EVENT_CLIENT_SESSION_ERRORS.session_settle_publish_failure),C}),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.session_settle_publish_success),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.publishing_session_approve),await this.sendResult({id:c,topic:I,result:{relay:{protocol:a??"irn"},responderPublicKey:k},throwOnFailedPublish:!0}).catch(C=>{throw U?.setError(he.EVENT_CLIENT_SESSION_ERRORS.session_approve_publish_failure),C}),U.addTrace(he.EVENT_CLIENT_SESSION_TRACES.session_approve_publish_success)}catch(C){throw this.client.logger.error(C),this.client.session.delete(H,j.getSdkError("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(H),C}return this.client.core.eventClient.deleteEvent({eventId:U.eventId}),await this.client.core.pairing.updateMetadata({topic:I,metadata:N.metadata}),await this.client.proposal.delete(c,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:I}),await this.setExpiry(H,j.calcExpiry(_u)),{topic:H,acknowledged:()=>Promise.resolve(this.client.session.get(H))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}let{id:n,reason:i}=r,s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Br.wc_sessionPropose.reject}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}let{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:c}=j.createDelayedPromise(),a=tt.payloadId(),u=tt.getBigIntRpcId().toString(),f=this.client.session.get(n).namespaces;return this.events.once(j.engineEvent("session_update",a),({error:p})=>{p?c(p):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:u}).catch(p=>{this.client.logger.error(p),this.client.session.update(n,{namespaces:f}),c(p)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(a){throw this.client.logger.error("extend() -> isValidExtend() failed"),a}let{topic:n}=r,i=tt.payloadId(),{done:s,resolve:o,reject:c}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:a})=>{a?c(a):o()}),await this.setExpiry(n,j.calcExpiry(_u)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(a=>{c(a)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(N){throw this.client.logger.error("request() -> isValidRequest() failed"),N}let{chainId:n,request:i,topic:s,expiry:o=Br.wc_sessionRequest.req.ttl}=r,c=this.client.session.get(s);c?.transportType===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let a=tt.payloadId(),u=tt.getBigIntRpcId().toString(),{done:f,resolve:p,reject:S}=j.createDelayedPromise(o,"Request expired. Please try again.");this.events.once(j.engineEvent("session_request",a),({error:N,result:R})=>{N?S(N):p(R)});let I=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);return I?(await this.sendRequest({clientRpcId:a,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:ms(br({},i),{expiryTimestamp:j.calcExpiry(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:I}).catch(N=>S(N)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await f()):await Promise.all([new Promise(async N=>{await this.sendRequest({clientRpcId:a,relayRpcId:u,topic:s,method:"wc_sessionRequest",params:{request:ms(br({},i),{expiryTimestamp:j.calcExpiry(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(R=>S(R)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),N()}),new Promise(async N=>{var R;if(!((R=c.sessionConfig)!=null&&R.disableDeepLink)){let D=await j.getDeepLink(this.client.core.storage,x4);await j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:D})}N()}),f()]).then(N=>N[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);tt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:c}):tt.isJsonRpcError(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:c}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=tt.payloadId(),s=tt.getBigIntRpcId().toString(),{done:o,resolve:c,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r,o=tt.getBigIntRpcId().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);let{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{let{message:i}=j.getInternalError("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);let s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?he.TRANSPORT_TYPES.link_mode:he.TRANSPORT_TYPES.relay;o===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let{chains:c,statement:a="",uri:u,domain:f,nonce:p,type:S,exp:I,nbf:N,methods:R=[],expiry:D}=r,U=[...r.resources||[]],{topic:k,uri:z}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:k,uri:z}});let H=await this.client.core.crypto.generateKeyPair(),F=j.hashKey(H);if(await Promise.all([this.client.auth.authKeys.set(dp,{responseTopic:F,publicKey:H}),this.client.auth.pairingTopics.set(F,{topic:F,pairingTopic:k})]),await this.client.core.relayer.subscribe(F,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${k}`),R.length>0){let{namespace:A}=j.parseChainId(c[0]),y=j.createEncodedRecap(A,"request",R);j.getRecapFromResources(U)&&(y=j.mergeEncodedRecaps(y,U.pop())),U.push(y)}let V=D&&D>Br.wc_sessionAuthenticate.req.ttl?D:Br.wc_sessionAuthenticate.req.ttl,q={authPayload:{type:S??"caip122",chains:c,statement:a,aud:u,domain:f,version:"1",nonce:p,iat:new Date().toISOString(),exp:I,nbf:N,resources:U},requester:{publicKey:H,metadata:this.client.metadata},expiryTimestamp:j.calcExpiry(V)},C={eip155:{chains:c,methods:[...new Set(["personal_sign",...R])],events:["chainChanged","accountsChanged"]}},B={requiredNamespaces:{},optionalNamespaces:C,relays:[{protocol:"irn"}],pairingTopic:k,proposer:{publicKey:H,metadata:this.client.metadata},expiryTimestamp:j.calcExpiry(Br.wc_sessionPropose.req.ttl)},{done:x,resolve:g,reject:v}=j.createDelayedPromise(V,"Request expired"),l=async({error:A,session:y})=>{if(this.events.off(j.engineEvent("session_request",m),d),A)v(A);else if(y){y.self.publicKey=H,await this.client.session.set(y.topic,y),await this.setExpiry(y.topic,y.expiry),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:y.peer.metadata});let T=this.client.session.get(y.topic);await this.deleteProposal(w),g({session:T})}},d=async A=>{var y,T,E;if(await this.deletePendingAuthRequest(m,{message:"fulfilled",code:0}),A.error){let $=j.getSdkError("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return A.error.code===$.code?void 0:(this.events.off(j.engineEvent("session_connect"),l),v(A.error.message))}await this.deleteProposal(w),this.events.off(j.engineEvent("session_connect"),l);let{cacaos:M,responder:W}=A.result,Y=[],P=[];for(let $ of M){await j.validateSignedCacao({cacao:$,projectId:this.client.core.projectId})||(this.client.logger.error($,"Signature verification failed"),v(j.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:ee}=$,ie=j.getRecapFromResources(ee.resources),X=[j.getNamespacedDidChainId(ee.iss)],re=j.getDidAddress(ee.iss);if(ie){let ae=j.getMethodsFromRecap(ie),Z=j.getChainsFromRecap(ie);Y.push(...ae),X.push(...Z)}for(let ae of X)P.push(`${ae}:${re}`)}let G=await this.client.core.crypto.generateSharedKey(H,W.publicKey),Q;Y.length>0&&(Q={topic:G,acknowledged:!0,self:{publicKey:H,metadata:this.client.metadata},peer:W,controller:W.publicKey,expiry:j.calcExpiry(_u),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:k,namespaces:j.buildNamespacesFromAuth([...new Set(Y)],[...new Set(P)]),transportType:o},await this.client.core.relayer.subscribe(G,{transportType:o}),await this.client.session.set(G,Q),k&&await this.client.core.pairing.updateMetadata({topic:k,metadata:W.metadata}),Q=this.client.session.get(G)),(y=this.client.metadata.redirect)!=null&&y.linkMode&&(T=W.metadata.redirect)!=null&&T.linkMode&&(E=W.metadata.redirect)!=null&&E.universal&&n&&(this.client.core.addLinkModeSupportedApp(W.metadata.redirect.universal),this.client.session.update(G,{transportType:he.TRANSPORT_TYPES.link_mode})),g({auths:M,session:Q})},m=tt.payloadId(),w=tt.payloadId();this.events.once(j.engineEvent("session_connect"),l),this.events.once(j.engineEvent("session_request",m),d);let _;try{if(s){let A=tt.formatJsonRpcRequest("wc_sessionAuthenticate",q,m);this.client.core.history.set(k,A);let y=await this.client.core.crypto.encode("",A,{type:j.TYPE_2,encoding:j.BASE64URL});_=j.getLinkModeURL(n,k,y)}else await Promise.all([this.sendRequest({topic:k,method:"wc_sessionAuthenticate",params:q,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:m}),this.sendRequest({topic:k,method:"wc_sessionPropose",params:B,expiry:Br.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w})])}catch(A){throw this.events.off(j.engineEvent("session_connect"),l),this.events.off(j.engineEvent("session_request",m),d),A}return await this.setProposal(w,br({id:w},B)),await this.setAuthRequest(m,{request:ms(br({},q),{verifyContext:{}}),pairingTopic:k,transportType:o}),{uri:_??z,response:x}},this.approveSessionAuthenticate=async r=>{let{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[he.EVENT_CLIENT_AUTHENTICATE_TRACES.authenticated_session_approve_started]}});try{this.isInitialized()}catch(D){throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.no_internet_connection),D}let o=this.getPendingAuthRequest(n);if(!o)throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);let c=o.transportType||he.TRANSPORT_TYPES.relay;c===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let a=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),f=j.hashKey(a),p={type:j.TYPE_1,receiverPublicKey:a,senderPublicKey:u},S=[],I=[];for(let D of i){if(!await j.validateSignedCacao({cacao:D,projectId:this.client.core.projectId})){s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.invalid_cacao);let F=j.getSdkError("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:F,encodeOpts:p}),new Error(F.message)}s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.cacaos_verified);let{p:U}=D,k=j.getRecapFromResources(U.resources),z=[j.getNamespacedDidChainId(U.iss)],H=j.getDidAddress(U.iss);if(k){let F=j.getMethodsFromRecap(k),V=j.getChainsFromRecap(k);S.push(...F),z.push(...V)}for(let F of z)I.push(`${F}:${H}`)}let N=await this.client.core.crypto.generateSharedKey(u,a);s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.create_authenticated_session_topic);let R;if(S?.length>0){R={topic:N,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:a,metadata:o.requester.metadata},controller:a,expiry:j.calcExpiry(_u),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:j.buildNamespacesFromAuth([...new Set(S)],[...new Set(I)]),transportType:c},s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(N,{transportType:c})}catch(D){throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.subscribe_authenticated_session_topic_failure),D}s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.subscribe_authenticated_session_topic_success),await this.client.session.set(N,R),s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(he.EVENT_CLIENT_AUTHENTICATE_TRACES.publishing_authenticated_session_approve);try{await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:p,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(D){throw s.setError(he.EVENT_CLIENT_AUTHENTICATE_ERRORS.authenticated_session_approve_publish_failure),D}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:R}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();let{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===he.TRANSPORT_TYPES.relay&&await this.confirmOnlineStateOrThrow();let o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),a=j.hashKey(o),u={type:j.TYPE_1,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:a,error:i,encodeOpts:u,rpcOpts:Br.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();let{request:n,iss:i}=r;return j.formatMessage(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{let r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;let{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=r,{self:a}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,j.getSdkError("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(x4).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,j.getSdkError("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=ys.idle),o&&this.client.events.emit("session_delete",{id:c,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{let i=this.client.proposal.get(r);this.client.core.eventClient.getEvent({topic:i.pairingTopic})?.setError(he.EVENT_CLIENT_SESSION_ERRORS.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=ys.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,j.calcExpiry(Br.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{let{request:i,pairingTopic:s,transportType:o=he.TRANSPORT_TYPES.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{let{id:n,topic:i,params:s,verifyContext:o}=r,c=s.request.expiryTimestamp||j.calcExpiry(Br.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:c,clientRpcId:a,throwOnFailedPublish:u,appLink:f}=r,p=tt.formatJsonRpcRequest(i,s,a),S,I=!!f;try{let D=I?j.BASE64URL:j.BASE64;S=await this.client.core.crypto.encode(n,p,{encoding:D})}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),D}let N;if(MG.includes(i)){let D=j.hashMessage(JSON.stringify(p)),U=j.hashMessage(S);N=await this.client.core.verify.register({id:U,decryptedId:D})}let R=Br[i].req;if(R.attestation=N,o&&(R.ttl=o),c&&(R.id=c),this.client.core.history.set(n,p),I){let D=j.getLinkModeURL(f,n,S);await global.Linking.openURL(D,this.client.name)}else{let D=Br[i].req;o&&(D.ttl=o),c&&(D.id=c),u?(D.internal=ms(br({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,S,D)):this.client.core.relayer.publish(n,S,D).catch(U=>this.client.logger.error(U))}return p.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:a}=r,u=tt.formatJsonRpcResult(n,s),f,p=a&&typeof(global==null?void 0:global.Linking)<"u";try{let I=p?j.BASE64URL:j.BASE64;f=await this.client.core.crypto.encode(i,u,ms(br({},c||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),I}let S;try{S=await this.client.core.history.get(i,n)}catch(I){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),I}if(p){let I=j.getLinkModeURL(a,i,f);await global.Linking.openURL(I,this.client.name)}else{let I=Br[S.request.method].res;o?(I.internal=ms(br({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,I)):this.client.core.relayer.publish(i,f,I).catch(N=>this.client.logger.error(N))}await this.client.core.history.resolve(u)},this.sendError=async r=>{let{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:c,appLink:a}=r,u=tt.formatJsonRpcError(n,s),f,p=a&&typeof(global==null?void 0:global.Linking)<"u";try{let I=p?j.BASE64URL:j.BASE64;f=await this.client.core.crypto.encode(i,u,ms(br({},o||{}),{encoding:I}))}catch(I){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),I}let S;try{S=await this.client.core.history.get(i,n)}catch(I){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),I}if(p){let I=j.getLinkModeURL(a,i,f);await global.Linking.openURL(I,this.client.name)}else{let I=c||Br[S.request.method].res;this.client.core.relayer.publish(i,f,I)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;j.isExpired(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ys.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ys.active;let r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ys.idle},this.processRequest=async r=>{let{topic:n,payload:i,attestation:s,transportType:o,encryptedId:c}=r,a=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:a}))switch(a){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{let{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{let{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:c,id:a}=i;try{let u=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(br({},i.params));let f=c.expiryTimestamp||j.calcExpiry(Br.wc_sessionPropose.req.ttl),p=br({id:a,pairingTopic:n,expiryTimestamp:f},c);await this.setProposal(a,p);let S=await this.getVerifyContext({attestationId:s,hash:j.hashMessage(JSON.stringify(i)),encryptedId:o,metadata:p.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(he.EVENT_CLIENT_PAIRING_ERRORS.proposal_listener_not_found)),u?.addTrace(he.EVENT_CLIENT_PAIRING_TRACES.emit_session_proposal),this.client.events.emit("session_proposal",{id:a,params:p,verifyContext:S})}catch(u){await this.sendError({id:a,topic:n,error:u,rpcOpts:Br.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(r,n,i)=>{let{id:s}=n;if(tt.isJsonRpcResult(n)){let{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});let c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});let a=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let f=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});let p=await this.client.core.relayer.subscribe(f,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:r})}else if(tt.isJsonRpcError(n)){await this.client.proposal.delete(s,j.getSdkError("USER_DISCONNECTED"));let o=j.engineEvent("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(j.engineEvent("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:c,expiry:a,namespaces:u,sessionProperties:f,sessionConfig:p}=n.params,S=ms(br(br({topic:r,relay:o,expiry:a,namespaces:u,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:c.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},f&&{sessionProperties:f}),p&&{sessionConfig:p}),{transportType:he.TRANSPORT_TYPES.relay}),I=j.engineEvent("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(j.engineEvent("session_connect"),{session:S}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;tt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):tt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,c=j.MemoryStore.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:j.getSdkError("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(br({topic:r},i));try{j.MemoryStore.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(a){throw j.MemoryStore.delete(o),a}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,j.calcExpiry(_u)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(he.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:j.getSdkError("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;let{topic:o,payload:c,attestation:a,encryptedId:u,transportType:f}=r,{id:p,params:S}=c;try{await this.isValidRequest(br({topic:o},S));let I=this.client.session.get(o),N=await this.getVerifyContext({attestationId:a,hash:j.hashMessage(JSON.stringify(tt.formatJsonRpcRequest("wc_sessionRequest",S,p))),encryptedId:u,metadata:I.peer.metadata,transportType:f}),R={id:p,topic:o,params:S,verifyContext:N};await this.setPendingSessionRequest(R),f===he.TRANSPORT_TYPES.link_mode&&(n=I.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=I.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(R):(this.addSessionRequestToSessionRequestQueue(R),this.processSessionRequestQueue())}catch(I){await this.sendError({id:p,topic:o,error:I}),this.client.logger.error(I)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n,s=j.engineEvent("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,c=j.MemoryStore.get(o);if(c&&this.isRequestOutOfSync(c,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(br({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{let{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),tt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):tt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;let{topic:i,payload:s,attestation:o,encryptedId:c,transportType:a}=r;try{let{requester:u,authPayload:f,expiryTimestamp:p}=s.params,S=await this.getVerifyContext({attestationId:o,hash:j.hashMessage(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:a}),I={requester:u,pairingTopic:i,id:s.id,authPayload:f,verifyContext:S,expiryTimestamp:p};await this.setAuthRequest(s.id,{request:I,pairingTopic:i,transportType:a}),a===he.TRANSPORT_TYPES.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:S})}catch(u){this.client.logger.error(u);let f=s.params.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),S=this.getAppLinkIfEnabled(s.params.requester.metadata,a),I={type:j.TYPE_1,receiverPublicKey:f,senderPublicKey:p};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:I,rpcOpts:Br.wc_sessionAuthenticate.autoReject,appLink:S})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ys.idle,this.processSessionRequestQueue()},Ht.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{let i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{let o=s.request.id,c=j.engineEvent("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(j.engineEvent("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ys.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ys.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:tt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:c}=r;if(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(c,!0)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(a)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);let c=this.client.proposal.get(n),a=j.isValidNamespaces(i,"approve()");if(a)throw new Error(a.message);let u=j.isConformingNamespaces(c.requiredNamespaces,i,"approve()");if(u)throw new Error(u.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(u)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:u}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}let c=j.isValidController(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);let a=j.isValidNamespaces(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);if(j.isExpired(o)){let{message:u}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(u)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(a)}let{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let c=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(c)throw new Error(c.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(a)}let{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);let{namespaces:c}=this.client.session.get(n);if(!j.isValidNamespacesChainId(c,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!j.isValidRequest(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesRequest(c,s,i.method)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(a)}if(o&&!j.isValidRequestExpiry(o,lw)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${lw.min} and ${lw.max}`);throw new Error(a)}},this.isValidRespond=async r=>{var n;if(!j.isValidParams(r)){let{message:o}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}let{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!j.isValidResponse(s)){let{message:o}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(c)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!j.isValidNamespacesChainId(o,s)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!j.isValidEvent(i)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(c)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{let{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!j.isValidString(i,!1))throw new Error("uri is required parameter");if(!j.isValidString(s,!1))throw new Error("domain is required parameter");if(!j.isValidString(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(a=>j.parseChainId(a).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:c}=j.parseChainId(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{let{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:c}=r,a={verified:{verifyUrl:o.verifyUrl||he.VERIFY_SERVER,validation:"UNKNOWN",origin:o.url||""}};try{if(c===he.TRANSPORT_TYPES.link_mode){let f=this.getAppLinkIfEnabled(o,c);return a.verified.validation=f&&new URL(f).origin===new URL(o.url).origin?"VALID":"INVALID",a}let u=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(a.verified.origin=u.origin,a.verified.isScam=u.isScam,a.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{let n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0,s=this.recentlyDeletedLimit/2;for(let o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{let n=this.recentlyDeletedMap.get(r);if(n){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,c,a,u,f,p,S;return!r||n!==he.TRANSPORT_TYPES.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(a=this.client.metadata)==null?void 0:a.redirect)==null?void 0:u.universal)!==""&&((f=r?.redirect)==null?void 0:f.universal)!==void 0&&((p=r?.redirect)==null?void 0:p.universal)!==""&&((S=r?.redirect)==null?void 0:S.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r?.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;let n=j.getSearchParamFromURL(r,"topic")||"",i=decodeURIComponent(j.getSearchParamFromURL(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:he.TRANSPORT_TYPES.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(j.isTestRun()||j.isReactNative()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){let n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);let i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(he.RELAYER_EVENTS.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){let{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(dp)?this.client.auth.authKeys.get(dp):{responseTopic:void 0,publicKey:void 0},c=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===he.TRANSPORT_TYPES.link_mode?j.BASE64URL:j.BASE64});try{tt.isJsonRpcRequest(c)?(this.client.core.history.set(r,c),this.onRelayEventRequest({topic:r,payload:c,attestation:i,transportType:s,encryptedId:j.hashMessage(n)})):tt.isJsonRpcResponse(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:r,payload:c,transportType:s}),this.client.core.history.delete(r,c.id)):this.onRelayEventUnknownPayload({topic:r,payload:c,transportType:s})}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(he.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(he.PAIRING_EVENTS.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(he.PAIRING_EVENTS.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:r}=j.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},O4=class extends he.Store{constructor(e,r){super(e,r,xG,hw),this.core=e,this.logger=r}},fw=class extends he.Store{constructor(e,r){super(e,r,OG,hw),this.core=e,this.logger=r}},P4=class extends he.Store{constructor(e,r){super(e,r,RG,hw,n=>n.id),this.core=e,this.logger=r}},R4=class extends he.Store{constructor(e,r){super(e,r,LG,hp,()=>dp),this.core=e,this.logger=r}},M4=class extends he.Store{constructor(e,r){super(e,r,FG,hp),this.core=e,this.logger=r}},D4=class extends he.Store{constructor(e,r){super(e,r,qG,hp,n=>n.id),this.core=e,this.logger=r}},B4=class{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new R4(this.core,this.logger),this.pairingTopics=new M4(this.core,this.logger),this.requests=new D4(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}},dw=class t extends IG.ISignClient{constructor(e){super(e),this.protocol=L4,this.version=F4,this.name=uw.name,this.events=new CG.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||uw.name,this.metadata=e?.metadata||j.getAppMetadata(),this.signConfig=e?.signConfig;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:cw.pino(cw.getDefaultLoggerOptions({level:e?.logger||uw.logger}));this.core=e?.core||new he.Core(e),this.logger=cw.generateChildLogger(r,this.name),this.session=new fw(this.core,this.logger),this.proposal=new O4(this.core,this.logger),this.pendingRequest=new P4(this.core,this.logger),this.engine=new N4(this),this.auth=new B4(this.core,this.logger)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return cw.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.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},hbe=fw,pbe=dw;Xe.AUTH_CONTEXT=BG,Xe.AUTH_KEYS_CONTEXT=LG,Xe.AUTH_PAIRING_TOPIC_CONTEXT=FG,Xe.AUTH_PROTOCOL=DG,Xe.AUTH_PUBLIC_KEY_NAME=dp,Xe.AUTH_REQUEST_CONTEXT=qG,Xe.AUTH_STORAGE_PREFIX=hp,Xe.AUTH_VERSION=abe,Xe.ENGINE_CONTEXT=PG,Xe.ENGINE_QUEUE_STATES=ys,Xe.ENGINE_RPC_OPTS=Br,Xe.HISTORY_CONTEXT=ibe,Xe.HISTORY_EVENTS=nbe,Xe.HISTORY_STORAGE_VERSION=sbe,Xe.METHODS_TO_VERIFY=MG,Xe.PROPOSAL_CONTEXT=xG,Xe.PROPOSAL_EXPIRY=obe,Xe.PROPOSAL_EXPIRY_MESSAGE=NG,Xe.REQUEST_CONTEXT=RG,Xe.SESSION_CONTEXT=OG,Xe.SESSION_EXPIRY=_u,Xe.SESSION_REQUEST_EXPIRY_BOUNDARIES=lw,Xe.SIGN_CLIENT_CONTEXT=q4,Xe.SIGN_CLIENT_DEFAULT=uw,Xe.SIGN_CLIENT_EVENTS=tbe,Xe.SIGN_CLIENT_PROTOCOL=L4,Xe.SIGN_CLIENT_STORAGE_OPTIONS=rbe,Xe.SIGN_CLIENT_STORAGE_PREFIX=hw,Xe.SIGN_CLIENT_VERSION=F4,Xe.SessionStore=hbe,Xe.SignClient=pbe,Xe.WALLETCONNECT_DEEPLINK_CHOICE=x4,Xe.default=dw});var pw=L(md=>{"use strict";h();Object.defineProperty(md,"__esModule",{value:!0});md.OptionalOperation=md.Operation=void 0;var kG;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(kG||(md.Operation=kG={}));var VG;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(VG||(md.OptionalOperation=VG={}))});var U4=L(po=>{"use strict";h();Object.defineProperty(po,"__esModule",{value:!0});po.WALLETCONNECT_SIGN_LOGIN_DELAY=po.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=po.WALLETCONNECT_MULTIVERSX_METHODS=po.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var HG=pw();po.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";po.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(HG.Operation);po.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(HG.OptionalOperation);po.WALLETCONNECT_SIGN_LOGIN_DELAY=500});var H4=L(go=>{"use strict";h();Object.defineProperty(go,"__esModule",{value:!0});go.WalletConnectV2ProviderErrorMessagesEnum=go.ErrBadAddress=go.ErrNotImplemented=go.Err=void 0;var pp=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};go.Err=pp;var k4=class extends pp{constructor(){super("Method not yet implemented")}};go.ErrNotImplemented=k4;var V4=class extends pp{constructor(e,r){super(`Bad address: ${e}`,r)}};go.ErrBadAddress=V4;var GG;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(GG||(go.WalletConnectV2ProviderErrorMessagesEnum=GG={}))});var z4=L(gw=>{"use strict";h();Object.defineProperty(gw,"__esModule",{value:!0});gw.Logger=void 0;var G4=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};gw.Logger=G4});var $G=L(Fi=>{"use strict";h();var gbe=Fi&&Fi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.getCurrentSession=KG;Fi.getCurrentTopic=ybe;Fi.getConnectionParams=WG;Fi.addressIsValid=vbe;Fi.getAddressFromSession=bbe;Fi.applyTransactionSignature=wbe;Fi.getMetadata=Abe;Fi.sleep=Ebe;var QG=$c(),zG=N1(),mbe=J0(),mw=U4(),Zo=H4(),j4=z4(),jG=pw();function KG(t,e){if(!e)throw new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(WG(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw j4.Logger.error(Zo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}function ybe(t,e){if(!e)throw new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=KG(t,e);if(!r?.topic)throw new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}function WG(t,e){var r,n,i;let s=[...mw.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(jG.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(jG.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${mw.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],c=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[mw.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:c}}}}function vbe(t){try{return!QG.Address.fromBech32(t).isEmpty()}catch{return!1}}function bbe(t){let e=t.namespaces[mw.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}function wbe({transaction:t,response:e}){if(!e)throw j4.Logger.error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,c=t.getGuardian().bech32();if(c&&c!==o)throw j4.Logger.error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(Zo.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(QG.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new zG.Signature(r)),n&&t.applyGuardianSignature(new zG.Signature(n)),t}function Abe(t){if(t)return Object.assign(Object.assign({},t),{url:(0,mbe.getAppMetadata)().url})}function Ebe(t){return gbe(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}});var gp=L(Qn=>{"use strict";h();var Lr=Qn&&Qn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})},Sbe=Qn&&Qn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.WalletConnectV2Provider=Qn.OptionalOperation=Qn.Operation=Qn.WalletConnectV2ProviderErrorMessagesEnum=void 0;var YG=$c(),_be=Sbe(UG()),Q4=J0(),Tu=U4(),de=H4();Object.defineProperty(Qn,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return de.WalletConnectV2ProviderErrorMessagesEnum}});var Ze=z4(),rc=pw();Object.defineProperty(Qn,"Operation",{enumerable:!0,get:function(){return rc.Operation}});Object.defineProperty(Qn,"OptionalOperation",{enumerable:!0,get:function(){return rc.OptionalOperation}});var tn=$G(),K4=class{constructor(e,r,n,i,s){this.chainId="",this.isInitializing=!1,this.processingTopic="",this.options={},this.account={address:""},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}disconnect(){this.account={address:"",signature:""},this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){return Lr(this,void 0,void 0,function*(){var e,r;if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.disconnect();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:(0,tn.getMetadata)((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield _be.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return!!(this.isInitialized()&&typeof this.session<"u")}getAccount(){return this.account}setAccount(e){this.account=e}connect(e){return Lr(this,void 0,void 0,function*(){var r,n;if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=(0,tn.getConnectionParams)(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},i))}catch{if(e?.topic)try{(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.expirer)===null||n===void 0||n.set(e.topic,0)}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}throw this.disconnect(),Ze.Logger.error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:de.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){return Lr(this,void 0,void 0,function*(){var r;if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield(0,tn.sleep)(Tu.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=(0,tn.getAddressFromSession)(n),o=n.namespaces[Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(rc.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?rc.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:rc.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:c}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!c)throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:c})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.disconnect(),Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return null})}logout(e){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||(0,tn.getCurrentTopic)(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:(0,Q4.getSdkError)("USER_DISCONNECTED")});else{let r=(0,tn.getCurrentTopic)(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:(0,Q4.getSdkError)("USER_DISCONNECTED")}),this.disconnect(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.account.address}getSignature(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.account.signature}getPairings(){return Lr(this,void 0,void 0,function*(){var e,r,n,i,s;if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return Lr(this,void 0,void 0,function*(){var r;let n=new YG.Message({data:b.Buffer.from(e.data),address:(r=e.address)!==null&&r!==void 0?r:YG.Address.fromBech32(this.account.address),signer:"wallet-connect-v2",version:e.version});if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let i=this.getAddress(),{signature:s}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:{method:rc.Operation.SIGN_MESSAGE,params:{address:i,message:n.data.toString()}}});if(!s)throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{n.signature=b.Buffer.from(s,"hex")}catch{throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return n})}signTransaction(e){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:{method:rc.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return(0,tn.applyTransactionSignature)({transaction:e,response:n})}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:{method:rc.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];(0,tn.applyTransactionSignature)({transaction:s,response:o})}return e}catch{throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){return Lr(this,void 0,void 0,function*(){var r;if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${Tu.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:(0,tn.getCurrentTopic)(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return Lr(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=(0,tn.getCurrentTopic)(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return Lr(this,void 0,void 0,function*(){return e?(0,tn.addressIsValid)(e.address)?(this.account.address=e.address,e.signature&&(this.account.signature=e.signature),this.onClientConnect.onClientLogin(),this.account.address):(Ze.Logger.error(`${de.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return Lr(this,void 0,void 0,function*(){if(!e)return null;this.session=e.session,this.account.signature=e.signature||"";let r=(0,tn.getAddressFromSession)(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),this.account.address=r,this.account):null})}handleTopicUpdateEvent(e){return Lr(this,arguments,void 0,function*({topic:r}){if(typeof this.walletConnector>"u"){Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let n=yield this.getPairings();if(this.account.address&&!this.isInitializing&&n)if(n?.length===0)this.onClientConnect.onClientLogout();else{let i=n[n.length-1];i?.topic===r&&this.onClientConnect.onClientLogout()}}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents(e){return Lr(this,arguments,void 0,function*({topic:r,params:n}){var i;if(typeof this.walletConnector>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((i=this.session)===null||i===void 0?void 0:i.topic)!==r)return;let{event:s}=n;if(s?.name&&(0,tn.getCurrentTopic)(this.chainId,this.walletConnector)===r){let o=s.data;this.onClientConnect.onClientEvent(o)}})}subscribeToEvents(e){return Lr(this,void 0,void 0,function*(){var r,n,i,s;if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:c})=>{var a;if(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)return;let{namespaces:u}=c,f=e.session.get(o),p=Object.assign(Object.assign({},f),{namespaces:u});this.onSessionConnected({session:p})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",o=>Lr(this,[o],void 0,function*({topic:c}){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.disconnect()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==c)&&(Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.disconnect(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",o=>Lr(this,[o],void 0,function*({topic:c}){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==c||(Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.disconnect(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return Lr(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(de.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.account.address&&!this.isInitializing){let r=(0,tn.getCurrentSession)(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(){return Lr(this,arguments,void 0,function*(e={}){var r,n,i,s,o,c,a,u;if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!(0,Q4.isValidArray)(f))return;for(let p of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(p.topic,0);else try{yield(u=(a=(c=this.walletConnector.core)===null||c===void 0?void 0:c.relayer)===null||a===void 0?void 0:a.subscriber)===null||u===void 0?void 0:u.unsubscribe(p.topic)}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Ze.Logger.error(de.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};Qn.WalletConnectV2Provider=K4});var XG=L((zPe,JG)=>{"use strict";h();JG.exports=Error});var ez=L((QPe,ZG)=>{"use strict";h();ZG.exports=EvalError});var rz=L((WPe,tz)=>{"use strict";h();tz.exports=RangeError});var iz=L((YPe,nz)=>{"use strict";h();nz.exports=ReferenceError});var W4=L((XPe,sz)=>{"use strict";h();sz.exports=SyntaxError});var yd=L((eRe,oz)=>{"use strict";h();oz.exports=TypeError});var cz=L((rRe,az)=>{"use strict";h();az.exports=URIError});var lz=L((iRe,uz)=>{"use strict";h();uz.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var hz=L((oRe,dz)=>{"use strict";h();var fz=typeof Symbol<"u"&&Symbol,Tbe=lz();dz.exports=function(){return typeof fz!="function"||typeof Symbol!="function"||typeof fz("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Tbe()}});var gz=L((cRe,pz)=>{"use strict";h();var $4={__proto__:null,foo:{}},Ibe=Object;pz.exports=function(){return{__proto__:$4}.foo===$4.foo&&!($4 instanceof Ibe)}});var vz=L((lRe,yz)=>{"use strict";h();var Cbe="Function.prototype.bind called on incompatible ",xbe=Object.prototype.toString,Nbe=Math.max,Obe="[object Function]",mz=function(e,r){for(var n=[],i=0;i{"use strict";h();var Mbe=vz();bz.exports=Function.prototype.bind||Mbe});var Az=L((pRe,wz)=>{"use strict";h();var Dbe=Function.prototype.call,Bbe=Object.prototype.hasOwnProperty,Lbe=yw();wz.exports=Lbe.call(Dbe,Bbe)});var xu=L((mRe,Iz)=>{"use strict";h();var Je,Fbe=XG(),qbe=ez(),Ube=rz(),kbe=iz(),Ad=W4(),wd=yd(),Vbe=cz(),Tz=Function,Y4=function(t){try{return Tz('"use strict"; return ('+t+").constructor;")()}catch{}},Iu=Object.getOwnPropertyDescriptor;if(Iu)try{Iu({},"")}catch{Iu=null}var J4=function(){throw new wd},Hbe=Iu?function(){try{return arguments.callee,J4}catch{try{return Iu(arguments,"callee").get}catch{return J4}}}():J4,vd=hz()(),Gbe=gz()(),Kr=Object.getPrototypeOf||(Gbe?function(t){return t.__proto__}:null),bd={},zbe=typeof Uint8Array>"u"||!Kr?Je:Kr(Uint8Array),Cu={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Je:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Je:ArrayBuffer,"%ArrayIteratorPrototype%":vd&&Kr?Kr([][Symbol.iterator]()):Je,"%AsyncFromSyncIteratorPrototype%":Je,"%AsyncFunction%":bd,"%AsyncGenerator%":bd,"%AsyncGeneratorFunction%":bd,"%AsyncIteratorPrototype%":bd,"%Atomics%":typeof Atomics>"u"?Je:Atomics,"%BigInt%":typeof BigInt>"u"?Je:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Je:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Je:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Je:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Fbe,"%eval%":eval,"%EvalError%":qbe,"%Float32Array%":typeof Float32Array>"u"?Je:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Je:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Je:FinalizationRegistry,"%Function%":Tz,"%GeneratorFunction%":bd,"%Int8Array%":typeof Int8Array>"u"?Je:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Je:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Je:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vd&&Kr?Kr(Kr([][Symbol.iterator]())):Je,"%JSON%":typeof JSON=="object"?JSON:Je,"%Map%":typeof Map>"u"?Je:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vd||!Kr?Je:Kr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Je:Promise,"%Proxy%":typeof Proxy>"u"?Je:Proxy,"%RangeError%":Ube,"%ReferenceError%":kbe,"%Reflect%":typeof Reflect>"u"?Je:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Je:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vd||!Kr?Je:Kr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Je:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vd&&Kr?Kr(""[Symbol.iterator]()):Je,"%Symbol%":vd?Symbol:Je,"%SyntaxError%":Ad,"%ThrowTypeError%":Hbe,"%TypedArray%":zbe,"%TypeError%":wd,"%Uint8Array%":typeof Uint8Array>"u"?Je:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Je:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Je:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Je:Uint32Array,"%URIError%":Vbe,"%WeakMap%":typeof WeakMap>"u"?Je:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Je:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Je:WeakSet};if(Kr)try{null.error}catch(t){Ez=Kr(Kr(t)),Cu["%Error.prototype%"]=Ez}var Ez,jbe=function t(e){var r;if(e==="%AsyncFunction%")r=Y4("async function () {}");else if(e==="%GeneratorFunction%")r=Y4("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Y4("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Kr&&(r=Kr(i.prototype))}return Cu[e]=r,r},Sz={__proto__:null,"%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"]},mp=yw(),vw=Az(),Qbe=mp.call(Function.call,Array.prototype.concat),Kbe=mp.call(Function.apply,Array.prototype.splice),_z=mp.call(Function.call,String.prototype.replace),bw=mp.call(Function.call,String.prototype.slice),Wbe=mp.call(Function.call,RegExp.prototype.exec),$be=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ybe=/\\(\\)?/g,Jbe=function(e){var r=bw(e,0,1),n=bw(e,-1);if(r==="%"&&n!=="%")throw new Ad("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ad("invalid intrinsic syntax, expected opening `%`");var i=[];return _z(e,$be,function(s,o,c,a){i[i.length]=c?_z(a,Ybe,"$1"):o||s}),i},Xbe=function(e,r){var n=e,i;if(vw(Sz,n)&&(i=Sz[n],n="%"+i[0]+"%"),vw(Cu,n)){var s=Cu[n];if(s===bd&&(s=jbe(n)),typeof s>"u"&&!r)throw new wd("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Ad("intrinsic "+e+" does not exist!")};Iz.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new wd("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new wd('"allowMissing" argument must be a boolean');if(Wbe(/^%?[^%]*%?$/,e)===null)throw new Ad("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Jbe(e),i=n.length>0?n[0]:"",s=Xbe("%"+i+"%",r),o=s.name,c=s.value,a=!1,u=s.alias;u&&(i=u[0],Kbe(n,Qbe([0,1],u)));for(var f=1,p=!0;f=n.length){var R=Iu(c,S);p=!!R,p&&"get"in R&&!("originalValue"in R.get)?c=R.get:c=c[S]}else p=vw(c,S),c=c[S];p&&!a&&(Cu[o]=c)}}return c}});var Aw=L((vRe,Cz)=>{"use strict";h();var Zbe=xu(),ww=Zbe("%Object.defineProperty%",!0)||!1;if(ww)try{ww({},"a",{value:1})}catch{ww=!1}Cz.exports=ww});var X4=L((wRe,xz)=>{"use strict";h();var ewe=xu(),Ew=ewe("%Object.getOwnPropertyDescriptor%",!0);if(Ew)try{Ew([],"length")}catch{Ew=null}xz.exports=Ew});var Rz=L((ERe,Pz)=>{"use strict";h();var Nz=Aw(),twe=W4(),Ed=yd(),Oz=X4();Pz.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Ed("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ed("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ed("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ed("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ed("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ed("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,a=!!Oz&&Oz(e,r);if(Nz)Nz(e,r,{configurable:o===null&&a?a.configurable:!o,enumerable:i===null&&a?a.enumerable:!i,value:n,writable:s===null&&a?a.writable:!s});else if(c||!i&&!s&&!o)e[r]=n;else throw new twe("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Bz=L((_Re,Dz)=>{"use strict";h();var Z4=Aw(),Mz=function(){return!!Z4};Mz.hasArrayLengthDefineBug=function(){if(!Z4)return null;try{return Z4([],"length",{value:1}).length!==1}catch{return!0}};Dz.exports=Mz});var kz=L((IRe,Uz)=>{"use strict";h();var rwe=xu(),Lz=Rz(),nwe=Bz()(),Fz=X4(),qz=yd(),iwe=rwe("%Math.floor%");Uz.exports=function(e,r){if(typeof e!="function")throw new qz("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||iwe(r)!==r)throw new qz("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Fz){var o=Fz(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(nwe?Lz(e,"length",r,!0,!0):Lz(e,"length",r)),e}});var Qz=L((xRe,Sw)=>{"use strict";h();var e5=yw(),_w=xu(),swe=kz(),owe=yd(),Gz=_w("%Function.prototype.apply%"),zz=_w("%Function.prototype.call%"),jz=_w("%Reflect.apply%",!0)||e5.call(zz,Gz),Vz=Aw(),awe=_w("%Math.max%");Sw.exports=function(e){if(typeof e!="function")throw new owe("a function is required");var r=jz(e5,zz,arguments);return swe(r,1+awe(0,e.length-(arguments.length-1)),!0)};var Hz=function(){return jz(e5,Gz,arguments)};Vz?Vz(Sw.exports,"apply",{value:Hz}):Sw.exports.apply=Hz});var Yz=L((ORe,$z)=>{"use strict";h();var Kz=xu(),Wz=Qz(),cwe=Wz(Kz("String.prototype.indexOf"));$z.exports=function(e,r){var n=Kz(e,!!r);return typeof n=="function"&&cwe(e,".prototype.")>-1?Wz(n):n}});var Jz=L(()=>{h()});var yj=L((BRe,mj)=>{h();var l5=typeof Map=="function"&&Map.prototype,t5=Object.getOwnPropertyDescriptor&&l5?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Iw=l5&&t5&&typeof t5.get=="function"?t5.get:null,Xz=l5&&Map.prototype.forEach,f5=typeof Set=="function"&&Set.prototype,r5=Object.getOwnPropertyDescriptor&&f5?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Cw=f5&&r5&&typeof r5.get=="function"?r5.get:null,Zz=f5&&Set.prototype.forEach,uwe=typeof WeakMap=="function"&&WeakMap.prototype,vp=uwe?WeakMap.prototype.has:null,lwe=typeof WeakSet=="function"&&WeakSet.prototype,bp=lwe?WeakSet.prototype.has:null,fwe=typeof WeakRef=="function"&&WeakRef.prototype,ej=fwe?WeakRef.prototype.deref:null,dwe=Boolean.prototype.valueOf,hwe=Object.prototype.toString,pwe=Function.prototype.toString,gwe=String.prototype.match,d5=String.prototype.slice,ic=String.prototype.replace,mwe=String.prototype.toUpperCase,tj=String.prototype.toLowerCase,lj=RegExp.prototype.test,rj=Array.prototype.concat,mo=Array.prototype.join,ywe=Array.prototype.slice,nj=Math.floor,s5=typeof BigInt=="function"?BigInt.prototype.valueOf:null,n5=Object.getOwnPropertySymbols,o5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Sd=typeof Symbol=="function"&&typeof Symbol.iterator=="object",vn=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Sd||!0)?Symbol.toStringTag:null,fj=Object.prototype.propertyIsEnumerable,ij=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function sj(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||lj.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-nj(-t):nj(t);if(n!==t){var i=String(n),s=d5.call(e,i.length+1);return ic.call(i,r,"$&_")+"."+ic.call(ic.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ic.call(e,r,"$&_")}var a5=Jz(),oj=a5.custom,aj=hj(oj)?oj:null;mj.exports=function t(e,r,n,i){var s=r||{};if(nc(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(nc(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=nc(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(nc(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(nc(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=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 gj(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return c?sj(e,a):a}if(typeof e=="bigint"){var u=String(e)+"n";return c?sj(e,u):u}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return c5(e)?"[Array]":"[Object]";var p=Bwe(s,n);if(typeof i>"u")i=[];else if(pj(i,e)>=0)return"[Circular]";function S(l,d,m){if(d&&(i=ywe.call(i),i.push(d)),m){var w={depth:s.depth};return nc(s,"quoteStyle")&&(w.quoteStyle=s.quoteStyle),t(l,w,n+1,i)}return t(l,s,n+1,i)}if(typeof e=="function"&&!cj(e)){var I=Iwe(e),N=Tw(e,S);return"[Function"+(I?": "+I:" (anonymous)")+"]"+(N.length>0?" { "+mo.call(N,", ")+" }":"")}if(hj(e)){var R=Sd?ic.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):o5.call(e);return typeof e=="object"&&!Sd?yp(R):R}if(Rwe(e)){for(var D="<"+tj.call(String(e.nodeName)),U=e.attributes||[],k=0;k",D}if(c5(e)){if(e.length===0)return"[]";var z=Tw(e,S);return p&&!Dwe(z)?"["+u5(z,p)+"]":"[ "+mo.call(z,", ")+" ]"}if(wwe(e)){var H=Tw(e,S);return!("cause"in Error.prototype)&&"cause"in e&&!fj.call(e,"cause")?"{ ["+String(e)+"] "+mo.call(rj.call("[cause]: "+S(e.cause),H),", ")+" }":H.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+mo.call(H,", ")+" }"}if(typeof e=="object"&&o){if(aj&&typeof e[aj]=="function"&&a5)return a5(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Cwe(e)){var F=[];return Xz&&Xz.call(e,function(l,d){F.push(S(d,e,!0)+" => "+S(l,e))}),uj("Map",Iw.call(e),F,p)}if(Owe(e)){var V=[];return Zz&&Zz.call(e,function(l){V.push(S(l,e))}),uj("Set",Cw.call(e),V,p)}if(xwe(e))return i5("WeakMap");if(Pwe(e))return i5("WeakSet");if(Nwe(e))return i5("WeakRef");if(Ewe(e))return yp(S(Number(e)));if(_we(e))return yp(S(s5.call(e)));if(Swe(e))return yp(dwe.call(e));if(Awe(e))return yp(S(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!bwe(e)&&!cj(e)){var q=Tw(e,S),C=ij?ij(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",x=!C&&vn&&Object(e)===e&&vn in e?d5.call(sc(e),8,-1):B?"Object":"",g=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",v=g+(x||B?"["+mo.call(rj.call([],x||[],B||[]),": ")+"] ":"");return q.length===0?v+"{}":p?v+"{"+u5(q,p)+"}":v+"{ "+mo.call(q,", ")+" }"}return String(e)};function dj(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function vwe(t){return ic.call(String(t),/"/g,""")}function c5(t){return sc(t)==="[object Array]"&&(!vn||!(typeof t=="object"&&vn in t))}function bwe(t){return sc(t)==="[object Date]"&&(!vn||!(typeof t=="object"&&vn in t))}function cj(t){return sc(t)==="[object RegExp]"&&(!vn||!(typeof t=="object"&&vn in t))}function wwe(t){return sc(t)==="[object Error]"&&(!vn||!(typeof t=="object"&&vn in t))}function Awe(t){return sc(t)==="[object String]"&&(!vn||!(typeof t=="object"&&vn in t))}function Ewe(t){return sc(t)==="[object Number]"&&(!vn||!(typeof t=="object"&&vn in t))}function Swe(t){return sc(t)==="[object Boolean]"&&(!vn||!(typeof t=="object"&&vn in t))}function hj(t){if(Sd)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!o5)return!1;try{return o5.call(t),!0}catch{}return!1}function _we(t){if(!t||typeof t!="object"||!s5)return!1;try{return s5.call(t),!0}catch{}return!1}var Twe=Object.prototype.hasOwnProperty||function(t){return t in this};function nc(t,e){return Twe.call(t,e)}function sc(t){return hwe.call(t)}function Iwe(t){if(t.name)return t.name;var e=gwe.call(pwe.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function pj(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return gj(d5.call(t,0,e.maxStringLength),e)+n}var i=ic.call(ic.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Mwe);return dj(i,"single",e)}function Mwe(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+mwe.call(e.toString(16))}function yp(t){return"Object("+t+")"}function i5(t){return t+" { ? }"}function uj(t,e,r,n){var i=n?u5(r,n):mo.call(r,", ");return t+" ("+e+") {"+i+"}"}function Dwe(t){for(var e=0;e=0)return!1;return!0}function Bwe(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=mo.call(Array(t.indent+1)," ");else return null;return{base:r,prev:mo.call(Array(e+1),r)}}function u5(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+mo.call(t,","+r)+` +`+e.prev}function Tw(t,e){var r=c5(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";h();var vj=xu(),_d=Yz(),Lwe=yj(),Fwe=yd(),xw=vj("%WeakMap%",!0),Nw=vj("%Map%",!0),qwe=_d("WeakMap.prototype.get",!0),Uwe=_d("WeakMap.prototype.set",!0),kwe=_d("WeakMap.prototype.has",!0),Vwe=_d("Map.prototype.get",!0),Hwe=_d("Map.prototype.set",!0),Gwe=_d("Map.prototype.has",!0),h5=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},zwe=function(t,e){var r=h5(t,e);return r&&r.value},jwe=function(t,e,r){var n=h5(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Qwe=function(t,e){return!!h5(t,e)};bj.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Fwe("Side channel does not contain "+Lwe(s))},get:function(s){if(xw&&s&&(typeof s=="object"||typeof s=="function")){if(e)return qwe(e,s)}else if(Nw){if(r)return Vwe(r,s)}else if(n)return zwe(n,s)},has:function(s){if(xw&&s&&(typeof s=="object"||typeof s=="function")){if(e)return kwe(e,s)}else if(Nw){if(r)return Gwe(r,s)}else if(n)return Qwe(n,s);return!1},set:function(s,o){xw&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new xw),Uwe(e,s,o)):Nw?(r||(r=new Nw),Hwe(r,s,o)):(n||(n={key:{},next:null}),jwe(n,s,o))}};return i}});var Ow=L((URe,Aj)=>{"use strict";h();var Kwe=String.prototype.replace,Wwe=/%20/g,p5={RFC1738:"RFC1738",RFC3986:"RFC3986"};Aj.exports={default:p5.RFC3986,formatters:{RFC1738:function(t){return Kwe.call(t,Wwe,"+")},RFC3986:function(t){return String(t)}},RFC1738:p5.RFC1738,RFC3986:p5.RFC3986}});var m5=L((VRe,Sj)=>{"use strict";h();var $we=Ow(),g5=Object.prototype.hasOwnProperty,Nu=Array.isArray,yo=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Ywe=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Nu(n)){for(var i=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||s===$we.RFC1738&&(u===40||u===41)){c+=o.charAt(a);continue}if(u<128){c=c+yo[u];continue}if(u<2048){c=c+(yo[192|u>>6]+yo[128|u&63]);continue}if(u<55296||u>=57344){c=c+(yo[224|u>>12]+yo[128|u>>6&63]+yo[128|u&63]);continue}a+=1,u=65536+((u&1023)<<10|o.charCodeAt(a)&1023),c+=yo[240|u>>18]+yo[128|u>>12&63]+yo[128|u>>6&63]+yo[128|u&63]}return c},tAe=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";h();var Ij=wj(),v5=m5(),wp=Ow(),oAe=Object.prototype.hasOwnProperty,_j={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Ou=Array.isArray,aAe=String.prototype.split,cAe=Array.prototype.push,Cj=function(t,e){cAe.apply(t,Ou(e)?e:[e])},uAe=Date.prototype.toISOString,Tj=wp.default,rn={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:v5.encode,encodeValuesOnly:!1,format:Tj,formatter:wp.formatters[Tj],indices:!1,serializeDate:function(e){return uAe.call(e)},skipNulls:!1,strictNullHandling:!1},lAe=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},y5={},fAe=function t(e,r,n,i,s,o,c,a,u,f,p,S,I,N,R){for(var D=e,U=R,k=0,z=!1;(U=U.get(y5))!==void 0&&!z;){var H=U.get(e);if(k+=1,typeof H<"u"){if(H===k)throw new RangeError("Cyclic object value");z=!0}typeof U.get(y5)>"u"&&(k=0)}if(typeof c=="function"?D=c(r,D):D instanceof Date?D=f(D):n==="comma"&&Ou(D)&&(D=v5.maybeMap(D,function(_){return _ instanceof Date?f(_):_})),D===null){if(i)return o&&!I?o(r,rn.encoder,N,"key",p):r;D=""}if(lAe(D)||v5.isBuffer(D)){if(o){var F=I?r:o(r,rn.encoder,N,"key",p);if(n==="comma"&&I){for(var V=aAe.call(String(D),","),q="",C=0;C"u")return B;var x;if(n==="comma"&&Ou(D))x=[{value:D.length>0?D.join(",")||null:void 0}];else if(Ou(c))x=c;else{var g=Object.keys(D);x=a?g.sort(a):g}for(var v=0;v"u"?rn.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:rn.charsetSentinel,delimiter:typeof e.delimiter>"u"?rn.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:rn.encode,encoder:typeof e.encoder=="function"?e.encoder:rn.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:rn.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:rn.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:rn.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:rn.strictNullHandling}};xj.exports=function(t,e){var r=t,n=dAe(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Ou(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var c;e&&e.arrayFormat in _j?c=e.arrayFormat:e&&"indices"in e?c=e.indices?"indices":"repeat":c="indices";var a=_j[c];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var u=Ij(),f=0;f0?I+S:""}});var Rj=L((jRe,Pj)=>{"use strict";h();var Td=m5(),b5=Object.prototype.hasOwnProperty,hAe=Array.isArray,Wr={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Td.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},pAe=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Oj=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},gAe="utf8=%26%2310003%3B",mAe="utf8=%E2%9C%93",yAe=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),c=-1,a,u=r.charset;if(r.charsetSentinel)for(a=0;a-1&&(N=hAe(N)?[N]:N),b5.call(n,I)?n[I]=Td.combine(n[I],N):n[I]=N}return n},vAe=function(t,e,r,n){for(var i=n?e:Oj(e,r),s=t.length-1;s>=0;--s){var o,c=t[s];if(c==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var a=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=parseInt(a,10);!r.parseArrays&&a===""?o={0:i}:!isNaN(u)&&c!==a&&String(u)===a&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(o=[],o[u]=i):a!=="__proto__"&&(o[a]=i)}i=o}return i},bAe=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,c=/(\[[^[\]]*])/g,a=n.depth>0&&o.exec(s),u=a?s.slice(0,a.index):s,f=[];if(u){if(!n.plainObjects&&b5.call(Object.prototype,u)&&!n.allowPrototypes)return;f.push(u)}for(var p=0;n.depth>0&&(a=c.exec(s))!==null&&p"u"?Wr.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Wr.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Wr.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Wr.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Wr.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Wr.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Wr.comma,decoder:typeof e.decoder=="function"?e.decoder:Wr.decoder,delimiter:typeof e.delimiter=="string"||Td.isRegExp(e.delimiter)?e.delimiter:Wr.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Wr.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Wr.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Wr.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Wr.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Wr.strictNullHandling}};Pj.exports=function(t,e){var r=wAe(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?yAe(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";h();var AAe=Nj(),EAe=Rj(),SAe=Ow();Mj.exports={formats:SAe,parse:EAe,stringify:AAe}});var w5=L(Gt=>{"use strict";h();Object.defineProperty(Gt,"__esModule",{value:!0});Gt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Gt.WALLET_PROVIDER_CALLBACK_PARAM=Gt.WALLET_PROVIDER_SIGN_MESSAGE_URL=Gt.WALLET_PROVIDER_GUARD_TRANSACTION_URL=Gt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Gt.WALLET_PROVIDER_SEND_TRANSACTION_URL=Gt.WALLET_PROVIDER_DISCONNECT_URL=Gt.WALLET_PROVIDER_CONNECT_URL=Gt.XALIAS_PROVIDER_TESTNET=Gt.XALIAS_PROVIDER_DEVNET=Gt.XALIAS_PROVIDER_MAINNET=Gt.WALLET_PROVIDER_TESTNET=Gt.WALLET_PROVIDER_DEVNET=Gt.WALLET_PROVIDER_MAINNET=void 0;Gt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";Gt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";Gt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";Gt.XALIAS_PROVIDER_MAINNET="https://xalias.com";Gt.XALIAS_PROVIDER_DEVNET="https://devnet.xalias.com";Gt.XALIAS_PROVIDER_TESTNET="https://testnet.xalias.com";Gt.WALLET_PROVIDER_CONNECT_URL="hook/login";Gt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Gt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Gt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Gt.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";Gt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";Gt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Gt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var Bj=L(Id=>{"use strict";h();Object.defineProperty(Id,"__esModule",{value:!0});Id.ErrCannotSignedMessage=Id.ErrCannotGetSignedTransactions=void 0;var A5=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};Id.ErrCannotGetSignedTransactions=A5;var E5=class extends Error{constructor(){super("Cannot get signed message")}};Id.ErrCannotSignedMessage=E5});var Lj=L(Pw=>{"use strict";h();Object.defineProperty(Pw,"__esModule",{value:!0});Pw.PlainSignedTransaction=void 0;var S5=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};Pw.PlainSignedTransaction=S5});var Cd=L(cc=>{"use strict";h();var oc=cc&&cc.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})},_Ae=cc&&cc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cc,"__esModule",{value:!0});cc.WalletProvider=void 0;var TAe=$c(),_5=_Ae(Dj()),ac=w5(),T5=Bj(),IAe=Lj(),I5=class t{constructor(e){this.walletUrl=e}login(e){return oc(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ac.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return oc(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return oc(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return oc(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ac.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return oc(this,void 0,void 0,function*(){let n=new TAe.Message({data:b.Buffer.from(e.data),address:e.address,signer:"web-wallet",version:e.version}),i=this.buildWalletUrl({endpoint:ac.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:n.data.toString()}});return yield this.redirect(i),i})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=_5.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new T5.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return oc(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ac.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return oc(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ac.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return oc(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(e=window.location.search){let r=_5.default.parse(e.slice(1));return t.isTxSignReturnSuccess(r)?this.getTxSignReturnValue(r):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ac.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ac.WALLET_PROVIDER_CALLBACK_PARAM]===ac.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){console.info("getTxSignReturnValue(), urlParams:",e);let r=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let s of r)if(!e[s]||!Array.isArray(e[s]))throw new T5.ErrCannotGetSignedTransactions;let n=e.nonce.length;for(let s of r)if(e[s].length!==n)throw new T5.ErrCannotGetSignedTransactions;let i=[];for(let s=0;s{let c=t.prepareWalletTransaction(o);for(let a in c)c.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(c[a])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};cc.WalletProvider=I5});var Fj=L(Rw=>{"use strict";h();Object.defineProperty(Rw,"__esModule",{value:!0});Rw.NativeAuthClientConfig=void 0;var C5=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Rw.NativeAuthClientConfig=C5});var N5=L(xd=>{"use strict";h();var Pu=xd&&xd.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(xd,"__esModule",{value:!0});xd.NativeAuthClient=void 0;var CAe=e0(),xAe=Fj(),x5=class{constructor(e){this.config=Object.assign(new xAe.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Pu(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return Pu(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Pu(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return Pu(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return Pu(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return Pu(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(b.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return Pu(this,void 0,void 0,function*(){return yield CAe.default.get(e,{headers:this.config.extraRequestHeaders})})}};xd.NativeAuthClient=x5});var Xj=L((zMe,Jj)=>{h();Jj.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var uc=L(Mu=>{h();var P5,PAe=[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];Mu.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};Mu.getSymbolTotalCodewords=function(e){return PAe[e]};Mu.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Mu.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');P5=e};Mu.isKanjiModeEnabled=function(){return typeof P5<"u"};Mu.toSJIS=function(e){return P5(e)}});var Fw=L(qi=>{h();qi.L={bit:1};qi.M={bit:0};qi.Q={bit:3};qi.H={bit:2};function RAe(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return qi.L;case"m":case"medium":return qi.M;case"q":case"quartile":return qi.Q;case"h":case"high":return qi.H;default:throw new Error("Unknown EC Level: "+t)}}qi.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};qi.from=function(e,r){if(qi.isValid(e))return e;try{return RAe(e)}catch{return r}}});var tQ=L((YMe,eQ)=>{h();function Zj(){this.buffer=[],this.length=0}Zj.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};eQ.exports=Zj});var nQ=L((XMe,rQ)=>{h();function Ap(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Ap.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Ap.prototype.get=function(t,e){return this.data[t*this.size+e]};Ap.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Ap.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};rQ.exports=Ap});var iQ=L(qw=>{h();var MAe=uc().getSymbolSize;qw.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=MAe(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{h();var DAe=uc().getSymbolSize,sQ=7;oQ.getPositions=function(e){let r=DAe(e);return[[0,0],[r-sQ,0],[0,r-sQ]]}});var cQ=L(ir=>{h();ir.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Du={N1:3,N2:3,N3:40,N4:10};ir.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};ir.from=function(e){return ir.isValid(e)?parseInt(e,10):void 0};ir.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,c=null;for(let a=0;a=5&&(n+=Du.N1+(i-5)),o=f,i=1),f=e.get(u,a),f===c?s++:(s>=5&&(n+=Du.N1+(s-5)),c=f,s=1)}i>=5&&(n+=Du.N1+(i-5)),s>=5&&(n+=Du.N1+(s-5))}return n};ir.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(c,o),c>=10&&(s===1488||s===93)&&n++}return n*Du.N3};ir.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{h();var lc=Fw(),Uw=[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],kw=[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];R5.getBlocksCount=function(e,r){switch(r){case lc.L:return Uw[(e-1)*4+0];case lc.M:return Uw[(e-1)*4+1];case lc.Q:return Uw[(e-1)*4+2];case lc.H:return Uw[(e-1)*4+3];default:return}};R5.getTotalCodewordsCount=function(e,r){switch(r){case lc.L:return kw[(e-1)*4+0];case lc.M:return kw[(e-1)*4+1];case lc.Q:return kw[(e-1)*4+2];case lc.H:return kw[(e-1)*4+3];default:return}}});var uQ=L(Hw=>{h();var Ep=new Uint8Array(512),Vw=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Ep[r]=e,Vw[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Ep[r]=Ep[r-255]})();Hw.log=function(e){if(e<1)throw new Error("log("+e+")");return Vw[e]};Hw.exp=function(e){return Ep[e]};Hw.mul=function(e,r){return e===0||r===0?0:Ep[Vw[e]+Vw[r]]}});var lQ=L(Sp=>{h();var D5=uQ();Sp.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{h();var fQ=lQ();function B5(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}B5.prototype.initialize=function(e){this.degree=e,this.genPoly=fQ.generateECPolynomial(this.degree)};B5.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=fQ.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};dQ.exports=B5});var L5=L(pQ=>{h();pQ.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var F5=L(ea=>{h();var gQ="[0-9]+",LAe="[A-Z $%*+\\-./:]+",_p="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";_p=_p.replace(/u/g,"\\u");var FAe="(?:(?![A-Z0-9 $%*+\\-./:]|"+_p+`)(?:.|[\r +]))+`;ea.KANJI=new RegExp(_p,"g");ea.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ea.BYTE=new RegExp(FAe,"g");ea.NUMERIC=new RegExp(gQ,"g");ea.ALPHANUMERIC=new RegExp(LAe,"g");var qAe=new RegExp("^"+_p+"$"),UAe=new RegExp("^"+gQ+"$"),kAe=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ea.testKanji=function(e){return qAe.test(e)};ea.testNumeric=function(e){return UAe.test(e)};ea.testAlphanumeric=function(e){return kAe.test(e)}});var fc=L(Mr=>{h();var VAe=L5(),q5=F5();Mr.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Mr.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Mr.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Mr.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Mr.MIXED={bit:-1};Mr.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!VAe.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Mr.getBestModeForData=function(e){return q5.testNumeric(e)?Mr.NUMERIC:q5.testAlphanumeric(e)?Mr.ALPHANUMERIC:q5.testKanji(e)?Mr.KANJI:Mr.BYTE};Mr.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Mr.isValid=function(e){return e&&e.bit&&e.ccBits};function HAe(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Mr.NUMERIC;case"alphanumeric":return Mr.ALPHANUMERIC;case"kanji":return Mr.KANJI;case"byte":return Mr.BYTE;default:throw new Error("Unknown mode: "+t)}}Mr.from=function(e,r){if(Mr.isValid(e))return e;try{return HAe(e)}catch{return r}}});var wQ=L(Bu=>{h();var Gw=uc(),GAe=M5(),mQ=Fw(),dc=fc(),U5=L5(),vQ=7973,yQ=Gw.getBCHDigit(vQ);function zAe(t,e,r){for(let n=1;n<=40;n++)if(e<=Bu.getCapacity(n,r,t))return n}function bQ(t,e){return dc.getCharCountIndicator(t,e)+4}function jAe(t,e){let r=0;return t.forEach(function(n){let i=bQ(n.mode,e);r+=i+n.getBitsLength()}),r}function QAe(t,e){for(let r=1;r<=40;r++)if(jAe(t,r)<=Bu.getCapacity(r,e,dc.MIXED))return r}Bu.from=function(e,r){return U5.isValid(e)?parseInt(e,10):r};Bu.getCapacity=function(e,r,n){if(!U5.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=dc.BYTE);let i=Gw.getSymbolTotalCodewords(e),s=GAe.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===dc.MIXED)return o;let c=o-bQ(n,e);switch(n){case dc.NUMERIC:return Math.floor(c/10*3);case dc.ALPHANUMERIC:return Math.floor(c/11*2);case dc.KANJI:return Math.floor(c/13);case dc.BYTE:default:return Math.floor(c/8)}};Bu.getBestVersionForData=function(e,r){let n,i=mQ.from(r,mQ.M);if(Array.isArray(e)){if(e.length>1)return QAe(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return zAe(n.mode,n.getLength(),i)};Bu.getEncodedBits=function(e){if(!U5.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Gw.getBCHDigit(r)-yQ>=0;)r^=vQ<{h();var k5=uc(),EQ=1335,KAe=21522,AQ=k5.getBCHDigit(EQ);SQ.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;k5.getBCHDigit(i)-AQ>=0;)i^=EQ<{h();var WAe=fc();function Pd(t){this.mode=WAe.NUMERIC,this.data=t.toString()}Pd.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Pd.prototype.getLength=function(){return this.data.length};Pd.prototype.getBitsLength=function(){return Pd.getBitsLength(this.data.length)};Pd.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};TQ.exports=Pd});var xQ=L((I7e,CQ)=>{h();var $Ae=fc(),V5=["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 Rd(t){this.mode=$Ae.ALPHANUMERIC,this.data=t}Rd.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Rd.prototype.getLength=function(){return this.data.length};Rd.prototype.getBitsLength=function(){return Rd.getBitsLength(this.data.length)};Rd.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=V5.indexOf(this.data[r])*45;n+=V5.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(V5.indexOf(this.data[r]),6)};CQ.exports=Rd});var OQ=L((x7e,NQ)=>{h();var YAe=fc();function Md(t){this.mode=YAe.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}Md.getBitsLength=function(e){return e*8};Md.prototype.getLength=function(){return this.data.length};Md.prototype.getBitsLength=function(){return Md.getBitsLength(this.data.length)};Md.prototype.write=function(t){for(let e=0,r=this.data.length;e{h();var JAe=fc(),XAe=uc();function Dd(t){this.mode=JAe.KANJI,this.data=t}Dd.getBitsLength=function(e){return e*13};Dd.prototype.getLength=function(){return this.data.length};Dd.prototype.getBitsLength=function(){return Dd.getBitsLength(this.data.length)};Dd.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};PQ.exports=Dd});var MQ=L((R7e,H5)=>{"use strict";h();var Tp={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Tp.PriorityQueue.make();s.push(e,0);for(var o,c,a,u,f,p,S,I,N;!s.empty();){o=s.pop(),c=o.value,u=o.cost,f=t[c]||{};for(a in f)f.hasOwnProperty(a)&&(p=f[a],S=u+p,I=i[a],N=typeof i[a]>"u",(N||I>S)&&(i[a]=S,s.push(a,S),n[a]=c))}if(typeof r<"u"&&typeof i[r]>"u"){var R=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(R)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Tp.single_source_shortest_paths(t,e,r);return Tp.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Tp.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof H5<"u"&&(H5.exports=Tp)});var VQ=L(Bd=>{h();var zt=fc(),LQ=IQ(),FQ=xQ(),qQ=OQ(),UQ=RQ(),Ip=F5(),zw=uc(),ZAe=MQ();function DQ(t){return unescape(encodeURIComponent(t)).length}function Cp(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function kQ(t){let e=Cp(Ip.NUMERIC,zt.NUMERIC,t),r=Cp(Ip.ALPHANUMERIC,zt.ALPHANUMERIC,t),n,i;return zw.isKanjiModeEnabled()?(n=Cp(Ip.BYTE,zt.BYTE,t),i=Cp(Ip.KANJI,zt.KANJI,t)):(n=Cp(Ip.BYTE_KANJI,zt.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,c){return o.index-c.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function G5(t,e){switch(e){case zt.NUMERIC:return LQ.getBitsLength(t);case zt.ALPHANUMERIC:return FQ.getBitsLength(t);case zt.KANJI:return UQ.getBitsLength(t);case zt.BYTE:return qQ.getBitsLength(t)}}function e2e(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function t2e(t){let e=[];for(let r=0;r{h();var Qw=uc(),z5=Fw(),n2e=tQ(),i2e=nQ(),s2e=iQ(),o2e=aQ(),K5=cQ(),W5=M5(),a2e=hQ(),jw=wQ(),c2e=_Q(),u2e=fc(),j5=VQ();function l2e(t,e){let r=t.size,n=o2e.getPositions(e);for(let i=0;i=0&&c<=6&&(a===0||a===6)||a>=0&&a<=6&&(c===0||c===6)||c>=2&&c<=4&&a>=2&&a<=4?t.set(s+c,o+a,!0,!0):t.set(s+c,o+a,!1,!0))}}function f2e(t){let e=t.size;for(let r=8;r>c&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function Q5(t,e,r){let n=t.size,i=c2e.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function p2e(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let c=r-1;c>0;c-=2)for(c===6&&c--;;){for(let a=0;a<2;a++)if(!t.isReserved(i,c-a)){let u=!1;o>>s&1)===1),t.set(i,c-a,u),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function g2e(t,e,r){let n=new n2e;r.forEach(function(a){n.put(a.mode.bit,4),n.put(a.getLength(),u2e.getCharCountIndicator(a.mode,t)),a.write(n)});let i=Qw.getSymbolTotalCodewords(t),s=W5.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let c=(o-n.getLengthInBits())/8;for(let a=0;a=7&&vge(a,e),Age(a,o),isNaN(n)&&(n=YC.getBestMask(a,$C.bind(null,a,r))),YC.applyMask(n,a),$C(a,r,n),{modules:a,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}RV.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=KC.M,i,s;return typeof r<"u"&&(n=KC.from(r.errorCorrectionLevel,KC.M),i=Z1.from(r.version),s=YC.from(r.maskPattern),r.toSJISFunc&&ew.setToSJISFunction(r.toSJISFunc)),Sge(e,i,n,s)}});var XC=D(Su=>{h();function MV(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}Su.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:MV(e.color.dark||"#000000ff"),light:MV(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Su.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Su.getImageWidth=function(e,r){let n=Su.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Su.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Su.getScale(i,n),u=Math.floor((i+n.margin*2)*o),a=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=a&&d>=a&&f{h();var ZC=XC();function Ige(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function _ge(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}tw.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=_ge()),i=ZC.getOptions(i);let o=ZC.getImageWidth(e.modules.size,i),u=s.getContext("2d"),a=u.createImageData(o,o);return ZC.qrToImageData(a.data,e,i),Ige(u,s,o),u.putImageData(a,0,0),s};tw.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=tw.render(e,r,i),o=i.type||"image/png",u=i.rendererOpts||{};return s.toDataURL(o,u.quality)}});var qV=D(UV=>{h();var Tge=XC();function FV(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function e3(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Cge(t,e,r){let n="",i=0,s=!1,o=0;for(let u=0;u0&&a>0&&t[u-1]||(n+=s?e3("M",a+r,.5+c+r):e3("m",i,0),i=0,s=!1),a+1':"",c="',f='viewBox="0 0 '+u+" "+u+'"',w=''+a+c+` -`;return typeof n=="function"&&n(null,w),w}});var kV=D(Nd=>{h();var Nge=k9(),t3=BV(),VV=LV(),xge=qV();function r3(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,u=typeof s[o-1]=="function";if(!u&&!Nge())throw new Error("Callback required as last argument");if(u){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(a,c){try{let f=t3.create(r,n);a(t(f,e,n))}catch(f){c(f)}})}try{let a=t3.create(r,n);i(null,t(a,e,n))}catch(a){i(a)}}Nd.create=t3.create;Nd.toCanvas=r3.bind(null,VV.render);Nd.toDataURL=r3.bind(null,VV.renderToDataURL);Nd.toString=r3.bind(null,function(t,e,r){return xge.render(t,r)})});var XV=D(ua=>{"use strict";h();var Vge=ua&&ua.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JV=ua&&ua.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vge(e,t,r)};Object.defineProperty(ua,"__esModule",{value:!0});JV(Ol(),ua);JV(J2(),ua)});var uk=D(aw=>{"use strict";h();Object.defineProperty(aw,"__esModule",{value:!0});aw.isWindowAvailable=void 0;var kge=()=>typeof window<"u"&&typeof window?.location<"u";aw.isWindowAvailable=kge});var o3=D(uw=>{"use strict";h();Object.defineProperty(uw,"__esModule",{value:!0});uw.getTargetOrigin=void 0;var Hge=uk(),Gge=()=>{var t;if((0,Hge.isWindowAvailable)()){let e=window.location.ancestorOrigins;return(t=e?.[e.length-1])!==null&&t!==void 0?t:"*"}return"*"};uw.getTargetOrigin=Gge});var cw=D(ca=>{"use strict";h();Object.defineProperty(ca,"__esModule",{value:!0});ca.SignMessageStatusEnum=ca.CrossWindowProviderResponseEnums=ca.CrossWindowProviderRequestEnums=void 0;var ck;(function(t){t.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",t.guardTransactionsRequest="GUARD_TRANSACTIONS_REQUEST",t.signMessageRequest="SIGN_MESSAGE_REQUEST",t.loginRequest="LOGIN_REQUEST",t.logoutRequest="LOGOUT_REQUEST",t.cancelAction="CANCEL_ACTION_REQUEST",t.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",t.finalizeResetStateRequest="FINALIZE_RESET_STATE_REQUEST"})(ck||(ca.CrossWindowProviderRequestEnums=ck={}));var lk;(function(t){t.handshakeResponse="HANDSHAKE_RESPONSE",t.guardTransactionsResponse="GUARD_TRANSACTIONS_RESPONSE",t.loginResponse="LOGIN_RESPONSE",t.disconnectResponse="DISCONNECT_RESPONSE",t.cancelResponse="CANCEL_RESPONSE",t.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",t.signMessageResponse="SIGN_MESSAGE_RESPONSE",t.noneResponse="NONE_RESPONSE",t.resetStateResponse="RESET_STATE_RESPONSE"})(lk||(ca.CrossWindowProviderResponseEnums=lk={}));var fk;(function(t){t.pending="pending",t.failed="failed",t.signed="signed",t.cancelled="cancelled"})(fk||(ca.SignMessageStatusEnum=fk={}))});var fw=D(lw=>{"use strict";h();Object.defineProperty(lw,"__esModule",{value:!0});lw.getSafeWindow=void 0;var jge=()=>typeof window<"u"?window:{};lw.getSafeWindow=jge});var hk=D(hw=>{"use strict";h();Object.defineProperty(hw,"__esModule",{value:!0});hw.isMobileWebview=void 0;var zge=fw(),Qge=()=>{let t=(0,zge.getSafeWindow)();return t.ReactNativeWebView||t.webkit};hw.isMobileWebview=Qge});var a3=D(dw=>{"use strict";h();Object.defineProperty(dw,"__esModule",{value:!0});dw.getSafeDocument=void 0;var Kge=()=>typeof document<"u"?document:{};dw.getSafeDocument=Kge});var gk=D(Kl=>{"use strict";h();Object.defineProperty(Kl,"__esModule",{value:!0});Kl.webviewProviderEventHandler=void 0;var Wge=o3(),$ge=cw(),dk=hk(),Yge=fw(),Jge=a3(),Xge=(t,e)=>r=>{var n,i,s,o;let u=r.data;try{u=(0,dk.isMobileWebview)()&&typeof u=="string"?JSON.parse(u):u}catch{console.error("error parsing eventData",u)}let{type:a,payload:c}=u;!(0,dk.isMobileWebview)()&&r.origin!=(0,Wge.getTargetOrigin)()||!(t===a||a===$ge.CrossWindowProviderResponseEnums.cancelResponse)||((i=(n=(0,Yge.getSafeWindow)()).removeEventListener)===null||i===void 0||i.call(n,"message",(0,Kl.webviewProviderEventHandler)(t,e)),(o=(s=(0,Jge.getSafeDocument)()).removeEventListener)===null||o===void 0||o.call(s,"message",(0,Kl.webviewProviderEventHandler)(t,e)),e({type:a,payload:c}))};Kl.webviewProviderEventHandler=Xge});var pk=D(Wl=>{"use strict";h();Object.defineProperty(Wl,"__esModule",{value:!0});Wl.safeWindow=Wl.responseTypeMap=void 0;var Vr=cw();Wl.responseTypeMap={[Vr.CrossWindowProviderRequestEnums.signTransactionsRequest]:Vr.CrossWindowProviderResponseEnums.signTransactionsResponse,[Vr.CrossWindowProviderRequestEnums.guardTransactionsRequest]:Vr.CrossWindowProviderResponseEnums.guardTransactionsResponse,[Vr.CrossWindowProviderRequestEnums.signMessageRequest]:Vr.CrossWindowProviderResponseEnums.signMessageResponse,[Vr.CrossWindowProviderRequestEnums.loginRequest]:Vr.CrossWindowProviderResponseEnums.loginResponse,[Vr.CrossWindowProviderRequestEnums.logoutRequest]:Vr.CrossWindowProviderResponseEnums.disconnectResponse,[Vr.CrossWindowProviderRequestEnums.cancelAction]:Vr.CrossWindowProviderResponseEnums.cancelResponse,[Vr.CrossWindowProviderRequestEnums.finalizeHandshakeRequest]:Vr.CrossWindowProviderResponseEnums.noneResponse,[Vr.CrossWindowProviderRequestEnums.finalizeResetStateRequest]:Vr.CrossWindowProviderResponseEnums.resetStateResponse};Wl.safeWindow=typeof window<"u"?window:{}});var yk=D($l=>{"use strict";h();var ni=$l&&$l.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(f){try{c(n.next(f))}catch(d){o(d)}}function a(f){try{c(n.throw(f))}catch(d){o(d)}}function c(f){f.done?s(f.value):i(f.value).then(u,a)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty($l,"__esModule",{value:!0});$l.WebviewProvider=void 0;var Zge=en(),u3=gk(),ii=cw(),epe=pk(),mk=o3(),c3=fw(),tpe=a3(),l3=class t{static getInstance(e){return t._instance||(t._instance=new t(e)),t._instance}constructor(e){this.resetState=r=>{var n,i;(i=(n=(0,c3.getSafeWindow)()).addEventListener)===null||i===void 0||i.call(n,"message",(0,u3.webviewProviderEventHandler)(ii.CrossWindowProviderResponseEnums.resetStateResponse,s=>{s.type===ii.CrossWindowProviderResponseEnums.resetStateResponse&&(r?.(),setTimeout(()=>{this.finalizeResetState()},500))}))},this.init=()=>ni(this,void 0,void 0,function*(){return this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.finalizeHandshakeRequest,payload:void 0}),!0}),this.login=()=>ni(this,void 0,void 0,function*(){return!0}),this.logout=()=>ni(this,void 0,void 0,function*(){return!!(yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.logoutRequest,payload:void 0})).payload.data}),this.relogin=()=>ni(this,void 0,void 0,function*(){let r=yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.loginRequest,payload:void 0}),{data:n,error:i}=r.payload;if(i||!n)throw new Error("Unable to re-login");let{accessToken:s}=n;return s||(console.error("Unable to re-login. Missing accessToken."),null)}),this.signTransactions=r=>ni(this,void 0,void 0,function*(){let n=yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.signTransactionsRequest,payload:r.map(o=>o.toPlainObject())}),{data:i,error:s}=n.payload;return s||!i?(console.error("Unable to sign transactions"),null):n.type==ii.CrossWindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the transactions signing action"),this.cancelAction(),null):i.map(o=>Zge.Transaction.fromPlainObject(o))}),this.signTransaction=r=>ni(this,void 0,void 0,function*(){let n=yield this.signTransactions([r]);return n?.[0]}),this.signMessage=r=>ni(this,void 0,void 0,function*(){let n=yield this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.signMessageRequest,payload:{message:r.message.toString()}}),{data:i,error:s}=n.payload;return s||!i?(console.error("Unable to sign message"),null):n.type==ii.CrossWindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the message signing action"),this.cancelAction(),null):i.status!==ii.SignMessageStatusEnum.signed?(console.error("Could not sign message"),null):(r.applySignature(p.Buffer.from(String(i.signature),"hex")),r)}),this.cancelAction=()=>ni(this,void 0,void 0,function*(){return this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.cancelAction,payload:void 0})}),this.finalizeResetState=()=>ni(this,void 0,void 0,function*(){return this.sendPostMessage({type:ii.CrossWindowProviderRequestEnums.finalizeResetStateRequest,payload:void 0})}),this.isInitialized=()=>!0,this.isConnected=()=>ni(this,void 0,void 0,function*(){return Promise.resolve(!0)}),this.sendPostMessage=r=>ni(this,void 0,void 0,function*(){var n,i;let s=(0,c3.getSafeWindow)();return s.ReactNativeWebView?s.ReactNativeWebView.postMessage(JSON.stringify(r)):s.webkit?(i=(n=s.webkit.messageHandlers)===null||n===void 0?void 0:n.jsHandler)===null||i===void 0||i.postMessage(JSON.stringify(r),(0,mk.getTargetOrigin)()):s.parent&&s.parent.postMessage(r,(0,mk.getTargetOrigin)()),yield this.waitingForResponse(epe.responseTypeMap[r.type])}),this.waitingForResponse=r=>ni(this,void 0,void 0,function*(){return yield new Promise(n=>{var i,s,o,u;(s=(i=(0,c3.getSafeWindow)()).addEventListener)===null||s===void 0||s.call(i,"message",(0,u3.webviewProviderEventHandler)(r,n)),(u=(o=(0,tpe.getSafeDocument)()).addEventListener)===null||u===void 0||u.call(o,"message",(0,u3.webviewProviderEventHandler)(r,n))})}),e?.resetStateCallback&&this.resetState(e.resetStateCallback)}};$l.WebviewProvider=l3});var f3=D(Iu=>{"use strict";h();var rpe=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),npe=Iu&&Iu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rpe(e,t,r)};Object.defineProperty(Iu,"__esModule",{value:!0});npe(yk(),Iu)});h();var m3=ge(Ia(),1),y3=ge(Fb(),1),yw=ge(d0(),1),w3=ge(Hb(),1),ape=ge(ke(),1),upe=ge(Sc(),1),cpe=ge(en(),1),lpe=ge(N0(),1),Ik=ge(zb(),1),fpe=ge(V0(),1),hpe=ge(H0(),1),_k=ge(go(),1),_s=ge(Lf(),1),Tk=ge(wf(),1),Ck=ge(Wu(),1),dpe=ge(FE(),1),gpe=ge(tS(),1);h();h();var VP=ge(iS(),1);h();h();var G0="elvenjs_state",FP="https://devnet-api.multiversx.com";var Do="/dapp/init",j0="devnet",UP="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",qP=["wss://relay.walletconnect.com"],Br={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var ye={get(t){let e=localStorage.getItem(G0);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(G0,JSON.stringify(r))},clear(){localStorage.removeItem(G0)}};var z0=async()=>{let t=VP.ExtensionProvider.getInstance();try{let e=await t.init(),r=ye.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var h3=ge(iS(),1),d3=ge(ld(),1),g3=ge(Ol(),1),Sk=ge(bC(),1),xd=ge(H0(),1);h();var w9=ge(ld(),1);h();h();var pe=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};h();var y9=(U=>(U.onLoginStart="onLoginStart",U.onLoginSuccess="onLoginSuccess",U.onLoginFailure="onLoginFailure",U.onLogoutStart="onLogoutStart",U.onLogoutSuccess="onLogoutSuccess",U.onLogoutFailure="onLogoutFailure",U.onQrPending="onQrPending",U.onQrLoaded="onQrLoaded",U.onTxStart="onTxStart",U.onTxSent="onTxSent",U.onTxFinalized="onTxFinalized",U.onTxFailure="onTxFailure",U.onSignMsgStart="onSignMsgStart",U.onSignMsgFinalized="onSignMsgFinalized",U.onSignMsgFailure="onSignMsgFailure",U.onQueryStart="onQueryStart",U.onQueryFinalized="onQueryFinalized",U.onQueryFailure="onQueryFailure",U))(y9||{}),SC=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(SC||{}),Pde=(r=>(r.mvx_cancelAction="mvx_cancelAction",r.mvx_signNativeAuthToken="mvx_signNativeAuthToken",r))(Pde||{}),Rde=(e=>(e.hasWebWalletGuardianSign="hasWebWalletGuardianSign",e))(Rde||{});h();var Kt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Ll=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");pe.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(ye.clear(),pe.run("onLogoutSuccess")),e}catch(e){let r=Kt(e);console.warn(`Something went wrong trying to logout the user: ${r}`),pe.run("onLogoutFailure",r)}};h();function M1(t){return t[Math.floor(Math.random()*t.length)]}var v9=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{},onClientLogout:()=>Ll(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=M1(t.initOptions.walletConnectV2RelayAddresses),n=new w9.WalletConnectV2Provider(e,Br[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};h();var H1=ge(ke(),1),O9=ge(A9(),1),D9=ge(b9(),1),P9=ge(DC(),1),R9=ge(N9(),1),B9=ge(tS(),1),M9=ge(x9(),1),L9=ge(Wf(),1);var G1=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||j0,this.apiUrl=e||Br[this.chainType]?.apiAddress,this.apiTimeout=n||Br[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),u=await o.json();if(!o.ok){let a=u?.error||o.status;return clearTimeout(i),Promise.reject(a)}return clearTimeout(i),u}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let u=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),a=await u.json();if(!u.ok){let c=a?.error||u.status;return clearTimeout(s),Promise.reject(c)}return clearTimeout(s),a}catch(u){this.handleApiError(u,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new H1.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new O9.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new H1.Address(r.sender),receiver:new H1.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:p.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:D9.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:P9.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:R9.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new L9.Query({address:e,func:r,args:n,value:i,caller:s}),u=new M9.ContractQueryRequest(o).toHttpRequest(),a=await this.apiPost("query",u);return B9.ContractQueryResponse.fromHttpResponse(a)}catch(o){this.handleApiError(o,"query")}}};h();h();var Vl=()=>new Date().setHours(new Date().getHours()+24),j1=t=>Date.now()>t;h();var F9=ge(ke(),1),U9=ge(Sc(),1);var vu=async t=>{let e=ye.get("address"),r=ye.get("expires");if(!(r&&j1(r))&&e&&t.networkProvider){let i=new F9.Address(e),s=new U9.Account(i);try{let o=await t.networkProvider.getAccount(i),u=await t.networkProvider.getGuardianData(i);ye.set("address",e),ye.set("activeGuardian",u.guarded&&u.activeGuardian?.address?u.activeGuardian.address:""),ye.set("nonce",o.nonce.valueOf()),ye.set("balance",o.balance.toString()),s.update(o)}catch(o){let u=Kt(o);console.warn(`Something went wrong trying to synchronize the user account: ${u}`)}}};var q9=async(t,e,r,n="/")=>{let i=await z0(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i&&!await i.login(o))throw new Error("There were problems while logging in!")}catch(a){let c=Kt(a);throw new Error(c)}if(!i)throw new Error("There were problems with auth provider initialization!");let{signature:u}=i.account;if(ye.set("loginToken",e),u&&ye.set("signature",u),t.networkProvider&&u)try{let a=await i.getAddress();if(!a)throw new Error("Canceled!");ye.set("address",a),ye.set("loginMethod","browser-extension"),ye.set("expires",Vl()),await vu(t);let c=r.getToken(a,e,u);return ye.set("accessToken",c),pe.run("onLoginSuccess"),i}catch(a){throw new Error(`Something went wrong trying to synchronize the user account: ${a?.message}`)}};h();h();var HV=ge(kV(),1),GV=ge(ld(),1);var Oge=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Dge=t=>{let e=`${UP}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},Pge=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Rge=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},n3={},Bge=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",n3[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:n3[t.topic].signal}),r},rw={},Mge=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=Bge(t,e);return n.appendChild(s),rw[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:rw[t.topic].signal}),n},Lge=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},Fge=t=>{if(!t)return;document.getElementById(t)?.remove()},Uge=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),qge=async t=>t?await HV.default.toString(t,{type:"svg"}):void 0,jV=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await qge(e),o;if(s&&(o=Oge(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),Uge()&&i.appendChild(Dge(e))),i&&r instanceof GV.WalletConnectV2Provider){let u=r.pairings,a=async f=>{try{f&&(await r.logout({topic:f}),Fge(f))}catch(d){let w=Kt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${w}`)}finally{rw[f].abort()}},c=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(Lge()),await r.login({approval:d,token:n})}catch(d){let w=Kt(d);console.warn(`Something went wrong trying to login the user: ${w}`)}finally{for(let d of Object.values(rw))d?.abort();for(let d of Object.values(n3))d?.abort()}};if(u&&u.length>0){let f=Pge();i.appendChild(f);let d=Rge();f.appendChild(d);for(let w of u){let A=Mge(w,a,c);f.appendChild(A)}}}return i};var nw=ge(ld(),1);var zV=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=M1(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof nw.WalletConnectV2Provider){let a=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();ye.set("address",a),ye.set("loginMethod","mobile"),ye.set("expires",Vl()),await vu(t),c&&ye.set("signature",c),ye.set("loginToken",e);let f=r.getToken(a,e,c);ye.set("accessToken",f),pe.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof nw.WalletConnectV2Provider&&await Ll(t)},onClientEvent:a=>{console.log("wc2 session event: ",a)}},u=new nw.WalletConnectV2Provider(o,Br[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(u){t.dappProvider=u,pe.run("onQrPending"),await u.init();let{uri:a,approval:c}=await u.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${a}&token=${e}`:a;return n&&f&&(s=await jV(n,f,u,e),pe.run("onQrLoaded")),await u.login({approval:c,token:e}),u}}catch(a){let c=Kt(a);console.warn(`Something went wrong trying to login the user: ${c}`),pe.run("onLoginFailure",c)}};h();var QV=ge(Ol(),1);var i3=async(t,e,r,n)=>{let i=new QV.WalletProvider(`${t}${Do}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return ye.set("loginMethod",Br[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),ye.set("expires",Vl()),ye.set("loginToken",e),i}catch(u){let a=Kt(u);console.warn(`Something went wrong trying to login the user: ${a}`),ye.set("loginMethod",""),pe.run("onLoginFailure",a)}};h();var fn=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};h();var KV=ge(Ol(),1);var WV=ge(bC(),1),s3=async(t,e)=>{let r=fn("signature"),n=fn("address"),i=ye.get("address"),s=ye.get("loginToken");if(r&&ye.set("signature",r),n||i){n&&(ye.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new KV.WalletProvider(`${t}${Do}`);if(r&&e&&n){let a=new WV.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);ye.set("accessToken",a)}return o}};h();var $V=ge(Sc(),1),YV=ge(V0(),1);var iw=async(t,e)=>{pe.run("onTxSent",t);let n=await new YV.TransactionWatcher(e).awaitCompleted(t),i=n.sender,s=new $V.Account(i),o=await e.getAccount(i);s.update(o),ye.set("address",s.address.bech32()),ye.set("balance",s.balance.toString()),pe.run("onTxFinalized",n)};h();var Ql=ge(XV(),1),ek=ge(en(),1);h();var ZV=ge(Sc(),1);var sw=t=>{let e=t.getSender(),r=new ZV.Account(e),n=t.nonce.valueOf();r.incrementNonce(),ye.set("nonce",(n+1n).toString())};var tk=async(t,e,r,n)=>{if(fn(Ql.WALLET_PROVIDER_CALLBACK_PARAM)===Ql.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=ye.get("activeGuardian"),o=ye.get("loginMethod"),u=fn("hasWebWalletGuardianSign"),a;if("getTransactionsFromWalletUrl"in t){if(a=t.getTransactionsFromWalletUrl()?.[0],!a)return;o==="web-wallet"&&(a.data=p.Buffer.from(a.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&u&&(a=new Ql.WalletProvider(`${r}${Do}`).getTransactionsFromWalletUrl()?.[0]);if(a){let c=ek.Transaction.fromPlainObject(a);c.nonce=BigInt(n),sw(c);try{pe.run("onTxStart",c),await e.sendTransaction(c),await iw(c,e)}catch(f){let w=`Getting transaction information failed! ${Kt(f)}`;throw pe.run("onTxFailure",c,w),new Error(w)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};h();var ow=ge(Jl(),1),rk=ge(ke(),1),nk=ge(Ol(),1);var ik=t=>{let e=ye.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(ow.TransactionVersion.withTxOptions()),t.setOptions(ow.TransactionOptions.withOptions(r)),t.setGuardian(rk.Address.fromBech32(e))}return t},sk=async(t,e)=>{let r=new nk.WalletProvider(`${e}${Do}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},ok=t=>{let e=ye.get("activeGuardian");return!(!ye.get("address")||!e||t.isGuardedTransaction())};h();var ak=()=>{let t=!fn("walletProviderStatus"),e=fn("status")==="signed",r=fn("message"),n=fn("signature");t&&e&&r&&n&&(pe.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};var mw=ge(f3(),1);h();h();h();function ipe(t){try{let e=atob(t),r=btoa(e),n=p.Buffer.from(t,"base64").toString(),i=p.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Yl(t){return ipe(t)?atob(t):t}h();var gw=t=>Object.prototype.toString.call(t)==="[object String]";h();var wk=t=>{if(!t||!gw(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Yl(s)),u=Yl(r);return{ttl:Number(i),extraInfo:o,origin:u,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var vk=t=>{if(!t||!gw(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Yl(r),o=Yl(n),u=wk(o);if(!u)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let a={...u,address:s,body:o,signature:i};return u.extraInfo?.timestamp||delete a.extraInfo,a}catch{return null}};var Ak=ge(f3(),1);function Ek(t,e){let r=vk(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(ye.set("loginToken",s),ye.set("accessToken",t),ye.set("signature",n),ye.set("address",i),ye.set("loginMethod","x-portal-hub"),e.dappProvider=new Ak.WebviewProvider)}h();var bk=t=>{t.onLoginStart&&pe.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&pe.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&pe.set("onLoginFailure",t.onLoginFailure),t.onLogoutStart&&pe.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&pe.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&pe.set("onLogoutFailure",t.onLogoutFailure),t.onQrPending&&pe.set("onQrPending",t.onQrPending),t.onQrLoaded&&pe.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&pe.set("onTxStart",t.onTxStart),t.onTxSent&&pe.set("onTxSent",t.onTxSent),t.onTxFinalized&&pe.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&pe.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&pe.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&pe.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&pe.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&pe.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&pe.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&pe.set("onQueryFailure",t.onQueryFailure)};h();var pw=async t=>{pe.run("onLoginStart");try{await t(()=>{pe.run("onLoginSuccess")})}catch(e){let r=Kt(e);console.warn(`Something went wrong trying to login the user: ${r}`),pe.run("onLoginFailure",r)}};var p3=class{static async init(e){let r=ye.get();if(r.expires&&j1(r.expires)){ye.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:j0,apiUrl:FP,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:qP,...e},this.networkProvider=new G1(this.initOptions),bk(this.initOptions);let n=fn("accessToken");n&&await pw(async s=>{Ek(n,this),await vu(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&fn("address"))&&r?.loginMethod&&(await pw(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await z0()),r.loginMethod==="mobile"&&(this.dappProvider=await v9(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new mw.WebviewProvider),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await s3(Br[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await s3(Br[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await vu(this),s()}),this.initOptions?.chainType&&(await tk(this.dappProvider,this.networkProvider,Br[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),ak()))}static async login(e,r){if(!Object.values(SC).includes(e)){let i="Wrong login method!";throw pe.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw pe.run("onLoginFailure",i),new Error(i)}await pw(async()=>{let i=new Sk.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await q9(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await zV(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await i3(Br[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await i3(Br[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}})}static async logout(){try{let e=await Ll(this);return this.dappProvider=void 0,e}catch(e){let r=Kt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw pe.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw pe.run("onTxFailure",e,n),new Error(n)}let r=ik(e);try{pe.run("onTxStart",e);let n=ye.get();if(e.nonce=n.nonce,this.dappProvider instanceof h3.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof d3.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof mw.WebviewProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof g3.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=ok(r);if(i||sw(r),i&&this.initOptions?.chainType){await sk(r,Br[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await iw(r,this.networkProvider)}}catch(n){let i=Kt(n);throw pe.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw pe.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw pe.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(pe.run("onSignMsgStart",e),this.dappProvider instanceof h3.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof d3.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof mw.WebviewProvider&&(n=(await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)})))?.getSignature().toString("hex")||""),this.dappProvider instanceof g3.WalletProvider){let s=u=>encodeURIComponent(u).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),o=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new xd.SignableMessage({message:p.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${o}${o.includes("?")?"&":"?"}message=${s(e)}`)})}let i=ye.get();return i.loginMethod!=="web-wallet"&&i.loginMethod!=="x-alias"&&pe.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Kt(i);throw pe.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{pe.run("onQueryStart",o);let u=await this.networkProvider.queryContract(o);return pe.run("onQueryFinalized",u),u}catch(u){let a=Kt(u);throw pe.run("onQueryFinalized",o,a),new Error(`Smart contract query failed! ${a}`)}}static{this.storage=ye}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,pe.clear()}}};h();nr();Nu.config({ROUNDING_MODE:Nu.ROUND_FLOOR});var spe=({amount:t,decimals:e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return BigInt(new Nu(t).shiftedBy(e).toFixed())},ope=({amount:t,decimals:e,rounding:r=e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return new Nu(t).shiftedBy(-e).decimalPlaces(r).toFixed()};var export_Account=upe.Account;var export_Address=ape.Address;var export_AddressType=Ck.AddressType;var export_AddressValue=Ck.AddressValue;var export_BigUIntType=_s.BigUIntType;var export_BigUIntValue=_s.BigUIntValue;var export_BooleanType=Tk.BooleanType;var export_BooleanValue=Tk.BooleanValue;var export_BytesType=_k.BytesType;var export_BytesValue=_k.BytesValue;var export_ContractQueryResponse=gpe.ContractQueryResponse;var export_Message=Ik.Message;var export_MessageComputer=Ik.MessageComputer;var export_QueryArguments=dpe.QueryArguments;var export_SignableMessage=hpe.SignableMessage;var export_SmartContractTransactionsFactory=yw.SmartContractTransactionsFactory;var export_SmartContractTransactionsOutcomeParser=w3.SmartContractTransactionsOutcomeParser;var export_Token=m3.Token;var export_TokenComputer=m3.TokenComputer;var export_TokenManagementTransactionsFactory=yw.TokenManagementTransactionsFactory;var export_TokenManagementTransactionsOutcomeParser=w3.TokenManagementTransactionsOutcomeParser;var export_TokenOperationsFactory=y3.TokenOperationsFactory;var export_TokenOperationsFactoryConfig=y3.TokenOperationsFactoryConfig;var export_TokenOperationsOutcomeParser=y3.TokenOperationsOutcomeParser;var export_TokenTransfer=m3.TokenTransfer;var export_Transaction=cpe.Transaction;var export_TransactionComputer=lpe.TransactionComputer;var export_TransactionEventsParser=w3.TransactionEventsParser;var export_TransactionWatcher=fpe.TransactionWatcher;var export_TransactionsFactoryConfig=yw.TransactionsFactoryConfig;var export_TransferTransactionsFactory=yw.TransferTransactionsFactory;var export_U16Type=_s.U16Type;var export_U16Value=_s.U16Value;var export_U32Type=_s.U32Type;var export_U32Value=_s.U32Value;var export_U64Type=_s.U64Type;var export_U64Value=_s.U64Value;var export_U8Type=_s.U8Type;var export_U8Value=_s.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractQueryResponse as ContractQueryResponse,Pde as DappCoreWCV2CustomMethodsEnum,p3 as ElvenJS,y9 as EventStoreEvents,SC as LoginMethodsEnum,export_Message as Message,export_MessageComputer as MessageComputer,export_QueryArguments as QueryArguments,export_SignableMessage as SignableMessage,export_SmartContractTransactionsFactory as SmartContractTransactionsFactory,export_SmartContractTransactionsOutcomeParser as SmartContractTransactionsOutcomeParser,export_Token as Token,export_TokenComputer as TokenComputer,export_TokenManagementTransactionsFactory as TokenManagementTransactionsFactory,export_TokenManagementTransactionsOutcomeParser as TokenManagementTransactionsOutcomeParser,export_TokenOperationsFactory as TokenOperationsFactory,export_TokenOperationsFactoryConfig as TokenOperationsFactoryConfig,export_TokenOperationsOutcomeParser as TokenOperationsOutcomeParser,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionComputer as TransactionComputer,export_TransactionEventsParser as TransactionEventsParser,export_TransactionWatcher as TransactionWatcher,export_TransactionsFactoryConfig as TransactionsFactoryConfig,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value,Rde as WebWalletUrlParamsEnum,ope as formatAmount,spe as parseAmount}; +`);let o=g2e(e,r,i),c=Qw.getSymbolSize(e),a=new i2e(c);return l2e(a,e),f2e(a),d2e(a,e),Q5(a,r,0),e>=7&&h2e(a,e),p2e(a,o),isNaN(n)&&(n=K5.getBestMask(a,Q5.bind(null,a,r))),K5.applyMask(n,a),Q5(a,r,n),{modules:a,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}HQ.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=z5.M,i,s;return typeof r<"u"&&(n=z5.from(r.errorCorrectionLevel,z5.M),i=jw.from(r.version),s=K5.from(r.maskPattern),r.toSJISFunc&&Qw.setToSJISFunction(r.toSJISFunc)),y2e(e,i,n,s)}});var $5=L(Lu=>{h();function zQ(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}Lu.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:zQ(e.color.dark||"#000000ff"),light:zQ(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Lu.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Lu.getImageWidth=function(e,r){let n=Lu.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Lu.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Lu.getScale(i,n),c=Math.floor((i+n.margin*2)*o),a=n.margin*o,u=[n.color.light,n.color.dark];for(let f=0;f=a&&p>=a&&f{h();var Y5=$5();function v2e(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function b2e(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Kw.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=b2e()),i=Y5.getOptions(i);let o=Y5.getImageWidth(e.modules.size,i),c=s.getContext("2d"),a=c.createImageData(o,o);return Y5.qrToImageData(a.data,e,i),v2e(c,s,o),c.putImageData(a,0,0),s};Kw.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Kw.render(e,r,i),o=i.type||"image/png",c=i.rendererOpts||{};return s.toDataURL(o,c.quality)}});var WQ=L(KQ=>{h();var w2e=$5();function QQ(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function J5(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function A2e(t,e,r){let n="",i=0,s=!1,o=0;for(let c=0;c0&&a>0&&t[c-1]||(n+=s?J5("M",a+r,.5+u+r):J5("m",i,0),i=0,s=!1),a+1':"",u="',f='viewBox="0 0 '+c+" "+c+'"',S=''+a+u+` +`;return typeof n=="function"&&n(null,S),S}});var YQ=L(xp=>{h();var E2e=Xj(),X5=GQ(),$Q=jQ(),S2e=WQ();function Z5(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,c=typeof s[o-1]=="function";if(!c&&!E2e())throw new Error("Callback required as last argument");if(c){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(a,u){try{let f=X5.create(r,n);a(t(f,e,n))}catch(f){u(f)}})}try{let a=X5.create(r,n);i(null,t(a,e,n))}catch(a){i(a)}}xp.create=X5.create;xp.toCanvas=Z5.bind(null,$Q.render);xp.toDataURL=Z5.bind(null,$Q.renderToDataURL);xp.toString=Z5.bind(null,function(t,e,r){return S2e.render(t,r)})});var aK=L(hc=>{"use strict";h();var D2e=hc&&hc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oK=hc&&hc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&D2e(e,t,r)};Object.defineProperty(hc,"__esModule",{value:!0});oK(Cd(),hc);oK(w5(),hc)});var yK=L(Zw=>{"use strict";h();Object.defineProperty(Zw,"__esModule",{value:!0});Zw.isWindowAvailable=void 0;var B2e=()=>typeof window<"u"&&typeof window?.location<"u";Zw.isWindowAvailable=B2e});var nC=L(eA=>{"use strict";h();Object.defineProperty(eA,"__esModule",{value:!0});eA.getTargetOrigin=void 0;var L2e=yK(),F2e=()=>{var t;if((0,L2e.isWindowAvailable)()){let e=window.location.ancestorOrigins;return(t=e?.[e.length-1])!==null&&t!==void 0?t:"*"}return"*"};eA.getTargetOrigin=F2e});var rA=L(tA=>{"use strict";h();Object.defineProperty(tA,"__esModule",{value:!0});tA.getSafeWindow=void 0;var q2e=()=>typeof window<"u"?window:{};tA.getSafeWindow=q2e});var vK=L(nA=>{"use strict";h();Object.defineProperty(nA,"__esModule",{value:!0});nA.isMobileWebview=void 0;var U2e=rA(),k2e=()=>{let t=(0,U2e.getSafeWindow)();return t.ReactNativeWebView||t.webkit};nA.isMobileWebview=k2e});var iC=L(iA=>{"use strict";h();Object.defineProperty(iA,"__esModule",{value:!0});iA.getSafeDocument=void 0;var V2e=()=>typeof document<"u"?document:{};iA.getSafeDocument=V2e});var sC=L(pc=>{"use strict";h();Object.defineProperty(pc,"__esModule",{value:!0});pc.WindowProviderResponseEnums=pc.WindowProviderRequestEnums=void 0;var H2e;(function(t){t.signTransactionsRequest="SIGN_TRANSACTIONS_REQUEST",t.guardTransactionsRequest="GUARD_TRANSACTIONS_REQUEST",t.signMessageRequest="SIGN_MESSAGE_REQUEST",t.loginRequest="LOGIN_REQUEST",t.logoutRequest="LOGOUT_REQUEST",t.cancelAction="CANCEL_ACTION_REQUEST",t.finalizeHandshakeRequest="FINALIZE_HANDSHAKE_REQUEST",t.finalizeResetStateRequest="FINALIZE_RESET_STATE_REQUEST"})(H2e=pc.WindowProviderRequestEnums||(pc.WindowProviderRequestEnums={}));var G2e;(function(t){t.handshakeResponse="HANDSHAKE_RESPONSE",t.guardTransactionsResponse="GUARD_TRANSACTIONS_RESPONSE",t.loginResponse="LOGIN_RESPONSE",t.disconnectResponse="DISCONNECT_RESPONSE",t.cancelResponse="CANCEL_RESPONSE",t.signTransactionsResponse="SIGN_TRANSACTIONS_RESPONSE",t.signMessageResponse="SIGN_MESSAGE_RESPONSE",t.noneResponse="NONE_RESPONSE",t.resetStateResponse="RESET_STATE_RESPONSE"})(G2e=pc.WindowProviderResponseEnums||(pc.WindowProviderResponseEnums={}))});var wK=L(Fd=>{"use strict";h();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.webviewProviderEventHandler=void 0;var z2e=nC(),bK=vK(),j2e=rA(),Q2e=iC(),K2e=sC(),W2e=(t,e)=>r=>{var n,i,s,o;let c=r.data;try{c=(0,bK.isMobileWebview)()&&typeof c=="string"?JSON.parse(c):c}catch{console.error("error parsing eventData",c)}let{type:a,payload:u}=c;!(0,bK.isMobileWebview)()&&r.origin!=(0,z2e.getTargetOrigin)()||!(t===a||a===K2e.WindowProviderResponseEnums.cancelResponse)||((i=(n=(0,j2e.getSafeWindow)()).removeEventListener)===null||i===void 0||i.call(n,"message",(0,Fd.webviewProviderEventHandler)(t,e)),(o=(s=(0,Q2e.getSafeDocument)()).removeEventListener)===null||o===void 0||o.call(s,"message",(0,Fd.webviewProviderEventHandler)(t,e)),e({type:a,payload:u}))};Fd.webviewProviderEventHandler=W2e});var AK=L(Np=>{"use strict";h();Object.defineProperty(Np,"__esModule",{value:!0});Np.SignMessageStatusEnum=void 0;var $2e;(function(t){t.pending="pending",t.failed="failed",t.signed="signed",t.cancelled="cancelled"})($2e=Np.SignMessageStatusEnum||(Np.SignMessageStatusEnum={}))});var oC=L(gc=>{"use strict";h();var Y2e=gc&&gc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EK=gc&&gc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Y2e(e,t,r)};Object.defineProperty(gc,"__esModule",{value:!0});EK(sC(),gc);EK(AK(),gc)});var SK=L(sA=>{"use strict";h();Object.defineProperty(sA,"__esModule",{value:!0});sA.responseTypeMap=void 0;var bn=oC();sA.responseTypeMap={[bn.WindowProviderRequestEnums.signTransactionsRequest]:bn.WindowProviderResponseEnums.signTransactionsResponse,[bn.WindowProviderRequestEnums.guardTransactionsRequest]:bn.WindowProviderResponseEnums.guardTransactionsResponse,[bn.WindowProviderRequestEnums.signMessageRequest]:bn.WindowProviderResponseEnums.signMessageResponse,[bn.WindowProviderRequestEnums.loginRequest]:bn.WindowProviderResponseEnums.loginResponse,[bn.WindowProviderRequestEnums.logoutRequest]:bn.WindowProviderResponseEnums.disconnectResponse,[bn.WindowProviderRequestEnums.cancelAction]:bn.WindowProviderResponseEnums.cancelResponse,[bn.WindowProviderRequestEnums.finalizeHandshakeRequest]:bn.WindowProviderResponseEnums.noneResponse,[bn.WindowProviderRequestEnums.finalizeResetStateRequest]:bn.WindowProviderResponseEnums.resetStateResponse}});var TK=L(qd=>{"use strict";h();var vs=qd&&qd.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(f){try{u(n.next(f))}catch(p){o(p)}}function a(f){try{u(n.throw(f))}catch(p){o(p)}}function u(f){f.done?s(f.value):i(f.value).then(c,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(qd,"__esModule",{value:!0});qd.WebviewProvider=void 0;var J2e=Dn(),aC=wK(),In=oC(),X2e=SK(),_K=nC(),cC=rA(),Z2e=iC(),eEe=$c(),tEe=$c(),uC=class t{static getInstance(e){return t._instance||(t._instance=new t(e)),t._instance}constructor(e){this.initialized=!1,this.account={address:""},this.resetState=r=>{var n,i;(i=(n=(0,cC.getSafeWindow)()).addEventListener)===null||i===void 0||i.call(n,"message",(0,aC.webviewProviderEventHandler)(In.WindowProviderResponseEnums.resetStateResponse,s=>{s.type===In.WindowProviderResponseEnums.resetStateResponse&&(r?.(),setTimeout(()=>{this.finalizeResetState()},500))}))},this.init=()=>vs(this,void 0,void 0,function*(){return yield this.sendPostMessage({type:In.WindowProviderRequestEnums.finalizeHandshakeRequest,payload:void 0}),this.initialized=!0,this.initialized}),this.login=()=>vs(this,void 0,void 0,function*(){var r;if(!this.initialized)throw new Error("Provider not initialized");let n=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.loginRequest,payload:void 0});return n.type==In.WindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the login action"),yield this.cancelAction(),null):n.payload.data?(this.account=n.payload.data,this.account):(console.error("Error logging in",(r=n.payload.error)!==null&&r!==void 0?r:"No data received"),null)}),this.logout=()=>vs(this,void 0,void 0,function*(){let r=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.logoutRequest,payload:void 0});return this.initialized=!1,this.disconnect(),!!r.payload.data}),this.relogin=()=>vs(this,void 0,void 0,function*(){var r;let n=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.loginRequest,payload:void 0});if(n.type==In.WindowProviderResponseEnums.cancelResponse)return console.warn("Cancelled the re-login action"),yield this.cancelAction(),null;if(!n.payload.data)return console.error("Re-login Error",(r=n.payload.error)!==null&&r!==void 0?r:"No data received"),null;let{data:i,error:s}=n.payload;if(s||!i)throw new Error("Unable to re-login");let{accessToken:o}=i;return o?(this.account=i,o):(console.error("Unable to re-login. Missing accessToken."),null)}),this.signTransactions=r=>vs(this,void 0,void 0,function*(){let n=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.signTransactionsRequest,payload:r.map(o=>o.toPlainObject())}),{data:i,error:s}=n.payload;return s||!i?(console.error("Unable to sign transactions"),null):n.type==In.WindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the transactions signing action"),this.cancelAction(),null):i.map(o=>J2e.Transaction.fromPlainObject(o))}),this.signTransaction=r=>vs(this,void 0,void 0,function*(){let n=yield this.signTransactions([r]);return n?.[0]}),this.signMessage=r=>vs(this,void 0,void 0,function*(){var n;let i=yield this.sendPostMessage({type:In.WindowProviderRequestEnums.signMessageRequest,payload:{message:b.Buffer.from(r.data).toString()}}),{data:s,error:o}=i.payload;return o||!s?(console.error("Unable to sign message"),null):i.type==In.WindowProviderResponseEnums.cancelResponse?(console.warn("Cancelled the message signing action"),this.cancelAction(),null):s.status!==In.SignMessageStatusEnum.signed?(console.error("Could not sign message"),null):new eEe.Message({data:b.Buffer.from(r.data),address:(n=r.address)!==null&&n!==void 0?n:tEe.Address.fromBech32(this.account.address),signer:"webview",version:r.version,signature:b.Buffer.from(String(s.signature),"hex")})}),this.cancelAction=()=>vs(this,void 0,void 0,function*(){return this.sendPostMessage({type:In.WindowProviderRequestEnums.cancelAction,payload:void 0})}),this.finalizeResetState=()=>vs(this,void 0,void 0,function*(){return this.sendPostMessage({type:In.WindowProviderRequestEnums.finalizeResetStateRequest,payload:void 0})}),this.sendPostMessage=r=>vs(this,void 0,void 0,function*(){var n,i;let s=(0,cC.getSafeWindow)();return s.ReactNativeWebView?s.ReactNativeWebView.postMessage(JSON.stringify(r)):s.webkit?(i=(n=s.webkit.messageHandlers)===null||n===void 0?void 0:n.jsHandler)===null||i===void 0||i.postMessage(JSON.stringify(r),(0,_K.getTargetOrigin)()):s.parent&&s.parent.postMessage(r,(0,_K.getTargetOrigin)()),yield this.waitingForResponse(X2e.responseTypeMap[r.type])}),this.waitingForResponse=r=>vs(this,void 0,void 0,function*(){return yield new Promise(n=>{var i,s,o,c;(s=(i=(0,cC.getSafeWindow)()).addEventListener)===null||s===void 0||s.call(i,"message",(0,aC.webviewProviderEventHandler)(r,n)),(c=(o=(0,Z2e.getSafeDocument)()).addEventListener)===null||c===void 0||c.call(o,"message",(0,aC.webviewProviderEventHandler)(r,n))})}),e?.resetStateCallback&&this.resetState(e.resetStateCallback)}disconnect(){this.account={address:""}}isInitialized(){return this.initialized}isConnected(){return!!this.account.address}getAccount(){return this.account}setAccount(e){this.account=e}};qd.WebviewProvider=uC});var lC=L(Fu=>{"use strict";h();var rEe=Fu&&Fu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nEe=Fu&&Fu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rEe(e,t,r)};Object.defineProperty(Fu,"__esModule",{value:!0});nEe(TK(),Fu)});h();var gC=ge(Sc(),1),mC=ge(N_(),1),uA=ge(v1(),1),yC=ge(D_(),1),aEe=ge(Nt(),1),cEe=ge(Hl(),1),uEe=ge(Dn(),1),lEe=ge(B1(),1),RK=ge(Q1(),1),fEe=ge(W1(),1),MK=ge(fa(),1),vo=ge(Ch(),1),DK=ge(oh(),1),BK=ge(al(),1),dEe=ge(NS(),1),hEe=ge(jl(),1);h();h();var TD=ge(i6(),1);h();h();var By="elvenjs_state",ED="https://devnet-api.multiversx.com";var Pa="/dapp/init",Ly="devnet",SD="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",_D=["wss://relay.walletconnect.com"],dn={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var be={get(t){let e=localStorage.getItem(By);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(By,JSON.stringify(r))},clear(){localStorage.removeItem(By)}};var Fy=async()=>{let t=TD.ExtensionProvider.getInstance();try{let e=await t.init(),r=be.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var fC=ge(i6(),1),dC=ge(gp(),1),hC=ge(Cd(),1),PK=ge(N5(),1),Op=ge(Q1(),1);h();var Uj=ge(gp(),1);h();h();var ye=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};h();var qj=(k=>(k.onLoginStart="onLoginStart",k.onLoginSuccess="onLoginSuccess",k.onLoginFailure="onLoginFailure",k.onLogoutStart="onLogoutStart",k.onLogoutSuccess="onLogoutSuccess",k.onLogoutFailure="onLogoutFailure",k.onQrPending="onQrPending",k.onQrLoaded="onQrLoaded",k.onTxStart="onTxStart",k.onTxSent="onTxSent",k.onTxFinalized="onTxFinalized",k.onTxFailure="onTxFailure",k.onSignMsgStart="onSignMsgStart",k.onSignMsgFinalized="onSignMsgFinalized",k.onSignMsgFailure="onSignMsgFailure",k.onQueryStart="onQueryStart",k.onQueryFinalized="onQueryFinalized",k.onQueryFailure="onQueryFailure",k))(qj||{}),O5=(o=>(o.ledger="ledger",o.mobile="mobile",o.webWallet="web-wallet",o.browserExtension="browser-extension",o.xAlias="x-alias",o.xPortalHub="x-portal-hub",o))(O5||{}),NAe=(r=>(r.mvx_cancelAction="mvx_cancelAction",r.mvx_signNativeAuthToken="mvx_signNativeAuthToken",r))(NAe||{}),OAe=(e=>(e.hasWebWalletGuardianSign="hasWebWalletGuardianSign",e))(OAe||{});h();var wr=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:JSON.stringify(t);var Nd=async t=>{if(!t.dappProvider)throw new Error("Logout failed: There is no active session!");ye.run("onLogoutStart");try{let e=await t.dappProvider.logout();return e&&(be.clear(),ye.run("onLogoutSuccess")),e}catch(e){let r=wr(e);console.warn(`Something went wrong trying to logout the user: ${r}`),ye.run("onLogoutFailure",r)}};h();function Mw(t){return t[Math.floor(Math.random()*t.length)]}var kj=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{},onClientLogout:()=>Nd(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Mw(t.initOptions.walletConnectV2RelayAddresses),n=new Uj.WalletConnectV2Provider(e,dn[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};h();var Dw=ge(Nt(),1),Vj=ge(sf(),1),Hj=ge(xy(),1),Gj=ge(t0(),1),zj=ge(Iy(),1),jj=ge(jl(),1),Qj=ge(gy(),1),Kj=ge(Uh(),1);var Bw=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Ly,this.apiUrl=e||dn[this.chainType]?.apiAddress,this.apiTimeout=n||dn[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),c=await o.json();if(!o.ok){let a=c?.error||o.status;return clearTimeout(i),Promise.reject(a)}return clearTimeout(i),c}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let c=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),a=await c.json();if(!c.ok){let u=a?.error||c.status;return clearTimeout(s),Promise.reject(u)}return clearTimeout(s),a}catch(c){this.handleApiError(c,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new Dw.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:BigInt(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new Vj.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new Dw.Address(r.sender),receiver:new Dw.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:b.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:Hj.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:Gj.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:zj.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new Kj.Query({address:e,func:r,args:n,value:i,caller:s}),c=new Qj.ContractQueryRequest(o).toHttpRequest(),a=await this.apiPost("query",c);return jj.ContractQueryResponse.fromHttpResponse(a)}catch(o){this.handleApiError(o,"query")}}};h();h();var Od=()=>new Date().setHours(new Date().getHours()+24),Lw=t=>Date.now()>t;h();var Wj=ge(Nt(),1),$j=ge(Hl(),1);var Ru=async t=>{let e=be.get("address"),r=be.get("expires");if(!(r&&Lw(r))&&e&&t.networkProvider){let i=new Wj.Address(e),s=new $j.Account(i);try{let o=await t.networkProvider.getAccount(i),c=await t.networkProvider.getGuardianData(i);be.set("address",e),be.set("activeGuardian",c.guarded&&c.activeGuardian?.address?c.activeGuardian.address:""),be.set("nonce",o.nonce.valueOf()),be.set("balance",o.balance.toString()),s.update(o)}catch(o){let c=wr(o);console.warn(`Something went wrong trying to synchronize the user account: ${c}`)}}};var Yj=async(t,e,r,n="/")=>{let i=await Fy(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{if(i&&!await i.login(o))throw new Error("There were problems while logging in!")}catch(u){let f=wr(u);throw new Error(f)}if(!i)throw new Error("There were problems with auth provider initialization!");let c=i.getAccount();be.set("loginToken",e);let a=c?.signature;if(a&&be.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");be.set("address",u),be.set("loginMethod","browser-extension"),be.set("expires",Od()),await Ru(t);let f=r.getToken(u,e,a);return be.set("accessToken",f),ye.run("onLoginSuccess"),i}catch(u){throw new Error(`Something went wrong trying to synchronize the user account: ${u?.message}`)}};h();h();var JQ=ge(YQ(),1),XQ=ge(gp(),1);var _2e=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},T2e=t=>{let e=`${SD}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},I2e=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},C2e=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},eC={},x2e=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",eC[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:eC[t.topic].signal}),r},Ww={},N2e=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=x2e(t,e);return n.appendChild(s),Ww[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ww[t.topic].signal}),n},O2e=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},P2e=t=>{if(!t)return;document.getElementById(t)?.remove()},R2e=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),M2e=async t=>t?await JQ.default.toString(t,{type:"svg"}):void 0,ZQ=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await M2e(e),o;if(s&&(o=_2e(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),R2e()&&i.appendChild(T2e(e))),i&&r instanceof XQ.WalletConnectV2Provider){let c=r.pairings,a=async f=>{try{f&&(await r.logout({topic:f}),P2e(f))}catch(p){let S=wr(p);console.warn(`Something went wrong trying to remove the existing pairing: ${S}`)}finally{Ww[f].abort()}},u=async f=>{try{let{approval:p}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(O2e()),await r.login({approval:p,token:n})}catch(p){let S=wr(p);console.warn(`Something went wrong trying to login the user: ${S}`)}finally{for(let p of Object.values(Ww))p?.abort();for(let p of Object.values(eC))p?.abort()}};if(c&&c.length>0){let f=I2e();i.appendChild(f);let p=C2e();f.appendChild(p);for(let S of c){let I=N2e(S,a,u);f.appendChild(I)}}}return i};var $w=ge(gp(),1);var eK=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=Mw(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof $w.WalletConnectV2Provider){let a=await t.dappProvider.getAddress(),u=await t.dappProvider.getSignature();be.set("address",a),be.set("loginMethod","mobile"),be.set("expires",Od()),await Ru(t),u&&be.set("signature",u),be.set("loginToken",e);let f=r.getToken(a,e,u);be.set("accessToken",f),ye.run("onLoginSuccess"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof $w.WalletConnectV2Provider&&await Nd(t)},onClientEvent:a=>{console.log("wc2 session event: ",a)}},c=new $w.WalletConnectV2Provider(o,dn[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(c){t.dappProvider=c,ye.run("onQrPending"),await c.init();let{uri:a,approval:u}=await c.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${a}&token=${e}`:a;return n&&f&&(s=await ZQ(n,f,c,e),ye.run("onQrLoaded")),await c.login({approval:u,token:e}),c}}catch(a){let u=wr(a);console.warn(`Something went wrong trying to login the user: ${u}`),ye.run("onLoginFailure",u)}};h();var tK=ge(Cd(),1);var tC=async(t,e,r,n)=>{let i=new tK.WalletProvider(`${t}${Pa}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return be.set("loginMethod",dn[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),be.set("expires",Od()),be.set("loginToken",e),i}catch(c){let a=wr(c);console.warn(`Something went wrong trying to login the user: ${a}`),be.set("loginMethod",""),ye.run("onLoginFailure",a)}};h();var Kn=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};h();var rK=ge(Cd(),1);var nK=ge(N5(),1),rC=async(t,e)=>{let r=Kn("signature"),n=Kn("address"),i=be.get("address"),s=be.get("loginToken");if(r&&be.set("signature",r),n||i){n&&(be.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new rK.WalletProvider(`${t}${Pa}`);if(r&&e&&n){let a=new nK.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);be.set("accessToken",a)}return o}};h();var iK=ge(Hl(),1),sK=ge(W1(),1);var Yw=async(t,e)=>{ye.run("onTxSent",t);let n=await new sK.TransactionWatcher(e).awaitCompleted(t),i=n.sender,s=new iK.Account(i),o=await e.getAccount(i);s.update(o),be.set("address",s.address.bech32()),be.set("balance",s.balance.toString()),ye.run("onTxFinalized",n)};h();var Ld=ge(aK(),1),uK=ge(Dn(),1);h();var cK=ge(Hl(),1);var Jw=t=>{let e=t.getSender(),r=new cK.Account(e),n=t.nonce.valueOf();r.incrementNonce(),be.set("nonce",(n+1n).toString())};var lK=async(t,e,r,n)=>{if(Kn(Ld.WALLET_PROVIDER_CALLBACK_PARAM)===Ld.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=be.get("activeGuardian"),o=be.get("loginMethod"),c=Kn("hasWebWalletGuardianSign"),a;if("getTransactionsFromWalletUrl"in t){if(a=t.getTransactionsFromWalletUrl()?.[0],!a)return;o==="web-wallet"&&(a.data=b.Buffer.from(a.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&c&&(a=new Ld.WalletProvider(`${r}${Pa}`).getTransactionsFromWalletUrl()?.[0]);if(a){let u=uK.Transaction.fromPlainObject(a);u.nonce=BigInt(n),Jw(u);try{ye.run("onTxStart",u),await e.sendTransaction(u),await Yw(u,e)}catch(f){let S=`Getting transaction information failed! ${wr(f)}`;throw ye.run("onTxFailure",u,S),new Error(S)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};h();var Xw=ge(Vd(),1),fK=ge(Nt(),1),dK=ge(Cd(),1);var hK=t=>{let e=be.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Xw.TransactionVersion.withTxOptions()),t.setOptions(Xw.TransactionOptions.withOptions(r)),t.setGuardian(fK.Address.fromBech32(e))}return t},pK=async(t,e)=>{let r=new dK.WalletProvider(`${e}${Pa}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},gK=t=>{let e=be.get("activeGuardian");return!(!be.get("address")||!e||t.isGuardedTransaction())};h();var mK=()=>{let t=!Kn("walletProviderStatus"),e=Kn("status")==="signed",r=Kn("message"),n=Kn("signature");t&&e&&r&&n&&(ye.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};var cA=ge(lC(),1);h();h();h();function iEe(t){try{let e=atob(t),r=btoa(e),n=b.Buffer.from(t,"base64").toString(),i=b.Buffer.from(n).toString("base64");if(t===r&&t===i||e===n)return!0}catch{return!1}return!1}function Ud(t){return iEe(t)?atob(t):t}h();var oA=t=>Object.prototype.toString.call(t)==="[object String]";h();var IK=t=>{if(!t||!oA(t))return null;let e=t.split(".");if(e.length!==4)return null;try{let[r,n,i,s]=e,o=JSON.parse(Ud(s)),c=Ud(r);return{ttl:Number(i),extraInfo:o,origin:c,blockHash:n}}catch(r){return console.error(`Error trying to decode ${t}:`,r),null}};var CK=t=>{if(!t||!oA(t))return null;let e=t.split(".");if(e.length!==3)return console.error("Invalid nativeAuthToken. You may be trying to decode a loginToken. Try using decodeLoginToken method instead"),null;try{let[r,n,i]=e,s=Ud(r),o=Ud(n),c=IK(o);if(!c)return{address:s,body:o,signature:i,blockHash:"",origin:"",ttl:0};let a={...c,address:s,body:o,signature:i};return c.extraInfo?.timestamp||delete a.extraInfo,a}catch{return null}};var xK=ge(lC(),1);function NK(t,e){let r=CK(t);if(r==null)return;let{signature:n,address:i,body:s}=r;n&&t&&i&&(be.set("loginToken",s),be.set("accessToken",t),be.set("signature",n),be.set("address",i),be.set("loginMethod","x-portal-hub"),e.dappProvider=new xK.WebviewProvider)}h();var OK=t=>{t.onLoginStart&&ye.set("onLoginStart",t.onLoginStart),t.onLoginSuccess&&ye.set("onLoginSuccess",t.onLoginSuccess),t.onLoginFailure&&ye.set("onLoginFailure",t.onLoginFailure),t.onLogoutStart&&ye.set("onLogoutStart",t.onLogoutStart),t.onLogoutSuccess&&ye.set("onLogoutSuccess",t.onLogoutSuccess),t.onLogoutFailure&&ye.set("onLogoutFailure",t.onLogoutFailure),t.onQrPending&&ye.set("onQrPending",t.onQrPending),t.onQrLoaded&&ye.set("onQrLoaded",t.onQrLoaded),t.onTxStart&&ye.set("onTxStart",t.onTxStart),t.onTxSent&&ye.set("onTxSent",t.onTxSent),t.onTxFinalized&&ye.set("onTxFinalized",t.onTxFinalized),t.onTxFailure&&ye.set("onTxFailure",t.onTxFailure),t.onSignMsgStart&&ye.set("onSignMsgStart",t.onSignMsgStart),t.onSignMsgFinalized&&ye.set("onSignMsgFinalized",t.onSignMsgFinalized),t.onSignMsgFailure&&ye.set("onSignMsgFailure",t.onSignMsgFailure),t.onQueryStart&&ye.set("onQueryStart",t.onQueryStart),t.onQueryFinalized&&ye.set("onQueryFinalized",t.onQueryFinalized),t.onQueryFailure&&ye.set("onQueryFailure",t.onQueryFailure)};h();var aA=async t=>{ye.run("onLoginStart");try{await t(()=>{ye.run("onLoginSuccess")})}catch(e){let r=wr(e);console.warn(`Something went wrong trying to login the user: ${r}`),ye.run("onLoginFailure",r)}};var pC=class{static async init(e){let r=be.get();if(r.expires&&Lw(r.expires)){be.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Ly,apiUrl:ED,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:_D,...e},this.networkProvider=new Bw(this.initOptions),OK(this.initOptions);let n=Kn("accessToken");n&&await aA(async s=>{NK(n,this),await Ru(this),s()}),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Kn("address"))&&r?.loginMethod&&(await aA(async s=>{r.loginMethod==="browser-extension"&&(this.dappProvider=await Fy()),r.loginMethod==="mobile"&&(this.dappProvider=await kj(this)),r.loginMethod==="x-portal-hub"&&(this.dappProvider=new cA.WebviewProvider),r.loginMethod==="web-wallet"&&this.initOptions?.chainType&&(this.dappProvider=await rC(dn[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions?.chainType&&(this.dappProvider=await rC(dn[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await Ru(this),s()}),this.initOptions?.chainType&&(await lK(this.dappProvider,this.networkProvider,dn[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),mK()))}static async login(e,r){if(!Object.values(O5).includes(e)){let i="Wrong login method!";throw ye.run("onLoginFailure",i),new Error(i)}if(!this.networkProvider){let i="Login failed: Use ElvenJs.init() first!";throw ye.run("onLoginFailure",i),new Error(i)}await aA(async()=>{let i=new PK.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await Yj(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await eK(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await tC(dn[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await tC(dn[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}})}static async logout(){try{let e=await Nd(this);return this.dappProvider=void 0,e}catch(e){let r=wr(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider){let n="Transaction signing failed: There is no active session!";throw ye.run("onTxFailure",e,n),new Error(n)}if(!this.networkProvider){let n="Transaction signing failed: There is no active network provider!";throw ye.run("onTxFailure",e,n),new Error(n)}let r=hK(e);try{ye.run("onTxStart",e);let n=be.get();if(e.nonce=n.nonce,this.dappProvider instanceof fC.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof dC.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof cA.WebviewProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof hC.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=gK(r);if(i||Jw(r),i&&this.initOptions?.chainType){await pK(r,dn[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Yw(r,this.networkProvider)}}catch(n){let i=wr(n);throw ye.run("onTxFailure",r,`Getting transaction information failed! ${i}`),new Error(`Getting transaction information failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider){let i="Message signing failed: There is no active session!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}if(!this.networkProvider){let i="Message signing failed: There is no active network provider!";throw ye.run("onSignMsgFailure",e,i),new Error(i)}let n="";try{if(ye.run("onSignMsgStart",e),this.dappProvider instanceof fC.ExtensionProvider){let s=await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}));n=b.Buffer.from(s?.signature||"").toString("hex")}if(this.dappProvider instanceof dC.WalletConnectV2Provider){let s=await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}));n=b.Buffer.from(s?.signature||"").toString("hex")}if(this.dappProvider instanceof cA.WebviewProvider){let s=await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}));n=b.Buffer.from(s?.signature||"").toString("hex")}if(this.dappProvider instanceof hC.WalletProvider){let s=c=>encodeURIComponent(c).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),o=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new Op.Message({data:b.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${o}${o.includes("?")?"&":"?"}message=${s(e)}`)})}let i=be.get();return i.loginMethod!=="web-wallet"&&i.loginMethod!=="x-alias"&&ye.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=wr(i);throw ye.run("onSignMsgFailure",e,s),new Error(`Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Query failed: There is no active network provider!");if(!e||!r)throw new Error("Query failed: The Query arguments are not valid! Address and func required");let o={address:e,func:r,args:n,value:i,caller:s};try{ye.run("onQueryStart",o);let c=await this.networkProvider.queryContract(o);return ye.run("onQueryFinalized",c),c}catch(c){let a=wr(c);throw ye.run("onQueryFinalized",o,a),new Error(`Smart contract query failed! ${a}`)}}static{this.storage=be}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,ye.clear()}}};h();qt();Vu.config({ROUNDING_MODE:Vu.ROUND_FLOOR});var sEe=({amount:t,decimals:e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return BigInt(new Vu(t).shiftedBy(e).toFixed())},oEe=({amount:t,decimals:e,rounding:r=e})=>{if(e<0)throw new Error("Decimal places shouldn't be negative number!");return new Vu(t).shiftedBy(-e).decimalPlaces(r).toFixed()};var export_Account=cEe.Account;var export_Address=aEe.Address;var export_AddressType=BK.AddressType;var export_AddressValue=BK.AddressValue;var export_BigUIntType=vo.BigUIntType;var export_BigUIntValue=vo.BigUIntValue;var export_BooleanType=DK.BooleanType;var export_BooleanValue=DK.BooleanValue;var export_BytesType=MK.BytesType;var export_BytesValue=MK.BytesValue;var export_ContractQueryResponse=hEe.ContractQueryResponse;var export_Message=RK.Message;var export_MessageComputer=RK.MessageComputer;var export_QueryArguments=dEe.QueryArguments;var export_SmartContractTransactionsFactory=uA.SmartContractTransactionsFactory;var export_SmartContractTransactionsOutcomeParser=yC.SmartContractTransactionsOutcomeParser;var export_Token=gC.Token;var export_TokenComputer=gC.TokenComputer;var export_TokenManagementTransactionsFactory=uA.TokenManagementTransactionsFactory;var export_TokenManagementTransactionsOutcomeParser=yC.TokenManagementTransactionsOutcomeParser;var export_TokenOperationsFactory=mC.TokenOperationsFactory;var export_TokenOperationsFactoryConfig=mC.TokenOperationsFactoryConfig;var export_TokenOperationsOutcomeParser=mC.TokenOperationsOutcomeParser;var export_TokenTransfer=gC.TokenTransfer;var export_Transaction=uEe.Transaction;var export_TransactionComputer=lEe.TransactionComputer;var export_TransactionEventsParser=yC.TransactionEventsParser;var export_TransactionWatcher=fEe.TransactionWatcher;var export_TransactionsFactoryConfig=uA.TransactionsFactoryConfig;var export_TransferTransactionsFactory=uA.TransferTransactionsFactory;var export_U16Type=vo.U16Type;var export_U16Value=vo.U16Value;var export_U32Type=vo.U32Type;var export_U32Value=vo.U32Value;var export_U64Type=vo.U64Type;var export_U64Value=vo.U64Value;var export_U8Type=vo.U8Type;var export_U8Value=vo.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractQueryResponse as ContractQueryResponse,NAe as DappCoreWCV2CustomMethodsEnum,pC as ElvenJS,qj as EventStoreEvents,O5 as LoginMethodsEnum,export_Message as Message,export_MessageComputer as MessageComputer,export_QueryArguments as QueryArguments,export_SmartContractTransactionsFactory as SmartContractTransactionsFactory,export_SmartContractTransactionsOutcomeParser as SmartContractTransactionsOutcomeParser,export_Token as Token,export_TokenComputer as TokenComputer,export_TokenManagementTransactionsFactory as TokenManagementTransactionsFactory,export_TokenManagementTransactionsOutcomeParser as TokenManagementTransactionsOutcomeParser,export_TokenOperationsFactory as TokenOperationsFactory,export_TokenOperationsFactoryConfig as TokenOperationsFactoryConfig,export_TokenOperationsOutcomeParser as TokenOperationsOutcomeParser,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionComputer as TransactionComputer,export_TransactionEventsParser as TransactionEventsParser,export_TransactionWatcher as TransactionWatcher,export_TransactionsFactoryConfig as TransactionsFactoryConfig,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value,OAe as WebWalletUrlParamsEnum,oEe as formatAmount,sEe as parseAmount}; /*! Bundled license information: ieee754/index.js: @@ -72,9 +72,6 @@ buffer/index.js: * @license MIT *) -safe-buffer/index.js: - (*! safe-buffer. MIT License. Feross Aboukhadijeh *) - tslib/tslib.es6.js: (*! ***************************************************************************** Copyright (c) Microsoft Corporation. diff --git a/example/index.html b/example/index.html index bfc7008..3a1f221 100644 --- a/example/index.html +++ b/example/index.html @@ -70,6 +70,11 @@

ElvenJS (demo)

All transactions will take place on the devent! Check how to use it on the testnet and mainnet in the docs.
+

+ For testing the browser extension locally you will need SSL (https) for the localhost. Check the README + file. +

Docs and code: www.elvenjs.com

For styling elements like QR code container and Wallet Connect pairings check demo styles. Each element diff --git a/package-lock.json b/package-lock.json index 84b952c..3112c89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,45 +1,46 @@ { "name": "elven.js", - "version": "0.19.0", + "version": "0.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "elven.js", - "version": "0.19.0", + "version": "0.20.0", "license": "MIT", + "dependencies": { + "bignumber.js": "^9.1.2" + }, "devDependencies": { "@eslint/eslintrc": "3.1.0", - "@eslint/js": "9.8.0", - "@multiversx/sdk-core": "13.2.2", - "@multiversx/sdk-extension-provider": "3.0.0", - "@multiversx/sdk-native-auth-client": "1.0.8", - "@multiversx/sdk-network-providers": "2.4.3", - "@multiversx/sdk-wallet-connect-provider": "4.1.3", - "@multiversx/sdk-web-wallet-provider": "3.2.1", - "@multiversx/sdk-webview-provider": "0.0.11", + "@eslint/js": "9.12.0", + "@multiversx/sdk-core": "13.8.0", + "@multiversx/sdk-extension-provider": "4.0.0", + "@multiversx/sdk-native-auth-client": "1.0.9", + "@multiversx/sdk-wallet-connect-provider": "5.0.0", + "@multiversx/sdk-web-wallet-provider": "4.0.0", + "@multiversx/sdk-webview-provider": "2.0.0-alpha.0", "@types/qrcode": "1.5.5", "@types/serve-handler": "6.1.4", - "@typescript-eslint/eslint-plugin": "8.0.0", - "@typescript-eslint/parser": "8.0.0", - "bignumber.js": "9.1.2", - "esbuild": "0.23.0", - "eslint": "9.8.0", + "@typescript-eslint/eslint-plugin": "8.8.1", + "@typescript-eslint/parser": "8.8.1", + "esbuild": "0.24.0", + "eslint": "9.12.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", - "globals": "15.9.0", - "node-stdlib-browser": "1.2.0", + "globals": "15.11.0", + "node-stdlib-browser": "1.2.1", "prettier": "3.3.3", - "qrcode": "1.5.3", + "qrcode": "1.5.4", "rimraf": "6.0.1", "serve-handler": "6.1.5", - "typescript": "5.5.4" + "typescript": "5.6.3" } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.0.tgz", - "integrity": "sha512-3sG8Zwa5fMcA9bgqB8AfWPQ+HFke6uD3h1s3RIwUNK8EG7a4buxvuFTs3j1IMs2NXAk9F30C/FF4vxRgQCcmoQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", + "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", "cpu": [ "ppc64" ], @@ -53,9 +54,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.0.tgz", - "integrity": "sha512-+KuOHTKKyIKgEEqKbGTK8W7mPp+hKinbMBeEnNzjJGyFcWsfrXjSTNluJHCY1RqhxFurdD8uNXQDei7qDlR6+g==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", + "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", "cpu": [ "arm" ], @@ -69,9 +70,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.0.tgz", - "integrity": "sha512-EuHFUYkAVfU4qBdyivULuu03FhJO4IJN9PGuABGrFy4vUuzk91P2d+npxHcFdpUnfYKy0PuV+n6bKIpHOB3prQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", + "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", "cpu": [ "arm64" ], @@ -85,9 +86,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.0.tgz", - "integrity": "sha512-WRrmKidLoKDl56LsbBMhzTTBxrsVwTKdNbKDalbEZr0tcsBgCLbEtoNthOW6PX942YiYq8HzEnb4yWQMLQuipQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", + "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", "cpu": [ "x64" ], @@ -101,9 +102,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.0.tgz", - "integrity": "sha512-YLntie/IdS31H54Ogdn+v50NuoWF5BDkEUFpiOChVa9UnKpftgwzZRrI4J132ETIi+D8n6xh9IviFV3eXdxfow==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", + "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", "cpu": [ "arm64" ], @@ -117,9 +118,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.0.tgz", - "integrity": "sha512-IMQ6eme4AfznElesHUPDZ+teuGwoRmVuuixu7sv92ZkdQcPbsNHzutd+rAfaBKo8YK3IrBEi9SLLKWJdEvJniQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", + "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", "cpu": [ "x64" ], @@ -133,9 +134,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.0.tgz", - "integrity": "sha512-0muYWCng5vqaxobq6LB3YNtevDFSAZGlgtLoAc81PjUfiFz36n4KMpwhtAd4he8ToSI3TGyuhyx5xmiWNYZFyw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", + "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", "cpu": [ "arm64" ], @@ -149,9 +150,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.0.tgz", - "integrity": "sha512-XKDVu8IsD0/q3foBzsXGt/KjD/yTKBCIwOHE1XwiXmrRwrX6Hbnd5Eqn/WvDekddK21tfszBSrE/WMaZh+1buQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", + "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", "cpu": [ "x64" ], @@ -165,9 +166,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.0.tgz", - "integrity": "sha512-SEELSTEtOFu5LPykzA395Mc+54RMg1EUgXP+iw2SJ72+ooMwVsgfuwXo5Fn0wXNgWZsTVHwY2cg4Vi/bOD88qw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", + "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", "cpu": [ "arm" ], @@ -181,9 +182,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.0.tgz", - "integrity": "sha512-j1t5iG8jE7BhonbsEg5d9qOYcVZv/Rv6tghaXM/Ug9xahM0nX/H2gfu6X6z11QRTMT6+aywOMA8TDkhPo8aCGw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", + "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", "cpu": [ "arm64" ], @@ -197,9 +198,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.0.tgz", - "integrity": "sha512-P7O5Tkh2NbgIm2R6x1zGJJsnacDzTFcRWZyTTMgFdVit6E98LTxO+v8LCCLWRvPrjdzXHx9FEOA8oAZPyApWUA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", + "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", "cpu": [ "ia32" ], @@ -213,9 +214,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.0.tgz", - "integrity": "sha512-InQwepswq6urikQiIC/kkx412fqUZudBO4SYKu0N+tGhXRWUqAx+Q+341tFV6QdBifpjYgUndV1hhMq3WeJi7A==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", + "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", "cpu": [ "loong64" ], @@ -229,9 +230,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.0.tgz", - "integrity": "sha512-J9rflLtqdYrxHv2FqXE2i1ELgNjT+JFURt/uDMoPQLcjWQA5wDKgQA4t/dTqGa88ZVECKaD0TctwsUfHbVoi4w==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", + "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", "cpu": [ "mips64el" ], @@ -245,9 +246,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.0.tgz", - "integrity": "sha512-cShCXtEOVc5GxU0fM+dsFD10qZ5UpcQ8AM22bYj0u/yaAykWnqXJDpd77ublcX6vdDsWLuweeuSNZk4yUxZwtw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", + "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", "cpu": [ "ppc64" ], @@ -261,9 +262,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.0.tgz", - "integrity": "sha512-HEtaN7Y5UB4tZPeQmgz/UhzoEyYftbMXrBCUjINGjh3uil+rB/QzzpMshz3cNUxqXN7Vr93zzVtpIDL99t9aRw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", + "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", "cpu": [ "riscv64" ], @@ -277,9 +278,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.0.tgz", - "integrity": "sha512-WDi3+NVAuyjg/Wxi+o5KPqRbZY0QhI9TjrEEm+8dmpY9Xir8+HE/HNx2JoLckhKbFopW0RdO2D72w8trZOV+Wg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", + "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", "cpu": [ "s390x" ], @@ -293,9 +294,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.0.tgz", - "integrity": "sha512-a3pMQhUEJkITgAw6e0bWA+F+vFtCciMjW/LPtoj99MhVt+Mfb6bbL9hu2wmTZgNd994qTAEw+U/r6k3qHWWaOQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", + "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", "cpu": [ "x64" ], @@ -309,9 +310,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.0.tgz", - "integrity": "sha512-cRK+YDem7lFTs2Q5nEv/HHc4LnrfBCbH5+JHu6wm2eP+d8OZNoSMYgPZJq78vqQ9g+9+nMuIsAO7skzphRXHyw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", + "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", "cpu": [ "x64" ], @@ -325,9 +326,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.0.tgz", - "integrity": "sha512-suXjq53gERueVWu0OKxzWqk7NxiUWSUlrxoZK7usiF50C6ipColGR5qie2496iKGYNLhDZkPxBI3erbnYkU0rQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", + "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", "cpu": [ "arm64" ], @@ -341,9 +342,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.0.tgz", - "integrity": "sha512-6p3nHpby0DM/v15IFKMjAaayFhqnXV52aEmv1whZHX56pdkK+MEaLoQWj+H42ssFarP1PcomVhbsR4pkz09qBg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", + "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", "cpu": [ "x64" ], @@ -357,9 +358,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.0.tgz", - "integrity": "sha512-BFelBGfrBwk6LVrmFzCq1u1dZbG4zy/Kp93w2+y83Q5UGYF1d8sCzeLI9NXjKyujjBBniQa8R8PzLFAUrSM9OA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", + "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", "cpu": [ "x64" ], @@ -373,9 +374,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.0.tgz", - "integrity": "sha512-lY6AC8p4Cnb7xYHuIxQ6iYPe6MfO2CC43XXKo9nBXDb35krYt7KGhQnOkRGar5psxYkircpCqfbNDB4uJbS2jQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", + "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", "cpu": [ "arm64" ], @@ -389,9 +390,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.0.tgz", - "integrity": "sha512-7L1bHlOTcO4ByvI7OXVI5pNN6HSu6pUQq9yodga8izeuB1KcT2UkHaH6118QJwopExPn0rMHIseCTx1CRo/uNA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", + "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", "cpu": [ "ia32" ], @@ -405,9 +406,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.0.tgz", - "integrity": "sha512-Arm+WgUFLUATuoxCJcahGuk6Yj9Pzxd6l11Zb/2aAuv5kWWvvfhLFo2fni4uSK5vzlUdCGZ/BdV5tH8klj8p8g==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", + "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", "cpu": [ "x64" ], @@ -445,9 +446,9 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.1.tgz", - "integrity": "sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==", + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", + "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", "dev": true, "dependencies": { "@eslint/object-schema": "^2.1.4", @@ -480,6 +481,15 @@ "node": "*" } }, + "node_modules/@eslint/core": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.6.0.tgz", + "integrity": "sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/eslintrc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", @@ -538,9 +548,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.8.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.8.0.tgz", - "integrity": "sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA==", + "version": "9.12.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.12.0.tgz", + "integrity": "sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -555,6 +565,40 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.0.tgz", + "integrity": "sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==", + "dev": true, + "dependencies": { + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.0.tgz", + "integrity": "sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==", + "dev": true, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.5", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.5.tgz", + "integrity": "sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==", + "dev": true, + "dependencies": { + "@humanfs/core": "^0.19.0", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -569,9 +613,9 @@ } }, "node_modules/@humanwhocodes/retry": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", - "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", "dev": true, "engines": { "node": ">=18.18" @@ -599,9 +643,9 @@ } }, "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, "engines": { "node": ">=12" @@ -626,9 +670,9 @@ } }, "node_modules/@multiversx/sdk-core": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-13.2.2.tgz", - "integrity": "sha512-ABQuy7PcFBnl5f9yFczgaq7tX72X0M836Ky9h4HRCQd5Mao3OJ3TrgHEvxZe9SVYXtwOm337iPsbkZzVslxu9A==", + "version": "13.8.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-13.8.0.tgz", + "integrity": "sha512-V1PMh4QjRAydtRaBjWsEE3xqXSdYvVI5sYchOQr2ls6fPfBg1GEZRWRMI9mO19L+wg6+bwU9PChQiVRO1Ynjog==", "dev": true, "dependencies": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -639,58 +683,27 @@ "keccak": "3.0.2" }, "peerDependencies": { + "axios": "^1.7.4", "bignumber.js": "^9.0.1", "protobufjs": "^7.2.6" } }, - "node_modules/@multiversx/sdk-dapp-utils": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-dapp-utils/-/sdk-dapp-utils-0.0.1.tgz", - "integrity": "sha512-fl3TdES93Jc4T559BI+QxNRGRUTabb7TiAXHKL9g6mbLD+silK+5euAoDpPBkbZpVFnfsXQssUVuyKBV4Ine6w==", - "dev": true, - "peer": true, - "peerDependencies": { - "@multiversx/sdk-core": ">= 12.1.0" - } - }, "node_modules/@multiversx/sdk-extension-provider": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-extension-provider/-/sdk-extension-provider-3.0.0.tgz", - "integrity": "sha512-xNHLShzimYbMXqEJoiNyB4fNOXQUwSJCzt9FiOA4GdxucJnCgIM25mXtSj2I93cz+KD39QgRjEYep+li/lykOw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-extension-provider/-/sdk-extension-provider-4.0.0.tgz", + "integrity": "sha512-zFt4jUS7tu+MlDPou9wmzoW1dcvQuz0nBEYY75ynt82wC7aYjSDhsYh3U4DKtj5TgmyoOSZ31CLJN0wcoNYVaw==", "dev": true, "peerDependencies": { - "@multiversx/sdk-core": ">= 12.1.0" + "@multiversx/sdk-core": ">= 13.5.0" } }, "node_modules/@multiversx/sdk-native-auth-client": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.8.tgz", - "integrity": "sha512-anXcQplVp3/m2rBH4oGQZNIhk0m/J45SomubNMCgSzepJ2PU5E5eQLYletvSDObhTGfRnNCF8edAldkDP9a4Kw==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.9.tgz", + "integrity": "sha512-q1/cDRKz7QQsr8lQskUsfGkqJbIut772/MBX52Td4OTGg/G1HAm2xsELe+06y7L537A2rqz5/W9KkJ5yWt968g==", "dev": true, "dependencies": { - "axios": "^1.6.8" - } - }, - "node_modules/@multiversx/sdk-network-providers": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.4.3.tgz", - "integrity": "sha512-tJmJuxU+BjtC2q29PuzQOM4Qr6aiXujKwQXgIAPHTiuNbMc3Yi6Q4B0DC1PfI3iG+M4DONwfXknvM1uwqnY2zA==", - "dev": true, - "dependencies": { - "axios": "1.6.8", - "bech32": "1.1.4", - "bignumber.js": "9.0.1", - "buffer": "6.0.3", - "json-bigint": "1.0.0" - } - }, - "node_modules/@multiversx/sdk-network-providers/node_modules/bignumber.js": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", - "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", - "dev": true, - "engines": { - "node": "*" + "axios": "^1.7.4" } }, "node_modules/@multiversx/sdk-transaction-decoder": { @@ -709,39 +722,71 @@ "dev": true }, "node_modules/@multiversx/sdk-wallet-connect-provider": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.1.3.tgz", - "integrity": "sha512-HOsbP3f5uV7+JOBcLuNxLLwL0fBFRUe09Pi+4Hpjd8k5FiZFWfDBXmIzcQ/6vkINFnPkMfzDtKlPdZT/VquBPg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-5.0.0.tgz", + "integrity": "sha512-ftmqiVcrjsltkRoO//GK8JOfQ3qj9929J+t6EPRvr5qQeTBZn+XHu4icvNsB6gGxvZ8HZkgVVpSo3hskqLIfQw==", "dev": true, "dependencies": { - "@walletconnect/sign-client": "2.13.3", - "@walletconnect/utils": "2.13.3", + "@walletconnect/sign-client": "2.17.0", + "@walletconnect/utils": "2.17.0", "bech32": "1.1.4" }, "peerDependencies": { - "@multiversx/sdk-core": ">= 12.5.0" + "@multiversx/sdk-core": ">= 13.5.0" + } + }, + "node_modules/@multiversx/sdk-web-wallet-cross-window-provider": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-cross-window-provider/-/sdk-web-wallet-cross-window-provider-2.0.1.tgz", + "integrity": "sha512-Qw63+zz2HHO8IRKn63NAAI83WX8PB3Zrz3nZ8RNK3+bn7Po/uXzSRmx1tZ8du6A7EnW9ocTZtc1jMvXZWQCu/Q==", + "dev": true, + "peer": true, + "dependencies": { + "qs": "6.11.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@multiversx/sdk-core": ">= 13.5.0" + } + }, + "node_modules/@multiversx/sdk-web-wallet-cross-window-provider/node_modules/qs": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dev": true, + "peer": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/@multiversx/sdk-web-wallet-provider": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.2.1.tgz", - "integrity": "sha512-f0CHVsBephFhoQtCAx9y2WhiIZEaNgn0oVa+sZNkgILcXU53Gm8Rj8wMfM0SDimHBYcXCcBDedyLCU3MioOjoQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-4.0.0.tgz", + "integrity": "sha512-jcAUo1fhSKiFjbOvyRx1z8wz7VdKA/WSKtqoscL/GGqaSWD1f1UYHR9pDlvrswryE/dAZvMG+eqbOLhLxy6srg==", "dev": true, "dependencies": { "qs": "6.10.3" }, "peerDependencies": { - "@multiversx/sdk-core": ">= 12.18.0" + "@multiversx/sdk-core": ">= 13.5.0" } }, "node_modules/@multiversx/sdk-webview-provider": { - "version": "0.0.11", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-webview-provider/-/sdk-webview-provider-0.0.11.tgz", - "integrity": "sha512-+0t2UZq8KlOebFTg/wbtmGnwMMyaBlSFprsKgFTgWigszdQR9XYhHVWtgEPgT7cuCR1xd3NmkDXQzmF2GfqSkQ==", + "version": "2.0.0-alpha.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-webview-provider/-/sdk-webview-provider-2.0.0-alpha.0.tgz", + "integrity": "sha512-taHNTTXSAcn/z1fJN8e/y7XzLvBvMOABqHVSIiburWvOXkki7HY2snIpW3/N1h/VzOBjL9NEneLRucbZIgRBDg==", "dev": true, "peerDependencies": { - "@multiversx/sdk-core": ">= 12.1.0", - "@multiversx/sdk-dapp-utils": ">= 0.0.1" + "@multiversx/sdk-core": ">= 13.5.0", + "@multiversx/sdk-web-wallet-cross-window-provider": ">= 2.0.0-alpha.1" } }, "node_modules/@nodelib/fs.scandir": { @@ -1345,6 +1390,18 @@ "@stablelib/wipe": "^1.0.1" } }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, "node_modules/@types/node": { "version": "20.12.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz", @@ -1373,16 +1430,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.0.0.tgz", - "integrity": "sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.8.1.tgz", + "integrity": "sha512-xfvdgA8AP/vxHgtgU310+WBnLB4uJQ9XdyP17RebG26rLtDrQJV3ZYrcopX91GrHmMoH8bdSwMRh2a//TiJ1jQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.0.0", - "@typescript-eslint/type-utils": "8.0.0", - "@typescript-eslint/utils": "8.0.0", - "@typescript-eslint/visitor-keys": "8.0.0", + "@typescript-eslint/scope-manager": "8.8.1", + "@typescript-eslint/type-utils": "8.8.1", + "@typescript-eslint/utils": "8.8.1", + "@typescript-eslint/visitor-keys": "8.8.1", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1406,15 +1463,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.0.tgz", - "integrity": "sha512-pS1hdZ+vnrpDIxuFXYQpLTILglTjSYJ9MbetZctrUawogUsPdz31DIIRZ9+rab0LhYNTsk88w4fIzVheiTbWOQ==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.8.1.tgz", + "integrity": "sha512-hQUVn2Lij2NAxVFEdvIGxT9gP1tq2yM83m+by3whWFsWC+1y8pxxxHUFE1UqDu2VsGi2i6RLcv4QvouM84U+ow==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.0.0", - "@typescript-eslint/types": "8.0.0", - "@typescript-eslint/typescript-estree": "8.0.0", - "@typescript-eslint/visitor-keys": "8.0.0", + "@typescript-eslint/scope-manager": "8.8.1", + "@typescript-eslint/types": "8.8.1", + "@typescript-eslint/typescript-estree": "8.8.1", + "@typescript-eslint/visitor-keys": "8.8.1", "debug": "^4.3.4" }, "engines": { @@ -1434,13 +1491,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.0.0.tgz", - "integrity": "sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.8.1.tgz", + "integrity": "sha512-X4JdU+66Mazev/J0gfXlcC/dV6JI37h+93W9BRYXrSn0hrE64IoWgVkO9MSJgEzoWkxONgaQpICWg8vAN74wlA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.0.0", - "@typescript-eslint/visitor-keys": "8.0.0" + "@typescript-eslint/types": "8.8.1", + "@typescript-eslint/visitor-keys": "8.8.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1451,13 +1508,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.0.0.tgz", - "integrity": "sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.8.1.tgz", + "integrity": "sha512-qSVnpcbLP8CALORf0za+vjLYj1Wp8HSoiI8zYU5tHxRVj30702Z1Yw4cLwfNKhTPWp5+P+k1pjmD5Zd1nhxiZA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "8.0.0", - "@typescript-eslint/utils": "8.0.0", + "@typescript-eslint/typescript-estree": "8.8.1", + "@typescript-eslint/utils": "8.8.1", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1475,9 +1532,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.0.0.tgz", - "integrity": "sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.8.1.tgz", + "integrity": "sha512-WCcTP4SDXzMd23N27u66zTKMuEevH4uzU8C9jf0RO4E04yVHgQgW+r+TeVTNnO1KIfrL8ebgVVYYMMO3+jC55Q==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1488,15 +1545,15 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.0.0.tgz", - "integrity": "sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.8.1.tgz", + "integrity": "sha512-A5d1R9p+X+1js4JogdNilDuuq+EHZdsH9MjTVxXOdVFfTJXunKJR/v+fNNyO4TnoOn5HqobzfRlc70NC6HTcdg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.0.0", - "@typescript-eslint/visitor-keys": "8.0.0", + "@typescript-eslint/types": "8.8.1", + "@typescript-eslint/visitor-keys": "8.8.1", "debug": "^4.3.4", - "globby": "^11.1.0", + "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", @@ -1516,15 +1573,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.0.0.tgz", - "integrity": "sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.8.1.tgz", + "integrity": "sha512-/QkNJDbV0bdL7H7d0/y0qBbV2HTtf0TIyjSDTvvmQEzeVx8jEImEbLuOA4EsvE8gIgqMitns0ifb5uQhMj8d9w==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.0.0", - "@typescript-eslint/types": "8.0.0", - "@typescript-eslint/typescript-estree": "8.0.0" + "@typescript-eslint/scope-manager": "8.8.1", + "@typescript-eslint/types": "8.8.1", + "@typescript-eslint/typescript-estree": "8.8.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1538,12 +1595,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.0.0.tgz", - "integrity": "sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.8.1.tgz", + "integrity": "sha512-0/TdC3aeRAsW7MDvYRwEc1Uwm0TIBfzjPFgg60UU2Haj5qsCs9cc3zNgY71edqE3LbWfF/WoZQd3lJoDXFQpag==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.0.0", + "@typescript-eslint/types": "8.8.1", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -1555,9 +1612,9 @@ } }, "node_modules/@walletconnect/core": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.13.3.tgz", - "integrity": "sha512-TdF+rC6rONJGyOUtt/nLkbyQWjnkwbD3kXq3ZA0Q7+tYtmSjTDE4wbArlLbHIbtf69g+9/DpEVEQimWWcEOn2g==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.17.0.tgz", + "integrity": "sha512-On+uSaCfWdsMIQsECwWHZBmUXfrnqmv6B8SXRRuTJgd8tUpEvBkLQH4X7XkSm3zW6ozEkQTCagZ2ox2YPn3kbw==", "dev": true, "dependencies": { "@walletconnect/heartbeat": "1.2.2", @@ -1567,16 +1624,18 @@ "@walletconnect/jsonrpc-ws-connection": "1.0.14", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "2.1.2", - "@walletconnect/relay-api": "1.0.10", + "@walletconnect/relay-api": "1.0.11", "@walletconnect/relay-auth": "1.0.4", "@walletconnect/safe-json": "1.0.2", "@walletconnect/time": "1.0.2", - "@walletconnect/types": "2.13.3", - "@walletconnect/utils": "2.13.3", + "@walletconnect/types": "2.17.0", + "@walletconnect/utils": "2.17.0", "events": "3.3.0", - "isomorphic-unfetch": "3.1.0", "lodash.isequal": "4.5.0", "uint8arrays": "3.1.0" + }, + "engines": { + "node": ">=18" } }, "node_modules/@walletconnect/environment": { @@ -1683,9 +1742,9 @@ } }, "node_modules/@walletconnect/relay-api": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.10.tgz", - "integrity": "sha512-tqrdd4zU9VBNqUaXXQASaexklv6A54yEyQQEXYOCr+Jz8Ket0dmPBDyg19LVSNUN2cipAghQc45/KVmfFJ0cYw==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.11.tgz", + "integrity": "sha512-tLPErkze/HmC9aCmdZOhtVmYZq1wKfWTJtygQHoWtgg722Jd4homo54Cs4ak2RUFUZIGO2RsOpIcWipaua5D5Q==", "dev": true, "dependencies": { "@walletconnect/jsonrpc-types": "^1.0.2" @@ -1715,19 +1774,19 @@ } }, "node_modules/@walletconnect/sign-client": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.13.3.tgz", - "integrity": "sha512-3Pcq6trHWdBZn5X0VUFQ3zJaaqyEbMW9WNVKcZ2SakIpQAwySd08Mztvq48G98jfucdgP3tjGPbBvzHX9vJX7w==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.17.0.tgz", + "integrity": "sha512-sErYwvSSHQolNXni47L3Bm10ptJc1s1YoJvJd34s5E9h9+d3rj7PrhbiW9X82deN+Dm5oA8X9tC4xty1yIBrVg==", "dev": true, "dependencies": { - "@walletconnect/core": "2.13.3", + "@walletconnect/core": "2.17.0", "@walletconnect/events": "1.0.1", "@walletconnect/heartbeat": "1.2.2", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "2.1.2", "@walletconnect/time": "1.0.2", - "@walletconnect/types": "2.13.3", - "@walletconnect/utils": "2.13.3", + "@walletconnect/types": "2.17.0", + "@walletconnect/utils": "2.17.0", "events": "3.3.0" } }, @@ -1741,9 +1800,9 @@ } }, "node_modules/@walletconnect/types": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.13.3.tgz", - "integrity": "sha512-9UdtLoQqwGFfepCPprUAXeUbKg9zyDarPRmEJVco51OWXHCOpvRgroWk54fQHDhCUIfDELjObY6XNAzNrmNYUA==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.17.0.tgz", + "integrity": "sha512-i1pn9URpvt9bcjRDkabuAmpA9K7mzyKoLJlbsAujRVX7pfaG7wur7u9Jz0bk1HxvuABL5LHNncTnVKSXKQ5jZA==", "dev": true, "dependencies": { "@walletconnect/events": "1.0.1", @@ -1755,9 +1814,9 @@ } }, "node_modules/@walletconnect/utils": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.13.3.tgz", - "integrity": "sha512-hjyyNhnhTCezGNr6OCfKRzqRsiak+p+YP57iRo1Tsf222fsj/9JD++MP97YiDwc4e4xXaZp/boiLB+8hJHsCog==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.17.0.tgz", + "integrity": "sha512-1aeQvjwsXy4Yh9G6g2eGmXrEl+BzkNjHRdCrGdMYqFTFa8ROEJfTGsSH3pLsNDlOY94CoBUvJvM55q/PMoN/FQ==", "dev": true, "dependencies": { "@stablelib/chacha20poly1305": "1.0.1", @@ -1765,13 +1824,15 @@ "@stablelib/random": "1.0.2", "@stablelib/sha256": "1.0.1", "@stablelib/x25519": "1.0.3", - "@walletconnect/relay-api": "1.0.10", + "@walletconnect/relay-api": "1.0.11", + "@walletconnect/relay-auth": "1.0.4", "@walletconnect/safe-json": "1.0.2", "@walletconnect/time": "1.0.2", - "@walletconnect/types": "2.13.3", + "@walletconnect/types": "2.17.0", "@walletconnect/window-getters": "1.0.1", "@walletconnect/window-metadata": "1.0.1", "detect-browser": "5.3.0", + "elliptic": "^6.5.7", "query-string": "7.1.3", "uint8arrays": "3.1.0" } @@ -1875,15 +1936,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/asn1.js": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", @@ -1945,9 +1997,9 @@ } }, "node_modules/axios": { - "version": "1.6.8", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", "dev": true, "dependencies": { "follow-redirects": "^1.15.6", @@ -1991,7 +2043,6 @@ "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", - "dev": true, "engines": { "node": "*" } @@ -2158,21 +2209,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/browserify-sign/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/browserify-sign/node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "node_modules/browserify-zlib": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", @@ -2434,9 +2470,9 @@ "dev": true }, "node_modules/confbox": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", - "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==", + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", "dev": true }, "node_modules/consola": { @@ -2545,17 +2581,12 @@ } }, "node_modules/crossws": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.2.4.tgz", - "integrity": "sha512-DAxroI2uSOgUKLz00NX6A8U/8EE3SZHmIND+10jkVSaypvyt57J5JEOxAQOL6lQxyzi/wZbTIwssU1uy69h5Vg==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.1.tgz", + "integrity": "sha512-HsZgeVYaG+b5zA+9PbIPGq4+J/CJynJuearykPsXx4V/eMhyQ5EDVg3Ak2FBZtVXCiOLu/U7IiwDHTr9MA+IKw==", "dev": true, - "peerDependencies": { - "uWebSockets.js": "*" - }, - "peerDependenciesMeta": { - "uWebSockets.js": { - "optional": true - } + "dependencies": { + "uncrypto": "^0.1.3" } }, "node_modules/crypto-browserify": { @@ -2727,18 +2758,6 @@ "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", "dev": true }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/domain-browser": { "version": "4.23.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.23.0.tgz", @@ -2770,9 +2789,9 @@ "dev": true }, "node_modules/elliptic": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.5.tgz", - "integrity": "sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", + "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", @@ -2796,12 +2815,6 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, - "node_modules/encode-utf8": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz", - "integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==", - "dev": true - }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -2833,9 +2846,9 @@ } }, "node_modules/esbuild": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.0.tgz", - "integrity": "sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", + "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", "dev": true, "hasInstallScript": true, "bin": { @@ -2845,30 +2858,30 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.23.0", - "@esbuild/android-arm": "0.23.0", - "@esbuild/android-arm64": "0.23.0", - "@esbuild/android-x64": "0.23.0", - "@esbuild/darwin-arm64": "0.23.0", - "@esbuild/darwin-x64": "0.23.0", - "@esbuild/freebsd-arm64": "0.23.0", - "@esbuild/freebsd-x64": "0.23.0", - "@esbuild/linux-arm": "0.23.0", - "@esbuild/linux-arm64": "0.23.0", - "@esbuild/linux-ia32": "0.23.0", - "@esbuild/linux-loong64": "0.23.0", - "@esbuild/linux-mips64el": "0.23.0", - "@esbuild/linux-ppc64": "0.23.0", - "@esbuild/linux-riscv64": "0.23.0", - "@esbuild/linux-s390x": "0.23.0", - "@esbuild/linux-x64": "0.23.0", - "@esbuild/netbsd-x64": "0.23.0", - "@esbuild/openbsd-arm64": "0.23.0", - "@esbuild/openbsd-x64": "0.23.0", - "@esbuild/sunos-x64": "0.23.0", - "@esbuild/win32-arm64": "0.23.0", - "@esbuild/win32-ia32": "0.23.0", - "@esbuild/win32-x64": "0.23.0" + "@esbuild/aix-ppc64": "0.24.0", + "@esbuild/android-arm": "0.24.0", + "@esbuild/android-arm64": "0.24.0", + "@esbuild/android-x64": "0.24.0", + "@esbuild/darwin-arm64": "0.24.0", + "@esbuild/darwin-x64": "0.24.0", + "@esbuild/freebsd-arm64": "0.24.0", + "@esbuild/freebsd-x64": "0.24.0", + "@esbuild/linux-arm": "0.24.0", + "@esbuild/linux-arm64": "0.24.0", + "@esbuild/linux-ia32": "0.24.0", + "@esbuild/linux-loong64": "0.24.0", + "@esbuild/linux-mips64el": "0.24.0", + "@esbuild/linux-ppc64": "0.24.0", + "@esbuild/linux-riscv64": "0.24.0", + "@esbuild/linux-s390x": "0.24.0", + "@esbuild/linux-x64": "0.24.0", + "@esbuild/netbsd-x64": "0.24.0", + "@esbuild/openbsd-arm64": "0.24.0", + "@esbuild/openbsd-x64": "0.24.0", + "@esbuild/sunos-x64": "0.24.0", + "@esbuild/win32-arm64": "0.24.0", + "@esbuild/win32-ia32": "0.24.0", + "@esbuild/win32-x64": "0.24.0" } }, "node_modules/escape-string-regexp": { @@ -2884,27 +2897,31 @@ } }, "node_modules/eslint": { - "version": "9.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.8.0.tgz", - "integrity": "sha512-K8qnZ/QJzT2dLKdZJVX6W4XOwBzutMYmt0lqUS+JdXgd+HTYFlonFgkJ8s44d/zMPPCnOOk0kMWCApCPhiOy9A==", + "version": "9.12.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.12.0.tgz", + "integrity": "sha512-UVIOlTEWxwIopRL1wgSQYdnVDcEvs2wyaO6DGo5mXqe3r16IoCNWkR29iHhyaP4cICWjbgbmFUGAhh0GJRuGZw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.11.0", - "@eslint/config-array": "^0.17.1", + "@eslint/config-array": "^0.18.0", + "@eslint/core": "^0.6.0", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.8.0", + "@eslint/js": "9.12.0", + "@eslint/plugin-kit": "^0.2.0", + "@humanfs/node": "^0.16.5", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.3.0", - "@nodelib/fs.walk": "^1.2.8", + "@humanwhocodes/retry": "^0.3.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.0.2", - "eslint-visitor-keys": "^4.0.0", - "espree": "^10.1.0", + "eslint-scope": "^8.1.0", + "eslint-visitor-keys": "^4.1.0", + "espree": "^10.2.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -2914,14 +2931,11 @@ "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", "text-table": "^0.2.0" }, "bin": { @@ -2932,6 +2946,14 @@ }, "funding": { "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-config-prettier": { @@ -2977,9 +2999,9 @@ } }, "node_modules/eslint-scope": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", - "integrity": "sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.1.0.tgz", + "integrity": "sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -3015,9 +3037,9 @@ } }, "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", - "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz", + "integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3039,14 +3061,14 @@ } }, "node_modules/espree": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", - "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.2.0.tgz", + "integrity": "sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==", "dev": true, "dependencies": { "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.0.0" + "eslint-visitor-keys": "^4.1.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3056,9 +3078,9 @@ } }, "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", - "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz", + "integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3299,9 +3321,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", "dev": true, "funding": [ { @@ -3477,9 +3499,9 @@ } }, "node_modules/globals": { - "version": "15.9.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.9.0.tgz", - "integrity": "sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA==", + "version": "15.11.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.11.0.tgz", + "integrity": "sha512-yeyNSjdbyVaWurlwCpcA6XNBrHTMIeDdj0/hnvX/OLJ9ekOXYbLsLinH/MucQyGvNnXhidTdNhTtJaffL2sMfw==", "dev": true, "engines": { "node": ">=18" @@ -3488,26 +3510,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -3527,21 +3529,21 @@ "dev": true }, "node_modules/h3": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.12.0.tgz", - "integrity": "sha512-Zi/CcNeWBXDrFNlV0hUBJQR9F7a96RjMeAZweW/ZWkR9fuXrMcvKnSA63f/zZ9l0GgQOZDVHGvXivNN9PWOwhA==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.13.0.tgz", + "integrity": "sha512-vFEAu/yf8UMUcB4s43OaDaigcqpQd14yanmOsn+NcRX3/guSKncyE2rOYhq8RIchgJrPSs/QiIddnTTR1ddiAg==", "dev": true, "dependencies": { - "cookie-es": "^1.1.0", - "crossws": "^0.2.4", + "cookie-es": "^1.2.2", + "crossws": ">=0.2.0 <0.4.0", "defu": "^6.1.4", "destr": "^2.0.3", - "iron-webcrypto": "^1.1.1", - "ohash": "^1.1.3", + "iron-webcrypto": "^1.2.1", + "ohash": "^1.1.4", "radix3": "^1.1.2", - "ufo": "^1.5.3", + "ufo": "^1.5.4", "uncrypto": "^0.1.3", - "unenv": "^1.9.0" + "unenv": "^1.10.0" } }, "node_modules/has-flag": { @@ -3905,15 +3907,6 @@ "node": ">=0.12.0" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", @@ -3992,16 +3985,6 @@ "node": ">=10" } }, - "node_modules/isomorphic-unfetch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz", - "integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==", - "dev": true, - "dependencies": { - "node-fetch": "^2.6.1", - "unfetch": "^4.2.0" - } - }, "node_modules/jackspeak": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz", @@ -4021,12 +4004,12 @@ } }, "node_modules/jiti": { - "version": "1.21.6", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.6.tgz", - "integrity": "sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.3.3.tgz", + "integrity": "sha512-EX4oNDwcXSivPrw2qKH2LB5PoFxEvgtv2JgwW0bU858HoLQ+kutSvjLMUqBd0PeJYEinLWhoI9Ol0eYMqj/wNQ==", "dev": true, "bin": { - "jiti": "bin/jiti.js" + "jiti": "lib/jiti-cli.mjs" } }, "node_modules/js-yaml": { @@ -4112,9 +4095,9 @@ } }, "node_modules/listhen": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/listhen/-/listhen-1.7.2.tgz", - "integrity": "sha512-7/HamOm5YD9Wb7CFgAZkKgVPA96WwhcTQoqtm2VTZGVbVVn3IWKRBTgrU7cchA3Q8k9iCsG8Osoi9GX4JsGM9g==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/listhen/-/listhen-1.9.0.tgz", + "integrity": "sha512-I8oW2+QL5KJo8zXNWX046M134WchxsXC7SawLPvRQpogCbkyQIaFxPE89A2HiwR7vAK2Dm2ERBAmyjTYGYEpBg==", "dev": true, "dependencies": { "@parcel/watcher": "^2.4.1", @@ -4122,17 +4105,17 @@ "citty": "^0.1.6", "clipboardy": "^4.0.0", "consola": "^3.2.3", - "crossws": "^0.2.0", + "crossws": ">=0.2.0 <0.4.0", "defu": "^6.1.4", "get-port-please": "^3.1.2", - "h3": "^1.10.2", + "h3": "^1.12.0", "http-shutdown": "^1.2.2", - "jiti": "^1.21.0", - "mlly": "^1.6.1", + "jiti": "^2.1.2", + "mlly": "^1.7.1", "node-forge": "^1.3.1", "pathe": "^1.1.2", "std-env": "^3.7.0", - "ufo": "^1.4.0", + "ufo": "^1.5.4", "untun": "^0.1.3", "uqr": "^0.1.2" }, @@ -4176,9 +4159,9 @@ "peer": true }, "node_modules/lru-cache": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.0.tgz", - "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", + "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", "dev": true, "engines": { "node": "20 || >=22" @@ -4211,9 +4194,9 @@ } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "dependencies": { "braces": "^3.0.3", @@ -4255,21 +4238,21 @@ } }, "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, "dependencies": { - "mime-db": "1.52.0" + "mime-db": "~1.33.0" }, "engines": { "node": ">= 0.6" @@ -4324,15 +4307,15 @@ } }, "node_modules/mlly": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.1.tgz", - "integrity": "sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.2.tgz", + "integrity": "sha512-tN3dvVHYVz4DhSXinXIk7u9syPYaJvio118uomkovAtWBT+RdbP6Lfh/5Lvo519YMmwBafwlh20IPTXIStscpA==", "dev": true, "dependencies": { - "acorn": "^8.11.3", + "acorn": "^8.12.1", "pathe": "^1.1.2", - "pkg-types": "^1.1.1", - "ufo": "^1.5.3" + "pkg-types": "^1.2.0", + "ufo": "^1.5.4" } }, "node_modules/mri": { @@ -4374,26 +4357,6 @@ "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "dev": true }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/node-fetch-native": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz", @@ -4421,9 +4384,9 @@ } }, "node_modules/node-stdlib-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/node-stdlib-browser/-/node-stdlib-browser-1.2.0.tgz", - "integrity": "sha512-VSjFxUhRhkyed8AtLwSCkMrJRfQ3e2lGtG3sP6FEgaLKBBbxM/dLfjRe1+iLhjvyLFW3tBQ8+c0pcOtXGbAZJg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/node-stdlib-browser/-/node-stdlib-browser-1.2.1.tgz", + "integrity": "sha512-dZezG3D88Lg22DwyjsDuUs7cCT/XGr8WwJgg/S3ZnkcWuPet2Tt/W1d2Eytb1Z73JpZv+XVCDI5TWv6UMRq0Gg==", "dev": true, "dependencies": { "assert": "^2.0.0", @@ -4450,7 +4413,7 @@ "string_decoder": "^1.0.0", "timers-browserify": "^2.0.4", "tty-browserify": "0.0.1", - "url": "^0.11.0", + "url": "^0.11.4", "util": "^0.12.4", "vm-browserify": "^1.0.1" }, @@ -4571,20 +4534,20 @@ } }, "node_modules/ofetch": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.4.tgz", - "integrity": "sha512-KLIET85ik3vhEfS+3fDlc/BAZiAp+43QEC/yCo5zkNoY2YaKvNkOaFr/6wCFgFH1kuYQM5pMNi0Tg8koiIemtw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.4.1.tgz", + "integrity": "sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==", "dev": true, "dependencies": { "destr": "^2.0.3", - "node-fetch-native": "^1.6.3", - "ufo": "^1.5.3" + "node-fetch-native": "^1.6.4", + "ufo": "^1.5.4" } }, "node_modules/ohash": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.3.tgz", - "integrity": "sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.4.tgz", + "integrity": "sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==", "dev": true }, "node_modules/on-exit-leak-free": { @@ -4778,15 +4741,6 @@ "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==", "dev": true }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/pathe": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", @@ -4872,13 +4826,13 @@ } }, "node_modules/pkg-types": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.3.tgz", - "integrity": "sha512-+JrgthZG6m3ckicaOB74TwQ+tBWsFl3qVQg7mN8ulwSOElJ7gBhKzj2VkCPnZ4NlF6kEquYU+RIYNVAvzd54UA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.2.1.tgz", + "integrity": "sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==", "dev": true, "dependencies": { - "confbox": "^0.1.7", - "mlly": "^1.7.1", + "confbox": "^0.1.8", + "mlly": "^1.7.2", "pathe": "^1.1.2" } }, @@ -5015,13 +4969,12 @@ "dev": true }, "node_modules/qrcode": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.3.tgz", - "integrity": "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", "dev": true, "dependencies": { "dijkstrajs": "^1.0.1", - "encode-utf8": "^1.0.3", "pngjs": "^5.0.0", "yargs": "^15.3.1" }, @@ -5293,9 +5246,9 @@ ] }, "node_modules/safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", "dev": true, "engines": { "node": ">=10" @@ -5339,27 +5292,6 @@ "concat-map": "0.0.1" } }, - "node_modules/serve-handler/node_modules/mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/serve-handler/node_modules/mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "dev": true, - "dependencies": { - "mime-db": "~1.33.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/serve-handler/node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -5465,15 +5397,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/sonic-boom": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.8.0.tgz", @@ -5545,14 +5468,20 @@ } }, "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "dependencies": { - "safe-buffer": "~5.2.0" + "safe-buffer": "~5.1.0" } }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -5592,9 +5521,9 @@ "dev": true }, "node_modules/string-width/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, "engines": { "node": ">=12" @@ -5708,9 +5637,9 @@ } }, "node_modules/synckit/node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", "dev": true }, "node_modules/system-architecture": { @@ -5764,12 +5693,6 @@ "node": ">=8.0" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, "node_modules/ts-api-utils": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", @@ -5807,9 +5730,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5859,43 +5782,37 @@ "pathe": "^1.1.2" } }, - "node_modules/unfetch": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", - "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==", - "dev": true - }, "node_modules/unstorage": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.10.2.tgz", - "integrity": "sha512-cULBcwDqrS8UhlIysUJs2Dk0Mmt8h7B0E6mtR+relW9nZvsf/u4SkAYyNliPiPW7XtFNb5u3IUMkxGxFTTRTgQ==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.12.0.tgz", + "integrity": "sha512-ARZYTXiC+e8z3lRM7/qY9oyaOkaozCeNd2xoz7sYK9fv7OLGhVsf+BZbmASqiK/HTZ7T6eAlnVq9JynZppyk3w==", "dev": true, "dependencies": { "anymatch": "^3.1.3", "chokidar": "^3.6.0", "destr": "^2.0.3", - "h3": "^1.11.1", + "h3": "^1.12.0", "listhen": "^1.7.2", - "lru-cache": "^10.2.0", + "lru-cache": "^10.4.3", "mri": "^1.2.0", - "node-fetch-native": "^1.6.2", - "ofetch": "^1.3.3", - "ufo": "^1.4.0" + "node-fetch-native": "^1.6.4", + "ofetch": "^1.3.4", + "ufo": "^1.5.4" }, "peerDependencies": { - "@azure/app-configuration": "^1.5.0", - "@azure/cosmos": "^4.0.0", + "@azure/app-configuration": "^1.7.0", + "@azure/cosmos": "^4.1.1", "@azure/data-tables": "^13.2.2", - "@azure/identity": "^4.0.1", + "@azure/identity": "^4.4.1", "@azure/keyvault-secrets": "^4.8.0", - "@azure/storage-blob": "^12.17.0", - "@capacitor/preferences": "^5.0.7", + "@azure/storage-blob": "^12.24.0", + "@capacitor/preferences": "^6.0.2", "@netlify/blobs": "^6.5.0 || ^7.0.0", - "@planetscale/database": "^1.16.0", - "@upstash/redis": "^1.28.4", + "@planetscale/database": "^1.19.0", + "@upstash/redis": "^1.34.0", "@vercel/kv": "^1.0.1", "idb-keyval": "^6.2.1", - "ioredis": "^5.3.2" + "ioredis": "^5.4.1" }, "peerDependenciesMeta": { "@azure/app-configuration": { @@ -5984,19 +5901,22 @@ } }, "node_modules/url": { - "version": "0.11.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.3.tgz", - "integrity": "sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==", + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", "dev": true, "dependencies": { "punycode": "^1.4.1", - "qs": "^6.11.2" + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/url/node_modules/qs": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz", - "integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dev": true, "dependencies": { "side-channel": "^1.0.6" @@ -6033,22 +5953,6 @@ "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", "dev": true }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -6154,9 +6058,9 @@ } }, "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, "engines": { "node": ">=12" diff --git a/package.json b/package.json index 3b66109..0ec0a73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elven.js", - "version": "0.19.0", + "version": "0.20.0", "description": "Authenticate, sign and send transactions on the MultiversX blockchain in the browser.", "type": "module", "module": "build/elven.js", @@ -42,29 +42,30 @@ }, "devDependencies": { "@eslint/eslintrc": "3.1.0", - "@eslint/js": "9.8.0", - "@multiversx/sdk-core": "13.2.2", - "@multiversx/sdk-extension-provider": "3.0.0", - "@multiversx/sdk-native-auth-client": "1.0.8", - "@multiversx/sdk-network-providers": "2.4.3", - "@multiversx/sdk-wallet-connect-provider": "4.1.3", - "@multiversx/sdk-web-wallet-provider": "3.2.1", - "@multiversx/sdk-webview-provider": "0.0.11", + "@eslint/js": "9.12.0", + "@multiversx/sdk-core": "13.8.0", + "@multiversx/sdk-extension-provider": "4.0.0", + "@multiversx/sdk-native-auth-client": "1.0.9", + "@multiversx/sdk-wallet-connect-provider": "5.0.0", + "@multiversx/sdk-web-wallet-provider": "4.0.0", + "@multiversx/sdk-webview-provider": "2.0.0-alpha.0", "@types/qrcode": "1.5.5", "@types/serve-handler": "6.1.4", - "@typescript-eslint/eslint-plugin": "8.0.0", - "@typescript-eslint/parser": "8.0.0", - "bignumber.js": "9.1.2", - "esbuild": "0.23.0", - "eslint": "9.8.0", + "@typescript-eslint/eslint-plugin": "8.8.1", + "@typescript-eslint/parser": "8.8.1", + "esbuild": "0.24.0", + "eslint": "9.12.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", - "globals": "15.9.0", - "node-stdlib-browser": "1.2.0", + "globals": "15.11.0", + "node-stdlib-browser": "1.2.1", "prettier": "3.3.3", - "qrcode": "1.5.3", + "qrcode": "1.5.4", "rimraf": "6.0.1", "serve-handler": "6.1.5", - "typescript": "5.5.4" + "typescript": "5.6.3" + }, + "dependencies": { + "bignumber.js": "^9.1.2" } -} \ No newline at end of file +} diff --git a/src/auth/login-with-extension.ts b/src/auth/login-with-extension.ts index 1d41798..e4aec8f 100644 --- a/src/auth/login-with-extension.ts +++ b/src/auth/login-with-extension.ts @@ -39,9 +39,10 @@ export const loginWithExtension = async ( throw new Error('There were problems with auth provider initialization!'); } - const { signature } = dappProvider.account; + const account = dappProvider.getAccount(); ls.set('loginToken', loginToken); + const signature = account?.signature; if (signature) { ls.set('signature', signature); diff --git a/src/elven.ts b/src/elven.ts index 570ce89..cf71b66 100644 --- a/src/elven.ts +++ b/src/elven.ts @@ -25,7 +25,6 @@ export { Transaction } from '@multiversx/sdk-core/out/transaction'; export { TransactionComputer } from '@multiversx/sdk-core/out/transactionComputer'; export { Message, MessageComputer } from '@multiversx/sdk-core/out/message'; export { TransactionWatcher } from '@multiversx/sdk-core/out/transactionWatcher'; -export { SignableMessage } from '@multiversx/sdk-core/out/signableMessage'; export { BytesType, BytesValue, @@ -51,7 +50,7 @@ export { AddressValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/address'; export { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts/interface'; -export { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; +export { ContractQueryResponse } from '@multiversx/sdk-core/out/networkProviders/contractQueryResponse'; export { ElvenJS } from './main'; export { parseAmount, formatAmount } from './utils/amount'; diff --git a/src/main.ts b/src/main.ts index ed735aa..e77d8c6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,7 @@ import { ExtensionProvider } from '@multiversx/sdk-extension-provider/out/extens import { WalletConnectV2Provider } from '@multiversx/sdk-wallet-connect-provider/out/walletConnectV2Provider'; import { WalletProvider } from '@multiversx/sdk-web-wallet-provider/out/walletProvider'; import { NativeAuthClient } from '@multiversx/sdk-native-auth-client/lib/src/native.auth.client'; -import { SignableMessage } from '@multiversx/sdk-core/out/signableMessage'; +import { Message } from '@multiversx/sdk-core/out/message'; import { initMobileProvider } from './auth/init-mobile-provider'; import { ls } from './utils/ls-helpers'; import { ApiNetworkProvider, SmartContractQueryArgs } from './network-provider'; @@ -339,24 +339,30 @@ export class ElvenJS { if (this.dappProvider instanceof ExtensionProvider) { const signedMessage = await this.dappProvider.signMessage( - new SignableMessage({ message: Buffer.from(message) }) + new Message({ data: Buffer.from(message) }) ); - messageSignature = signedMessage.getSignature().toString('hex'); + messageSignature = Buffer.from(signedMessage?.signature || '').toString( + 'hex' + ); } if (this.dappProvider instanceof WalletConnectV2Provider) { const signedMessage = await this.dappProvider.signMessage( - new SignableMessage({ message: Buffer.from(message) }) + new Message({ data: Buffer.from(message) }) ); - messageSignature = signedMessage.getSignature().toString('hex'); + messageSignature = Buffer.from(signedMessage?.signature || '').toString( + 'hex' + ); } if (this.dappProvider instanceof WebviewProvider) { const signedMessage = await this.dappProvider.signMessage( - new SignableMessage({ message: Buffer.from(message) }) + new Message({ data: Buffer.from(message) }) ); - messageSignature = signedMessage?.getSignature().toString('hex') || ''; + messageSignature = Buffer.from(signedMessage?.signature || '').toString( + 'hex' + ); } if (this.dappProvider instanceof WalletProvider) { const encodeRFC3986URIComponent = (str: string) => { @@ -368,7 +374,7 @@ export class ElvenJS { const url = options?.callbackUrl || window.location.origin; await this.dappProvider.signMessage( - new SignableMessage({ message: Buffer.from(message) }), + new Message({ data: Buffer.from(message) }), { callbackUrl: encodeURIComponent( `${url}${ diff --git a/src/network-provider.ts b/src/network-provider.ts index 0795139..5647051 100644 --- a/src/network-provider.ts +++ b/src/network-provider.ts @@ -1,10 +1,10 @@ import { Address } from '@multiversx/sdk-core/out/address'; -import { TransactionStatus } from '@multiversx/sdk-network-providers/out/transactionStatus'; -import { TransactionReceipt } from '@multiversx/sdk-network-providers/out/transactionReceipt'; -import { TransactionLogs } from '@multiversx/sdk-network-providers/out/transactionLogs'; -import { ContractResults } from '@multiversx/sdk-network-providers/out/contractResults'; -import { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; -import { ContractQueryRequest } from '@multiversx/sdk-network-providers/out/contractQueryRequest'; +import { TransactionStatus } from '@multiversx/sdk-core/out/networkProviders/transactionStatus'; +import { TransactionReceipt } from '@multiversx/sdk-core/out/networkProviders/transactionReceipt'; +import { TransactionLogs } from '@multiversx/sdk-core/out/networkProviders/transactionLogs'; +import { ContractResults } from '@multiversx/sdk-core/out/networkProviders/contractResults'; +import { ContractQueryResponse } from '@multiversx/sdk-core/out/networkProviders/contractQueryResponse'; +import { ContractQueryRequest } from '@multiversx/sdk-core/out/networkProviders/contractQueryRequest'; import { Query } from '@multiversx/sdk-core/out/smartcontracts/query'; import { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts/interface'; import { networkConfig, defaultChainTypeConfig } from './utils/constants'; diff --git a/src/types.ts b/src/types.ts index b8f0738..61fb286 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,7 +4,7 @@ import { WalletConnectV2Provider } from '@multiversx/sdk-wallet-connect-provider import { WalletProvider } from '@multiversx/sdk-web-wallet-provider/out/walletProvider'; import { WebviewProvider } from '@multiversx/sdk-webview-provider'; import { QueryArguments } from '@multiversx/sdk-core/out/smartcontracts'; -import { ContractQueryResponse } from '@multiversx/sdk-network-providers/out/contractQueryResponse'; +import { ContractQueryResponse } from '@multiversx/sdk-core/out/networkProviders/contractQueryResponse'; export interface InitOptions { apiUrl?: string;