@ultrade/shared 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/common/auth.helper.js +1 -1
- package/dist/browser/common/index.js +1 -1
- package/dist/browser/helpers/Encoding.js +1 -1
- package/dist/browser/helpers/algo.helper.js +1 -1
- package/dist/browser/helpers/balance.helper.js +1 -1
- package/dist/browser/helpers/codex/common.helper.js +2 -2
- package/dist/browser/helpers/codex/index.js +2 -2
- package/dist/browser/helpers/codex/mbr.helper.js +1 -1
- package/dist/browser/helpers/codex/mna.helper.js +1 -1
- package/dist/browser/helpers/codex/order.helper.js +1 -1
- package/dist/browser/helpers/codex/setGlobal.helper.js +1 -1
- package/dist/browser/helpers/codex/transfer.helper.js +2 -2
- package/dist/browser/helpers/codex/txn.helper.js +1 -1
- package/dist/browser/helpers/codex.helper.js +6 -6
- package/dist/browser/helpers/eth.helper.js +2 -2
- package/dist/browser/helpers/index.js +1 -1
- package/dist/browser/helpers/pointSystem.helper.js +1 -1
- package/dist/browser/helpers/withdraw.helper.js +2 -2
- package/dist/browser/interfaces/index.js +1 -1
- package/dist/browser/types/index.js +1 -1
- package/dist/node/common/index.js +1 -1
- package/dist/node/helpers/Encoding.js +1 -1
- package/dist/node/helpers/algo.helper.js +1 -1
- package/dist/node/helpers/balance.helper.js +1 -1
- package/dist/node/helpers/codex/common.helper.js +2 -2
- package/dist/node/helpers/codex/index.js +2 -2
- package/dist/node/helpers/codex/mbr.helper.js +1 -1
- package/dist/node/helpers/codex/mna.helper.js +1 -1
- package/dist/node/helpers/codex/order.helper.js +1 -1
- package/dist/node/helpers/codex/setGlobal.helper.js +1 -1
- package/dist/node/helpers/codex/transfer.helper.js +2 -2
- package/dist/node/helpers/codex/txn.helper.js +1 -1
- package/dist/node/helpers/codex.helper.js +5 -5
- package/dist/node/helpers/eth.helper.js +2 -2
- package/dist/node/helpers/withdraw.helper.js +1 -1
- package/dist/node/types/index.js +1 -1
- package/dist/src/helpers/Encoding.d.ts +1 -0
- package/dist/src/interfaces/order.interface.d.ts +9 -1
- package/dist/src/interfaces/services/balances.interface.d.ts +1 -1
- package/dist/src/types/balance-result.types.d.ts +86 -0
- package/dist/src/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function hr(){throw new Error("setTimeout has not been defined")}function ar(){throw new Error("clearTimeout has not been defined")}var P=hr,D=ar;typeof globalThis.setTimeout=="function"&&(P=setTimeout);typeof globalThis.clearTimeout=="function"&&(D=clearTimeout);function cr(i){if(P===setTimeout)return setTimeout(i,0);if((P===hr||!P)&&setTimeout)return P=setTimeout,setTimeout(i,0);try{return P(i,0)}catch{try{return P.call(null,i,0)}catch{return P.call(this,i,0)}}}function Zr(i){if(D===clearTimeout)return clearTimeout(i);if((D===ar||!D)&&clearTimeout)return D=clearTimeout,clearTimeout(i);try{return D(i)}catch{try{return D.call(null,i)}catch{return D.call(this,i)}}}var B=[],N=!1,S,L=-1;function qr(){!N||!S||(N=!1,S.length?B=S.concat(B):L=-1,B.length&&sr())}function sr(){if(!N){var i=cr(qr);N=!0;for(var r=B.length;r;){for(S=B,B=[];++L<r;)S&&S[L].run();L=-1,r=B.length}S=null,N=!1,Zr(i)}}function jr(i){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];B.push(new pr(i,r)),B.length===1&&!N&&cr(sr)}function pr(i,r){this.fun=i,this.array=r}pr.prototype.run=function(){this.fun.apply(null,this.array)};var rn="browser",nn="browser",en=!0,tn={},un=[],on="",fn={},hn={},an={};function Y(){}var cn=Y,sn=Y,pn=Y,ln=Y,xn=Y,wn=Y,En=Y;function yn(i){throw new Error("process.binding is not supported")}function An(){return"/"}function gn(i){throw new Error("process.chdir is not supported")}function mn(){return 0}var M=globalThis.performance||{},Un=M.now||M.mozNow||M.msNow||M.oNow||M.webkitNow||function(){return new Date().getTime()};function In(i){var r=Un.call(M)*.001,n=Math.floor(r),e=Math.floor(r%1*1e9);return i&&(n=n-i[0],e=e-i[1],e<0&&(n--,e+=1e9)),[n,e]}var Rn=new Date;function Tn(){var i=new Date,r=i-Rn;return r/1e3}var $={nextTick:jr,title:rn,browser:en,env:tn,argv:un,version:on,versions:fn,on:cn,addListener:sn,once:pn,off:ln,removeListener:xn,removeAllListeners:wn,emit:En,binding:yn,cwd:An,chdir:gn,umask:mn,hrtime:In,platform:nn,release:hn,config:an,uptime:Tn},fr={};Object.keys(fr).forEach(i=>{let r=i.split("."),n=$;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=fr[i]:n=n[t]||(n[t]={})}});var R=[],U=[],_n=typeof Uint8Array<"u"?Uint8Array:Array,rr=!1;function Er(){rr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)R[r]=i[r],U[i.charCodeAt(r)]=r;U[45]=62,U[95]=63}function dn(i){rr||Er();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new _n(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=U[i.charCodeAt(r)]<<18|U[i.charCodeAt(r+1)]<<12|U[i.charCodeAt(r+2)]<<6|U[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=U[i.charCodeAt(r)]<<2|U[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=U[i.charCodeAt(r)]<<10|U[i.charCodeAt(r+1)]<<4|U[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function Bn(i){return R[i>>18&63]+R[i>>12&63]+R[i>>6&63]+R[i&63]}function Fn(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(Bn(e));return t.join("")}function lr(i){rr||Er();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(Fn(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=R[r>>2],t+=R[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=R[r>>10],t+=R[r>>4&63],t+=R[r<<2&63],t+="="),u.push(t),u.join("")}a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function W(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function F(i,r){if(W()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=a.prototype):(i===null&&(i=new a(r)),i.length=r),i}function a(i,r,n){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return nr(this,i)}return yr(this,i,r,n)}a.poolSize=8192;a._augment=function(i){return i.__proto__=a.prototype,i};function yr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Dn(i,r,n,e):typeof r=="string"?Pn(i,r,n):Sn(i,r)}a.from=function(i,r,n){return yr(null,i,r,n)};a.kMaxLength=W();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&a[Symbol.species]);function Ar(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function vn(i,r,n,e){return Ar(r),r<=0?F(i,r):n!==void 0?typeof e=="string"?F(i,r).fill(n,e):F(i,r).fill(n):F(i,r)}a.alloc=function(i,r,n){return vn(null,i,r,n)};function nr(i,r){if(Ar(r),i=F(i,r<0?0:ir(r)|0),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}a.allocUnsafe=function(i){return nr(null,i)};a.allocUnsafeSlow=function(i){return nr(null,i)};function Pn(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=gr(r,n)|0;i=F(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function j(i,r){var n=r.length<0?0:ir(r.length)|0;i=F(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function Dn(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),a.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=a.prototype):i=j(i,r),i}function Sn(i,r){if(T(r)){var n=ir(r.length)|0;return i=F(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Zn(r.length)?F(i,0):j(i,r);if(r.type==="Buffer"&&Array.isArray(r.data))return j(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ir(i){if(i>=W())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W().toString(16)+" bytes");return i|0}a.isBuffer=qn;function T(i){return!!(i!=null&&i._isBuffer)}a.compare=function(r,n){if(!T(r)||!T(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};a.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=a.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!T(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function gr(i,r){if(T(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return dr(i).length;default:if(e)return z(i).length;r=(""+r).toLowerCase(),e=!0}}a.byteLength=gr;function Yn(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return Vn(this,r,n);case"utf8":case"utf-8":return Ir(this,r,n);case"ascii":return zn(this,r,n);case"latin1":case"binary":return bn(this,r,n);case"base64":return $n(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hn(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}a.prototype._isBuffer=!0;function k(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}a.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)k(this,n,n+1);return this};a.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)k(this,n,n+3),k(this,n+1,n+2);return this};a.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)k(this,n,n+7),k(this,n+1,n+6),k(this,n+2,n+5),k(this,n+3,n+4);return this};a.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ir(this,0,r):Yn.apply(this,arguments)};a.prototype.equals=function(r){if(!T(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0};a.prototype.compare=function(r,n,e,t,u){if(!T(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function mr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,e)),T(r))return r.length===0?-1:xr(i,r,n,e,t);if(typeof r=="number")return r=r&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):xr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function xr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}a.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};a.prototype.indexOf=function(r,n,e){return mr(this,r,n,e,!0)};a.prototype.lastIndexOf=function(r,n,e){return mr(this,r,n,e,!1)};function kn(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function Cn(i,r,n,e){return H(z(r,i.length-n),i,n,e)}function Ur(i,r,n,e){return H(Kn(r),i,n,e)}function Mn(i,r,n,e){return Ur(i,r,n,e)}function Nn(i,r,n,e){return H(dr(r),i,n,e)}function Ln(i,r,n,e){return H(Qn(r,i.length-n),i,n,e)}a.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return kn(this,r,n,e);case"utf8":case"utf-8":return Cn(this,r,n,e);case"ascii":return Ur(this,r,n,e);case"latin1":case"binary":return Mn(this,r,n,e);case"base64":return Nn(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ln(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $n(i,r,n){return r===0&&n===i.length?lr(i):lr(i.slice(r,n))}function Ir(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return Wn(e)}var wr=4096;function Wn(i){var r=i.length;if(r<=wr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=wr));return n}function zn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function bn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function Vn(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=Xn(i[u]);return t}function Hn(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}a.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(a.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=a.prototype;else{var u=n-r;t=new a(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function E(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};a.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};a.prototype.readUInt8=function(r,n){return n||E(r,1,this.length),this[r]};a.prototype.readUInt16LE=function(r,n){return n||E(r,2,this.length),this[r]|this[r+1]<<8};a.prototype.readUInt16BE=function(r,n){return n||E(r,2,this.length),this[r]<<8|this[r+1]};a.prototype.readUInt32LE=function(r,n){return n||E(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};a.prototype.readUInt32BE=function(r,n){return n||E(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};a.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};a.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};a.prototype.readInt8=function(r,n){return n||E(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};a.prototype.readInt16LE=function(r,n){n||E(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};a.prototype.readInt16BE=function(r,n){n||E(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};a.prototype.readInt32LE=function(r,n){return n||E(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};a.prototype.readInt32BE=function(r,n){return n||E(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};a.prototype.readFloatLE=function(r,n){return n||E(r,4,this.length),O(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,n){return n||E(r,4,this.length),O(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,n){return n||E(r,8,this.length),O(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,n){return n||E(r,8,this.length),O(this,r,!1,52,8)};function A(i,r,n,e,t,u){if(!T(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};a.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};a.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,255,0),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function b(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}a.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};function V(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}a.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):V(this,r,n,!0),n+4};a.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};a.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,127,-128),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};a.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};a.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):V(this,r,n,!0),n+4};a.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};function Rr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Tr(i,r,n,e,t){return t||Rr(i,r,n,4,34028234663852886e22,-34028234663852886e22),Fr(i,r,n,e,23,4),n+4}a.prototype.writeFloatLE=function(r,n,e){return Tr(this,r,n,!0,e)};a.prototype.writeFloatBE=function(r,n,e){return Tr(this,r,n,!1,e)};function _r(i,r,n,e,t){return t||Rr(i,r,n,8,17976931348623157e292,-17976931348623157e292),Fr(i,r,n,e,52,8),n+8}a.prototype.writeDoubleLE=function(r,n,e){return _r(this,r,n,!0,e)};a.prototype.writeDoubleBE=function(r,n,e){return _r(this,r,n,!1,e)};a.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};a.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=T(r)?r:z(new a(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var On=/[^+\/0-9A-Za-z-_]/g;function Gn(i){if(i=Jn(i).replace(On,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Jn(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Xn(i){return i<16?"0"+i.toString(16):i.toString(16)}function z(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function Kn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Qn(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function dr(i){return dn(Gn(i))}function H(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Zn(i){return i!==i}function qn(i){return i!=null&&(!!i._isBuffer||Br(i)||jn(i))}function Br(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function jn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Br(i.slice(0,0))}function O(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Fr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}import Di,{decodeAddress as Si,encodeAddress as Yi}from"algosdk";var _=[],I=[],ri=typeof Uint8Array<"u"?Uint8Array:Array,tr=!1;function Sr(){tr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)_[r]=i[r],I[i.charCodeAt(r)]=r;I[45]=62,I[95]=63}function ni(i){tr||Sr();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new ri(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=I[i.charCodeAt(r)]<<18|I[i.charCodeAt(r+1)]<<12|I[i.charCodeAt(r+2)]<<6|I[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=I[i.charCodeAt(r)]<<2|I[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=I[i.charCodeAt(r)]<<10|I[i.charCodeAt(r+1)]<<4|I[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function ii(i){return _[i>>18&63]+_[i>>12&63]+_[i>>6&63]+_[i&63]}function ei(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(ii(e));return t.join("")}function vr(i){tr||Sr();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(ei(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=_[r>>2],t+=_[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=_[r>>10],t+=_[r>>4&63],t+=_[r<<2&63],t+="="),u.push(t),u.join("")}function X(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Yr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}var ti={}.toString,kr=Array.isArray||function(i){return ti.call(i)=="[object Array]"};var ui=50;h.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var bi=G();function G(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(i,r){if(G()<r)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=h.prototype):(i===null&&(i=new h(r)),i.length=r),i}function h(i,r,n){if(!h.TYPED_ARRAY_SUPPORT&&!(this instanceof h))return new h(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ur(this,i)}return Cr(this,i,r,n)}h.poolSize=8192;h._augment=function(i){return i.__proto__=h.prototype,i};function Cr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?hi(i,r,n,e):typeof r=="string"?fi(i,r,n):ai(i,r)}h.from=function(i,r,n){return Cr(null,i,r,n)};h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function Mr(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function oi(i,r,n,e){return Mr(r),r<=0?v(i,r):n!==void 0?typeof e=="string"?v(i,r).fill(n,e):v(i,r).fill(n):v(i,r)}h.alloc=function(i,r,n){return oi(null,i,r,n)};function ur(i,r){if(Mr(r),i=v(i,r<0?0:or(r)|0),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}h.allocUnsafe=function(i){return ur(null,i)};h.allocUnsafeSlow=function(i){return ur(null,i)};function fi(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!h.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=Nr(r,n)|0;i=v(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function er(i,r){var n=r.length<0?0:or(r.length)|0;i=v(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function hi(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),h.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=h.prototype):i=er(i,r),i}function ai(i,r){if(d(r)){var n=or(r.length)|0;return i=v(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Fi(r.length)?v(i,0):er(i,r);if(r.type==="Buffer"&&kr(r.data))return er(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function or(i){if(i>=G())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G().toString(16)+" bytes");return i|0}h.isBuffer=vi;function d(i){return!!(i!=null&&i._isBuffer)}h.compare=function(r,n){if(!d(r)||!d(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};h.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};h.concat=function(r,n){if(!kr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return h.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=h.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!d(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function Nr(i,r){if(d(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Hr(i).length;default:if(e)return J(i).length;r=(""+r).toLowerCase(),e=!0}}h.byteLength=Nr;function ci(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return mi(this,r,n);case"utf8":case"utf-8":return Wr(this,r,n);case"ascii":return Ai(this,r,n);case"latin1":case"binary":return gi(this,r,n);case"base64":return Ei(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ui(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}h.prototype._isBuffer=!0;function C(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}h.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)C(this,n,n+1);return this};h.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)C(this,n,n+3),C(this,n+1,n+2);return this};h.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)C(this,n,n+7),C(this,n+1,n+6),C(this,n+2,n+5),C(this,n+3,n+4);return this};h.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Wr(this,0,r):ci.apply(this,arguments)};h.prototype.equals=function(r){if(!d(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:h.compare(this,r)===0};h.prototype.inspect=function(){var r="",n=ui;return this.length>0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),"<Buffer "+r+">"};h.prototype.compare=function(r,n,e,t,u){if(!d(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function Lr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=h.from(r,e)),d(r))return r.length===0?-1:Pr(i,r,n,e,t);if(typeof r=="number")return r=r&255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):Pr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Pr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}h.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};h.prototype.indexOf=function(r,n,e){return Lr(this,r,n,e,!0)};h.prototype.lastIndexOf=function(r,n,e){return Lr(this,r,n,e,!1)};function si(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function pi(i,r,n,e){return Z(J(r,i.length-n),i,n,e)}function $r(i,r,n,e){return Z(di(r),i,n,e)}function li(i,r,n,e){return $r(i,r,n,e)}function xi(i,r,n,e){return Z(Hr(r),i,n,e)}function wi(i,r,n,e){return Z(Bi(r,i.length-n),i,n,e)}h.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return si(this,r,n,e);case"utf8":case"utf-8":return pi(this,r,n,e);case"ascii":return $r(this,r,n,e);case"latin1":case"binary":return li(this,r,n,e);case"base64":return xi(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wi(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ei(i,r,n){return r===0&&n===i.length?vr(i):vr(i.slice(r,n))}function Wr(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return yi(e)}var Dr=4096;function yi(i){var r=i.length;if(r<=Dr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=Dr));return n}function Ai(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function gi(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function mi(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=_i(i[u]);return t}function Ui(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}h.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(h.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=h.prototype;else{var u=n-r;t=new h(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function y(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};h.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};h.prototype.readUInt8=function(r,n){return n||y(r,1,this.length),this[r]};h.prototype.readUInt16LE=function(r,n){return n||y(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUInt16BE=function(r,n){return n||y(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUInt32LE=function(r,n){return n||y(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};h.prototype.readUInt32BE=function(r,n){return n||y(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};h.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};h.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};h.prototype.readInt8=function(r,n){return n||y(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,n){n||y(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};h.prototype.readInt16BE=function(r,n){n||y(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};h.prototype.readInt32LE=function(r,n){return n||y(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};h.prototype.readInt32BE=function(r,n){return n||y(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};h.prototype.readFloatLE=function(r,n){return n||y(r,4,this.length),X(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,n){return n||y(r,4,this.length),X(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,n){return n||y(r,8,this.length),X(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,n){return n||y(r,8,this.length),X(this,r,!1,52,8)};function g(i,r,n,e,t,u){if(!d(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};h.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};h.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,255,0),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function K(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}h.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};function Q(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}h.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):Q(this,r,n,!0),n+4};h.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};h.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,127,-128),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};h.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};h.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):Q(this,r,n,!0),n+4};h.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};function zr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function br(i,r,n,e,t){return t||zr(i,r,n,4),Yr(i,r,n,e,23,4),n+4}h.prototype.writeFloatLE=function(r,n,e){return br(this,r,n,!0,e)};h.prototype.writeFloatBE=function(r,n,e){return br(this,r,n,!1,e)};function Vr(i,r,n,e,t){return t||zr(i,r,n,8),Yr(i,r,n,e,52,8),n+8}h.prototype.writeDoubleLE=function(r,n,e){return Vr(this,r,n,!0,e)};h.prototype.writeDoubleBE=function(r,n,e){return Vr(this,r,n,!1,e)};h.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!h.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};h.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!h.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=d(r)?r:J(new h(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var Ii=/[^+\/0-9A-Za-z-_]/g;function Ri(i){if(i=Ti(i).replace(Ii,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Ti(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function _i(i){return i<16?"0"+i.toString(16):i.toString(16)}function J(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function di(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Bi(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function Hr(i){return ni(Ri(i))}function Z(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Fi(i){return i!==i}function vi(i){return i!=null&&(!!i._isBuffer||Or(i)||Pi(i))}function Or(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Pi(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Or(i.slice(0,0))}import{encodeAddress as he,decodeAddress as ae}from"algosdk";function Jr(i){return i.reduce((r,n)=>Uint8Array.from([...r,...n]))}function Xi(i,r){let n=[];for(let[e,t]of Object.entries(r)){let u=i[e];if(u===void 0)throw new Error(`Key ${e} missing from value`);switch(t.type){case"address":if(u instanceof Uint8Array&&u.length==32){n.push(u);break}else if(typeof u=="string")n.push(Si(u).publicKey);else throw new Error(`${e}: Expected address, got ${u}`);break;case"bytes":if(u instanceof Uint8Array)if(u.length==t.size){n.push(u);break}else throw new Error(`${e}: Bytes length is wrong, expected ${t.size}, got ${u.length}`);else throw new Error(`${e}: Expected bytes[${t.size}], got ${u}`);case"double":if(typeof u=="number"){let o=new ArrayBuffer(8);h.from(o).writeDoubleLE(u,0),n.push(new Uint8Array(o));break}else throw new Error(`${e}: Expected double, got ${u}`);case"number":case"uint":if(typeof u=="bigint"||typeof u=="number"){n.push(Kr(u));break}else throw new Error(`${e}: Expected uint or number, got ${u}`);case"string":if(typeof u=="string"){let o=Xr(u);if(o.length==t.size){n.push(o);break}else throw new Error(`${e}: Expected string length ${t.size}, got string length ${o.length}`)}else throw new Error(`${e}: Expected string length ${t.size}, got ${u}`)}}return Jr(n)}function Ki(i,r){let n=new Map,e=0;for(let[t,u]of Object.entries(r)){if(e>=i.length)throw new Error("Array index out of bounds");let o;switch(u.type){case"address":o=Yi(i.slice(e,e+32)),e+=32;break;case"bytes":o=i.slice(e,e+u.size),e+=u.size;break;case"double":o=h.from(i.slice(e,e+8)).readDoubleLE(0),e+=8;break;case"number":o=Number(Gr(i.slice(e,e+8))),e+=8;break;case"uint":o=Gr(i.slice(e,e+8)),e+=8;break;case"string":o=ki(i.slice(e,e+u.size)),e+=u.size;break}n.set(t,o)}return Object.fromEntries(n)}function Qi(i){return i.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Xr(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),Kr(r)))}function Xr(i){return new Uint8Array(h.from(i))}function ki(i){return h.from(i).toString("utf-8")}function Zi(i){let r=Di.encodeUint64(i);return Jr([new Uint8Array(32-r.length),r])}function Kr(i){let r=h.alloc(8);for(let n=0;n<8;n++)r[7-n]=Number(BigInt(i)>>BigInt(n*8)&BigInt(255));return new Uint8Array(r)}function Gr(i){let r=BigInt(0);for(let n=0;n<8&&i?.length;n++)r=r<<BigInt(8)|BigInt(i[n]);return r}function qi(i){return h.from(i).toString("base64")}function Ci(i){return h.from(i,"base64")}function ji(i,r){return i.length===r.length&&i.reduce((n,e,t)=>n&&e===r[t],!0)}function Qr(i,r){let n=i["global-state-delta"].find(e=>e.key===r);if(n!==void 0)return n.value}function re(i,r){let n=Qr(i,r);if(n!==void 0)return BigInt(n.uint)}function ne(i,r){let n=Qr(i,r);if(n!==void 0)return Ci(n.bytes)}function ie(i){return Math.floor(i.getTime()/1e3)}function ee(i){return new Date(i*1e3)}export{ji as compareArrays,Jr as concatArrays,ae as decodeAddress,Ci as decodeBase64,ki as decodeString,Gr as decodeUint64,Zi as encode32Bytes,he as encodeAddress,Qi as encodeArgArray,qi as encodeBase64,Xr as encodeString,Kr as encodeUint64,ee as fromUnix,ne as getDeltaBytes,re as getDeltaUint,Xi as packData,ie as toUnix,Ki as unpackData};
|
|
1
|
+
function hr(){throw new Error("setTimeout has not been defined")}function ar(){throw new Error("clearTimeout has not been defined")}var P=hr,D=ar;typeof globalThis.setTimeout=="function"&&(P=setTimeout);typeof globalThis.clearTimeout=="function"&&(D=clearTimeout);function cr(i){if(P===setTimeout)return setTimeout(i,0);if((P===hr||!P)&&setTimeout)return P=setTimeout,setTimeout(i,0);try{return P(i,0)}catch{try{return P.call(null,i,0)}catch{return P.call(this,i,0)}}}function Zr(i){if(D===clearTimeout)return clearTimeout(i);if((D===ar||!D)&&clearTimeout)return D=clearTimeout,clearTimeout(i);try{return D(i)}catch{try{return D.call(null,i)}catch{return D.call(this,i)}}}var B=[],N=!1,Y,L=-1;function qr(){!N||!Y||(N=!1,Y.length?B=Y.concat(B):L=-1,B.length&&sr())}function sr(){if(!N){var i=cr(qr);N=!0;for(var r=B.length;r;){for(Y=B,B=[];++L<r;)Y&&Y[L].run();L=-1,r=B.length}Y=null,N=!1,Zr(i)}}function jr(i){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];B.push(new pr(i,r)),B.length===1&&!N&&cr(sr)}function pr(i,r){this.fun=i,this.array=r}pr.prototype.run=function(){this.fun.apply(null,this.array)};var rn="browser",nn="browser",en=!0,tn={},un=[],on="",fn={},hn={},an={};function S(){}var cn=S,sn=S,pn=S,ln=S,xn=S,wn=S,En=S;function yn(i){throw new Error("process.binding is not supported")}function An(){return"/"}function gn(i){throw new Error("process.chdir is not supported")}function mn(){return 0}var M=globalThis.performance||{},Un=M.now||M.mozNow||M.msNow||M.oNow||M.webkitNow||function(){return new Date().getTime()};function In(i){var r=Un.call(M)*.001,n=Math.floor(r),e=Math.floor(r%1*1e9);return i&&(n=n-i[0],e=e-i[1],e<0&&(n--,e+=1e9)),[n,e]}var Rn=new Date;function Tn(){var i=new Date,r=i-Rn;return r/1e3}var $={nextTick:jr,title:rn,browser:en,env:tn,argv:un,version:on,versions:fn,on:cn,addListener:sn,once:pn,off:ln,removeListener:xn,removeAllListeners:wn,emit:En,binding:yn,cwd:An,chdir:gn,umask:mn,hrtime:In,platform:nn,release:hn,config:an,uptime:Tn},fr={};Object.keys(fr).forEach(i=>{let r=i.split("."),n=$;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=fr[i]:n=n[t]||(n[t]={})}});var R=[],U=[],_n=typeof Uint8Array<"u"?Uint8Array:Array,rr=!1;function Er(){rr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)R[r]=i[r],U[i.charCodeAt(r)]=r;U[45]=62,U[95]=63}function dn(i){rr||Er();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new _n(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=U[i.charCodeAt(r)]<<18|U[i.charCodeAt(r+1)]<<12|U[i.charCodeAt(r+2)]<<6|U[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=U[i.charCodeAt(r)]<<2|U[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=U[i.charCodeAt(r)]<<10|U[i.charCodeAt(r+1)]<<4|U[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function Bn(i){return R[i>>18&63]+R[i>>12&63]+R[i>>6&63]+R[i&63]}function Fn(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(Bn(e));return t.join("")}function lr(i){rr||Er();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(Fn(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=R[r>>2],t+=R[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=R[r>>10],t+=R[r>>4&63],t+=R[r<<2&63],t+="="),u.push(t),u.join("")}a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function W(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function F(i,r){if(W()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=a.prototype):(i===null&&(i=new a(r)),i.length=r),i}function a(i,r,n){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return nr(this,i)}return yr(this,i,r,n)}a.poolSize=8192;a._augment=function(i){return i.__proto__=a.prototype,i};function yr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Dn(i,r,n,e):typeof r=="string"?Pn(i,r,n):Yn(i,r)}a.from=function(i,r,n){return yr(null,i,r,n)};a.kMaxLength=W();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&a[Symbol.species]);function Ar(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function vn(i,r,n,e){return Ar(r),r<=0?F(i,r):n!==void 0?typeof e=="string"?F(i,r).fill(n,e):F(i,r).fill(n):F(i,r)}a.alloc=function(i,r,n){return vn(null,i,r,n)};function nr(i,r){if(Ar(r),i=F(i,r<0?0:ir(r)|0),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}a.allocUnsafe=function(i){return nr(null,i)};a.allocUnsafeSlow=function(i){return nr(null,i)};function Pn(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=gr(r,n)|0;i=F(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function j(i,r){var n=r.length<0?0:ir(r.length)|0;i=F(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function Dn(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),a.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=a.prototype):i=j(i,r),i}function Yn(i,r){if(T(r)){var n=ir(r.length)|0;return i=F(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Zn(r.length)?F(i,0):j(i,r);if(r.type==="Buffer"&&Array.isArray(r.data))return j(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ir(i){if(i>=W())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W().toString(16)+" bytes");return i|0}a.isBuffer=qn;function T(i){return!!(i!=null&&i._isBuffer)}a.compare=function(r,n){if(!T(r)||!T(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};a.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=a.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!T(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function gr(i,r){if(T(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return dr(i).length;default:if(e)return z(i).length;r=(""+r).toLowerCase(),e=!0}}a.byteLength=gr;function Sn(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return Vn(this,r,n);case"utf8":case"utf-8":return Ir(this,r,n);case"ascii":return zn(this,r,n);case"latin1":case"binary":return bn(this,r,n);case"base64":return $n(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hn(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}a.prototype._isBuffer=!0;function k(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}a.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)k(this,n,n+1);return this};a.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)k(this,n,n+3),k(this,n+1,n+2);return this};a.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)k(this,n,n+7),k(this,n+1,n+6),k(this,n+2,n+5),k(this,n+3,n+4);return this};a.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ir(this,0,r):Sn.apply(this,arguments)};a.prototype.equals=function(r){if(!T(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0};a.prototype.compare=function(r,n,e,t,u){if(!T(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function mr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,e)),T(r))return r.length===0?-1:xr(i,r,n,e,t);if(typeof r=="number")return r=r&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):xr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function xr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}a.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};a.prototype.indexOf=function(r,n,e){return mr(this,r,n,e,!0)};a.prototype.lastIndexOf=function(r,n,e){return mr(this,r,n,e,!1)};function kn(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function Cn(i,r,n,e){return H(z(r,i.length-n),i,n,e)}function Ur(i,r,n,e){return H(Kn(r),i,n,e)}function Mn(i,r,n,e){return Ur(i,r,n,e)}function Nn(i,r,n,e){return H(dr(r),i,n,e)}function Ln(i,r,n,e){return H(Qn(r,i.length-n),i,n,e)}a.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return kn(this,r,n,e);case"utf8":case"utf-8":return Cn(this,r,n,e);case"ascii":return Ur(this,r,n,e);case"latin1":case"binary":return Mn(this,r,n,e);case"base64":return Nn(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ln(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $n(i,r,n){return r===0&&n===i.length?lr(i):lr(i.slice(r,n))}function Ir(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return Wn(e)}var wr=4096;function Wn(i){var r=i.length;if(r<=wr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=wr));return n}function zn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function bn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function Vn(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=Xn(i[u]);return t}function Hn(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}a.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(a.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=a.prototype;else{var u=n-r;t=new a(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function E(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};a.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};a.prototype.readUInt8=function(r,n){return n||E(r,1,this.length),this[r]};a.prototype.readUInt16LE=function(r,n){return n||E(r,2,this.length),this[r]|this[r+1]<<8};a.prototype.readUInt16BE=function(r,n){return n||E(r,2,this.length),this[r]<<8|this[r+1]};a.prototype.readUInt32LE=function(r,n){return n||E(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};a.prototype.readUInt32BE=function(r,n){return n||E(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};a.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};a.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};a.prototype.readInt8=function(r,n){return n||E(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};a.prototype.readInt16LE=function(r,n){n||E(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};a.prototype.readInt16BE=function(r,n){n||E(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};a.prototype.readInt32LE=function(r,n){return n||E(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};a.prototype.readInt32BE=function(r,n){return n||E(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};a.prototype.readFloatLE=function(r,n){return n||E(r,4,this.length),O(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,n){return n||E(r,4,this.length),O(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,n){return n||E(r,8,this.length),O(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,n){return n||E(r,8,this.length),O(this,r,!1,52,8)};function A(i,r,n,e,t,u){if(!T(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};a.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};a.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,255,0),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function b(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}a.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};function V(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}a.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):V(this,r,n,!0),n+4};a.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};a.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,127,-128),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};a.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};a.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):V(this,r,n,!0),n+4};a.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};function Rr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Tr(i,r,n,e,t){return t||Rr(i,r,n,4,34028234663852886e22,-34028234663852886e22),Fr(i,r,n,e,23,4),n+4}a.prototype.writeFloatLE=function(r,n,e){return Tr(this,r,n,!0,e)};a.prototype.writeFloatBE=function(r,n,e){return Tr(this,r,n,!1,e)};function _r(i,r,n,e,t){return t||Rr(i,r,n,8,17976931348623157e292,-17976931348623157e292),Fr(i,r,n,e,52,8),n+8}a.prototype.writeDoubleLE=function(r,n,e){return _r(this,r,n,!0,e)};a.prototype.writeDoubleBE=function(r,n,e){return _r(this,r,n,!1,e)};a.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};a.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=T(r)?r:z(new a(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var On=/[^+\/0-9A-Za-z-_]/g;function Gn(i){if(i=Jn(i).replace(On,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Jn(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Xn(i){return i<16?"0"+i.toString(16):i.toString(16)}function z(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function Kn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Qn(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function dr(i){return dn(Gn(i))}function H(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Zn(i){return i!==i}function qn(i){return i!=null&&(!!i._isBuffer||Br(i)||jn(i))}function Br(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function jn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Br(i.slice(0,0))}function O(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Fr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}import Di,{decodeAddress as Yi,encodeAddress as Si}from"algosdk";var _=[],I=[],ri=typeof Uint8Array<"u"?Uint8Array:Array,tr=!1;function Yr(){tr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)_[r]=i[r],I[i.charCodeAt(r)]=r;I[45]=62,I[95]=63}function ni(i){tr||Yr();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new ri(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=I[i.charCodeAt(r)]<<18|I[i.charCodeAt(r+1)]<<12|I[i.charCodeAt(r+2)]<<6|I[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=I[i.charCodeAt(r)]<<2|I[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=I[i.charCodeAt(r)]<<10|I[i.charCodeAt(r+1)]<<4|I[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function ii(i){return _[i>>18&63]+_[i>>12&63]+_[i>>6&63]+_[i&63]}function ei(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(ii(e));return t.join("")}function vr(i){tr||Yr();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(ei(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=_[r>>2],t+=_[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=_[r>>10],t+=_[r>>4&63],t+=_[r<<2&63],t+="="),u.push(t),u.join("")}function X(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Sr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}var ti={}.toString,kr=Array.isArray||function(i){return ti.call(i)=="[object Array]"};var ui=50;h.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var bi=G();function G(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(i,r){if(G()<r)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=h.prototype):(i===null&&(i=new h(r)),i.length=r),i}function h(i,r,n){if(!h.TYPED_ARRAY_SUPPORT&&!(this instanceof h))return new h(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ur(this,i)}return Cr(this,i,r,n)}h.poolSize=8192;h._augment=function(i){return i.__proto__=h.prototype,i};function Cr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?hi(i,r,n,e):typeof r=="string"?fi(i,r,n):ai(i,r)}h.from=function(i,r,n){return Cr(null,i,r,n)};h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function Mr(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function oi(i,r,n,e){return Mr(r),r<=0?v(i,r):n!==void 0?typeof e=="string"?v(i,r).fill(n,e):v(i,r).fill(n):v(i,r)}h.alloc=function(i,r,n){return oi(null,i,r,n)};function ur(i,r){if(Mr(r),i=v(i,r<0?0:or(r)|0),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}h.allocUnsafe=function(i){return ur(null,i)};h.allocUnsafeSlow=function(i){return ur(null,i)};function fi(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!h.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=Nr(r,n)|0;i=v(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function er(i,r){var n=r.length<0?0:or(r.length)|0;i=v(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function hi(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),h.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=h.prototype):i=er(i,r),i}function ai(i,r){if(d(r)){var n=or(r.length)|0;return i=v(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Fi(r.length)?v(i,0):er(i,r);if(r.type==="Buffer"&&kr(r.data))return er(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function or(i){if(i>=G())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G().toString(16)+" bytes");return i|0}h.isBuffer=vi;function d(i){return!!(i!=null&&i._isBuffer)}h.compare=function(r,n){if(!d(r)||!d(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};h.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};h.concat=function(r,n){if(!kr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return h.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=h.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!d(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function Nr(i,r){if(d(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Hr(i).length;default:if(e)return J(i).length;r=(""+r).toLowerCase(),e=!0}}h.byteLength=Nr;function ci(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return mi(this,r,n);case"utf8":case"utf-8":return Wr(this,r,n);case"ascii":return Ai(this,r,n);case"latin1":case"binary":return gi(this,r,n);case"base64":return Ei(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ui(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}h.prototype._isBuffer=!0;function C(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}h.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)C(this,n,n+1);return this};h.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)C(this,n,n+3),C(this,n+1,n+2);return this};h.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)C(this,n,n+7),C(this,n+1,n+6),C(this,n+2,n+5),C(this,n+3,n+4);return this};h.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Wr(this,0,r):ci.apply(this,arguments)};h.prototype.equals=function(r){if(!d(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:h.compare(this,r)===0};h.prototype.inspect=function(){var r="",n=ui;return this.length>0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),"<Buffer "+r+">"};h.prototype.compare=function(r,n,e,t,u){if(!d(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function Lr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=h.from(r,e)),d(r))return r.length===0?-1:Pr(i,r,n,e,t);if(typeof r=="number")return r=r&255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):Pr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Pr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}h.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};h.prototype.indexOf=function(r,n,e){return Lr(this,r,n,e,!0)};h.prototype.lastIndexOf=function(r,n,e){return Lr(this,r,n,e,!1)};function si(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function pi(i,r,n,e){return Z(J(r,i.length-n),i,n,e)}function $r(i,r,n,e){return Z(di(r),i,n,e)}function li(i,r,n,e){return $r(i,r,n,e)}function xi(i,r,n,e){return Z(Hr(r),i,n,e)}function wi(i,r,n,e){return Z(Bi(r,i.length-n),i,n,e)}h.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return si(this,r,n,e);case"utf8":case"utf-8":return pi(this,r,n,e);case"ascii":return $r(this,r,n,e);case"latin1":case"binary":return li(this,r,n,e);case"base64":return xi(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wi(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ei(i,r,n){return r===0&&n===i.length?vr(i):vr(i.slice(r,n))}function Wr(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return yi(e)}var Dr=4096;function yi(i){var r=i.length;if(r<=Dr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=Dr));return n}function Ai(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function gi(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function mi(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=_i(i[u]);return t}function Ui(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}h.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(h.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=h.prototype;else{var u=n-r;t=new h(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function y(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};h.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};h.prototype.readUInt8=function(r,n){return n||y(r,1,this.length),this[r]};h.prototype.readUInt16LE=function(r,n){return n||y(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUInt16BE=function(r,n){return n||y(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUInt32LE=function(r,n){return n||y(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};h.prototype.readUInt32BE=function(r,n){return n||y(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};h.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};h.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};h.prototype.readInt8=function(r,n){return n||y(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,n){n||y(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};h.prototype.readInt16BE=function(r,n){n||y(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};h.prototype.readInt32LE=function(r,n){return n||y(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};h.prototype.readInt32BE=function(r,n){return n||y(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};h.prototype.readFloatLE=function(r,n){return n||y(r,4,this.length),X(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,n){return n||y(r,4,this.length),X(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,n){return n||y(r,8,this.length),X(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,n){return n||y(r,8,this.length),X(this,r,!1,52,8)};function g(i,r,n,e,t,u){if(!d(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};h.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};h.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,255,0),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function K(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}h.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};function Q(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}h.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):Q(this,r,n,!0),n+4};h.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};h.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,127,-128),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};h.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};h.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):Q(this,r,n,!0),n+4};h.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};function zr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function br(i,r,n,e,t){return t||zr(i,r,n,4),Sr(i,r,n,e,23,4),n+4}h.prototype.writeFloatLE=function(r,n,e){return br(this,r,n,!0,e)};h.prototype.writeFloatBE=function(r,n,e){return br(this,r,n,!1,e)};function Vr(i,r,n,e,t){return t||zr(i,r,n,8),Sr(i,r,n,e,52,8),n+8}h.prototype.writeDoubleLE=function(r,n,e){return Vr(this,r,n,!0,e)};h.prototype.writeDoubleBE=function(r,n,e){return Vr(this,r,n,!1,e)};h.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!h.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};h.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!h.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=d(r)?r:J(new h(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var Ii=/[^+\/0-9A-Za-z-_]/g;function Ri(i){if(i=Ti(i).replace(Ii,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Ti(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function _i(i){return i<16?"0"+i.toString(16):i.toString(16)}function J(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function di(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Bi(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function Hr(i){return ni(Ri(i))}function Z(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Fi(i){return i!==i}function vi(i){return i!=null&&(!!i._isBuffer||Or(i)||Pi(i))}function Or(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Pi(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Or(i.slice(0,0))}import{encodeAddress as ae,decodeAddress as ce}from"algosdk";function Jr(i){return i.reduce((r,n)=>Uint8Array.from([...r,...n]))}function Xi(i,r){let n=[];for(let[e,t]of Object.entries(r)){let u=i[e];if(u===void 0)throw new Error(`Key ${e} missing from value`);switch(t.type){case"address":if(u instanceof Uint8Array&&u.length==32){n.push(u);break}else if(typeof u=="string")n.push(Yi(u).publicKey);else throw new Error(`${e}: Expected address, got ${u}`);break;case"bytes":if(u instanceof Uint8Array)if(u.length==t.size){n.push(u);break}else throw new Error(`${e}: Bytes length is wrong, expected ${t.size}, got ${u.length}`);else throw new Error(`${e}: Expected bytes[${t.size}], got ${u}`);case"double":if(typeof u=="number"){let o=new ArrayBuffer(8);h.from(o).writeDoubleLE(u,0),n.push(new Uint8Array(o));break}else throw new Error(`${e}: Expected double, got ${u}`);case"number":case"uint":if(typeof u=="bigint"||typeof u=="number"){n.push(Kr(u));break}else throw new Error(`${e}: Expected uint or number, got ${u}`);case"string":if(typeof u=="string"){let o=Xr(u);if(o.length==t.size){n.push(o);break}else throw new Error(`${e}: Expected string length ${t.size}, got string length ${o.length}`)}else throw new Error(`${e}: Expected string length ${t.size}, got ${u}`)}}return Jr(n)}function Ki(i,r){let n=new Map,e=0;for(let[t,u]of Object.entries(r)){if(e>=i.length)throw new Error("Array index out of bounds");let o;switch(u.type){case"address":o=Si(i.slice(e,e+32)),e+=32;break;case"bytes":o=i.slice(e,e+u.size),e+=u.size;break;case"double":o=h.from(i.slice(e,e+8)).readDoubleLE(0),e+=8;break;case"number":o=Number(Gr(i.slice(e,e+8))),e+=8;break;case"uint":o=Gr(i.slice(e,e+8)),e+=8;break;case"string":o=ki(i.slice(e,e+u.size)),e+=u.size;break}n.set(t,o)}return Object.fromEntries(n)}function Qi(i){return i.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Xr(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),Kr(r)))}function Xr(i){return new Uint8Array(h.from(i))}function ki(i){return h.from(i).toString("utf-8")}function Zi(i){let r=Di.encodeUint64(i);return Jr([new Uint8Array(32-r.length),r])}function Kr(i){let r=h.alloc(8);for(let n=0;n<8;n++)r[7-n]=Number(BigInt(i)>>BigInt(n*8)&BigInt(255));return new Uint8Array(r)}function Gr(i){let r=BigInt(0);for(let n=0;n<8&&i?.length;n++)r=r<<BigInt(8)|BigInt(i[n]);return r}function qi(i){return h.from(i).toString("base64")}function Ci(i){return h.from(i,"base64")}var ji=i=>{let r=i.startsWith("0x")?i.slice(2):i;if(r.length%2!==0)throw new Error("Invalid hex string");let n=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)n[e/2]=parseInt(r.substring(e,e+2),16);return n};function re(i,r){return i.length===r.length&&i.reduce((n,e,t)=>n&&e===r[t],!0)}function Qr(i,r){let n=i["global-state-delta"].find(e=>e.key===r);if(n!==void 0)return n.value}function ne(i,r){let n=Qr(i,r);if(n!==void 0)return BigInt(n.uint)}function ie(i,r){let n=Qr(i,r);if(n!==void 0)return Ci(n.bytes)}function ee(i){return Math.floor(i.getTime()/1e3)}function te(i){return new Date(i*1e3)}export{re as compareArrays,Jr as concatArrays,ce as decodeAddress,Ci as decodeBase64,ki as decodeString,Gr as decodeUint64,Zi as encode32Bytes,ae as encodeAddress,Qi as encodeArgArray,qi as encodeBase64,Xr as encodeString,Kr as encodeUint64,te as fromUnix,ie as getDeltaBytes,ne as getDeltaUint,ji as hexToUint8Array,Xi as packData,ee as toUnix,Ki as unpackData};
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function fr(){throw new Error("setTimeout has not been defined")}function lr(){throw new Error("clearTimeout has not been defined")}var B=fr,P=lr;typeof globalThis.setTimeout=="function"&&(B=setTimeout);typeof globalThis.clearTimeout=="function"&&(P=clearTimeout);function pr(t){if(B===setTimeout)return setTimeout(t,0);if((B===fr||!B)&&setTimeout)return B=setTimeout,setTimeout(t,0);try{return B(t,0)}catch{try{return B.call(null,t,0)}catch{return B.call(this,t,0)}}}function jr(t){if(P===clearTimeout)return clearTimeout(t);if((P===lr||!P)&&clearTimeout)return P=clearTimeout,clearTimeout(t);try{return P(t)}catch{try{return P.call(null,t)}catch{return P.call(this,t)}}}var k=[],O=!1,v,L=-1;function re(){!O||!v||(O=!1,v.length?k=v.concat(k):L=-1,k.length&&hr())}function hr(){if(!O){var t=pr(re);O=!0;for(var r=k.length;r;){for(v=k,k=[];++L<r;)v&&v[L].run();L=-1,r=k.length}v=null,O=!1,jr(t)}}function ee(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];k.push(new mr(t,r)),k.length===1&&!O&&pr(hr)}function mr(t,r){this.fun=t,this.array=r}mr.prototype.run=function(){this.fun.apply(null,this.array)};var te="browser",ne="browser",ie=!0,oe={},ae=[],ue="",se={},ce={},fe={};function D(){}var le=D,pe=D,he=D,me=D,ge=D,xe=D,de=D;function be(t){throw new Error("process.binding is not supported")}function Ee(){return"/"}function we(t){throw new Error("process.chdir is not supported")}function Te(){return 0}var F=globalThis.performance||{},ye=F.now||F.mozNow||F.msNow||F.oNow||F.webkitNow||function(){return new Date().getTime()};function _e(t){var r=ye.call(F)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var Ae=new Date;function Ie(){var t=new Date,r=t-Ae;return r/1e3}var x={nextTick:ee,title:te,browser:ie,env:oe,argv:ae,version:ue,versions:se,on:le,addListener:pe,once:he,off:me,removeListener:ge,removeAllListeners:xe,emit:de,binding:be,cwd:Ee,chdir:we,umask:Te,hrtime:_e,platform:ne,release:ce,config:fe,uptime:Ie},cr={};Object.keys(cr).forEach(t=>{let r=t.split("."),e=x;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=cr[t]:e=e[i]||(e[i]={})}});var A=[],y=[],Re=typeof Uint8Array<"u"?Uint8Array:Array,er=!1;function br(){er=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)A[r]=t[r],y[t.charCodeAt(r)]=r;y[45]=62,y[95]=63}function Se(t){er||br();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new Re(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=y[t.charCodeAt(r)]<<18|y[t.charCodeAt(r+1)]<<12|y[t.charCodeAt(r+2)]<<6|y[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=y[t.charCodeAt(r)]<<2|y[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=y[t.charCodeAt(r)]<<10|y[t.charCodeAt(r+1)]<<4|y[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function ke(t){return A[t>>18&63]+A[t>>12&63]+A[t>>6&63]+A[t&63]}function Ue(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(ke(n));return i.join("")}function gr(t){er||br();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(Ue(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=A[r>>2],i+=A[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=A[r>>10],i+=A[r>>4&63],i+=A[r<<2&63],i+="="),o.push(i),o.join("")}u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function Y(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(t,r){if(Y()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return tr(this,t)}return Er(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Er(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Pe(t,r,e,n):typeof r=="string"?Be(t,r,e):ve(t,r)}u.from=function(t,r,e){return Er(null,t,r,e)};u.kMaxLength=Y();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function wr(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ne(t,r,e,n){return wr(r),r<=0?U(t,r):e!==void 0?typeof n=="string"?U(t,r).fill(e,n):U(t,r).fill(e):U(t,r)}u.alloc=function(t,r,e){return Ne(null,t,r,e)};function tr(t,r){if(wr(r),t=U(t,r<0?0:nr(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return tr(null,t)};u.allocUnsafeSlow=function(t){return tr(null,t)};function Be(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Tr(r,e)|0;t=U(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function rr(t,r){var e=r.length<0?0:nr(r.length)|0;t=U(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Pe(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=rr(t,r),t}function ve(t,r){if(I(r)){var e=nr(r.length)|0;return t=U(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ze(r.length)?U(t,0):rr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return rr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function nr(t){if(t>=Y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y().toString(16)+" bytes");return t|0}u.isBuffer=je;function I(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!I(r)||!I(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};u.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=u.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!I(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Tr(t,r){if(I(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return kr(t).length;default:if(n)return W(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=Tr;function De(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ve(this,r,e);case"utf8":case"utf-8":return Ar(this,r,e);case"ascii":return Ge(this,r,e);case"latin1":case"binary":return He(this,r,e);case"base64":return Ye(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ke(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function C(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)C(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)C(this,e,e+3),C(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)C(this,e,e+7),C(this,e+1,e+6),C(this,e+2,e+5),C(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ar(this,0,r):De.apply(this,arguments)};u.prototype.equals=function(r){if(!I(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.compare=function(r,e,n,i,o){if(!I(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function yr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),I(r))return r.length===0?-1:xr(t,r,e,n,i);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):xr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function xr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(m,T){return o===1?m[T]:m.readUInt16BE(T*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,g=0;g<s;g++)if(f(t,p+g)!==f(r,g)){l=!1;break}if(l)return p}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return yr(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return yr(this,r,e,n,!1)};function Ce(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function Me(t,r,e,n){return V(W(r,t.length-e),t,e,n)}function _r(t,r,e,n){return V(Xe(r),t,e,n)}function Fe(t,r,e,n){return _r(t,r,e,n)}function Oe(t,r,e,n){return V(kr(r),t,e,n)}function Le(t,r,e,n){return V(Qe(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|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 o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ce(this,r,e,n);case"utf8":case"utf-8":return Me(this,r,e,n);case"ascii":return _r(this,r,e,n);case"latin1":case"binary":return Fe(this,r,e,n);case"base64":return Oe(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Le(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ye(t,r,e){return r===0&&e===t.length?gr(t):gr(t.slice(r,e))}function Ar(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return We(n)}var dr=4096;function We(t){var r=t.length;if(r<=dr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=dr));return e}function Ge(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function He(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function Ve(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Je(t[o]);return i}function Ke(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(u.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=u.prototype;else{var o=e-r;i=new u(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function d(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};u.prototype.readUInt8=function(r,e){return e||d(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||d(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||d(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||d(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||d(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};u.prototype.readInt8=function(r,e){return e||d(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||d(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||d(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||d(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||d(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||d(r,4,this.length),K(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||d(r,4,this.length),K(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||d(r,8,this.length),K(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||d(r,8,this.length),K(this,r,!1,52,8)};function E(t,r,e,n,i,o){if(!I(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function G(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};function H(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):H(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):H(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};function Ir(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Rr(t,r,e,n,i){return i||Ir(t,r,e,4,34028234663852886e22,-34028234663852886e22),Nr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return Rr(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return Rr(this,r,e,!1,n)};function Sr(t,r,e,n,i){return i||Ir(t,r,e,8,17976931348623157e292,-17976931348623157e292),Nr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return Sr(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return Sr(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};u.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=I(r)?r:W(new u(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var $e=/[^+\/0-9A-Za-z-_]/g;function ze(t){if(t=qe(t).replace($e,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function qe(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Je(t){return t<16?"0"+t.toString(16):t.toString(16)}function W(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Xe(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Qe(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function kr(t){return Se(ze(t))}function V(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Ze(t){return t!==t}function je(t){return t!=null&&(!!t._isBuffer||Ur(t)||rt(t))}function Ur(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Ur(t.slice(0,0))}function K(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,g=e?-1:1,m=t[r+l];for(l+=g,o=m&(1<<-h)-1,m>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=g,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=g,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(m?-1:1)*a*Math.pow(2,o-n)}function Nr(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,T=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=g/f:r+=g*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+m]=s&255,m+=T,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+m]=a&255,m+=T,a/=256,p-=8);t[e+m-T]|=j*128}import sr from"algosdk";import zt,{decodeAddress as qt,encodeAddress as Jt}from"algosdk";var R=[],_=[],et=typeof Uint8Array<"u"?Uint8Array:Array,or=!1;function Dr(){or=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],_[t.charCodeAt(r)]=r;_[45]=62,_[95]=63}function tt(t){or||Dr();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new et(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=_[t.charCodeAt(r)]<<18|_[t.charCodeAt(r+1)]<<12|_[t.charCodeAt(r+2)]<<6|_[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=_[t.charCodeAt(r)]<<2|_[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=_[t.charCodeAt(r)]<<10|_[t.charCodeAt(r+1)]<<4|_[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function nt(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function it(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(nt(n));return i.join("")}function Br(t){or||Dr();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(it(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=R[r>>2],i+=R[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=R[r>>10],i+=R[r>>4&63],i+=R[r<<2&63],i+="="),o.push(i),o.join("")}function q(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,g=e?-1:1,m=t[r+l];for(l+=g,o=m&(1<<-h)-1,m>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=g,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=g,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(m?-1:1)*a*Math.pow(2,o-n)}function Cr(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,T=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=g/f:r+=g*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+m]=s&255,m+=T,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+m]=a&255,m+=T,a/=256,p-=8);t[e+m-T]|=j*128}var ot={}.toString,Mr=Array.isArray||function(t){return ot.call(t)=="[object Array]"};var at=50;c.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Gt=$();function $(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function N(t,r){if($()<r)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=c.prototype):(t===null&&(t=new c(r)),t.length=r),t}function c(t,r,e){if(!c.TYPED_ARRAY_SUPPORT&&!(this instanceof c))return new c(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ar(this,t)}return Fr(this,t,r,e)}c.poolSize=8192;c._augment=function(t){return t.__proto__=c.prototype,t};function Fr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?ct(t,r,e,n):typeof r=="string"?st(t,r,e):ft(t,r)}c.from=function(t,r,e){return Fr(null,t,r,e)};c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array);function Or(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ut(t,r,e,n){return Or(r),r<=0?N(t,r):e!==void 0?typeof n=="string"?N(t,r).fill(e,n):N(t,r).fill(e):N(t,r)}c.alloc=function(t,r,e){return ut(null,t,r,e)};function ar(t,r){if(Or(r),t=N(t,r<0?0:ur(r)|0),!c.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}c.allocUnsafe=function(t){return ar(null,t)};c.allocUnsafeSlow=function(t){return ar(null,t)};function st(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Lr(r,e)|0;t=N(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function ir(t,r){var e=r.length<0?0:ur(r.length)|0;t=N(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ct(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),c.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=c.prototype):t=ir(t,r),t}function ft(t,r){if(S(r)){var e=ur(r.length)|0;return t=N(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ut(r.length)?N(t,0):ir(t,r);if(r.type==="Buffer"&&Mr(r.data))return ir(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ur(t){if(t>=$())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$().toString(16)+" bytes");return t|0}c.isBuffer=Nt;function S(t){return!!(t!=null&&t._isBuffer)}c.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};c.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};c.concat=function(r,e){if(!Mr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return c.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=c.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!S(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Lr(t,r){if(S(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return $r(t).length;default:if(n)return z(t).length;r=(""+r).toLowerCase(),n=!0}}c.byteLength=Lr;function lt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Tt(this,r,e);case"utf8":case"utf-8":return Gr(this,r,e);case"ascii":return Et(this,r,e);case"latin1":case"binary":return wt(this,r,e);case"base64":return dt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}c.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};c.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};c.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};c.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Gr(this,0,r):lt.apply(this,arguments)};c.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:c.compare(this,r)===0};c.prototype.inspect=function(){var r="",e=at;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};c.prototype.compare=function(r,e,n,i,o){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function Yr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=c.from(r,n)),S(r))return r.length===0?-1:Pr(t,r,e,n,i);if(typeof r=="number")return r=r&255,c.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Pr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Pr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(m,T){return o===1?m[T]:m.readUInt16BE(T*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,g=0;g<s;g++)if(f(t,p+g)!==f(r,g)){l=!1;break}if(l)return p}return-1}c.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};c.prototype.indexOf=function(r,e,n){return Yr(this,r,e,n,!0)};c.prototype.lastIndexOf=function(r,e,n){return Yr(this,r,e,n,!1)};function pt(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function ht(t,r,e,n){return Q(z(r,t.length-e),t,e,n)}function Wr(t,r,e,n){return Q(St(r),t,e,n)}function mt(t,r,e,n){return Wr(t,r,e,n)}function gt(t,r,e,n){return Q($r(r),t,e,n)}function xt(t,r,e,n){return Q(kt(r,t.length-e),t,e,n)}c.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|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 o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return pt(this,r,e,n);case"utf8":case"utf-8":return ht(this,r,e,n);case"ascii":return Wr(this,r,e,n);case"latin1":case"binary":return mt(this,r,e,n);case"base64":return gt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(t,r,e){return r===0&&e===t.length?Br(t):Br(t.slice(r,e))}function Gr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return bt(n)}var vr=4096;function bt(t){var r=t.length;if(r<=vr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=vr));return e}function Et(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function wt(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function Tt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Rt(t[o]);return i}function yt(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}c.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(c.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=c.prototype;else{var o=e-r;i=new c(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};c.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};c.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};c.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};c.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};c.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};c.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};c.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};c.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};c.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};c.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};c.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};c.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};c.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};c.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),q(this,r,!0,23,4)};c.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),q(this,r,!1,23,4)};c.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),q(this,r,!0,52,8)};c.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),q(this,r,!1,52,8)};function w(t,r,e,n,i,o){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}c.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};c.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};c.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function J(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}c.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};function X(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}c.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):X(this,r,e,!0),e+4};c.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};c.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};c.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};c.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):X(this,r,e,!0),e+4};c.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};function Hr(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Vr(t,r,e,n,i){return i||Hr(t,r,e,4),Cr(t,r,e,n,23,4),e+4}c.prototype.writeFloatLE=function(r,e,n){return Vr(this,r,e,!0,n)};c.prototype.writeFloatBE=function(r,e,n){return Vr(this,r,e,!1,n)};function Kr(t,r,e,n,i){return i||Hr(t,r,e,8),Cr(t,r,e,n,52,8),e+8}c.prototype.writeDoubleLE=function(r,e,n){return Kr(this,r,e,!0,n)};c.prototype.writeDoubleBE=function(r,e,n){return Kr(this,r,e,!1,n)};c.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};c.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=S(r)?r:z(new c(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var _t=/[^+\/0-9A-Za-z-_]/g;function At(t){if(t=It(t).replace(_t,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function It(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Rt(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function St(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function kt(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function $r(t){return tt(At(t))}function Q(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Ut(t){return t!==t}function Nt(t){return t!=null&&(!!t._isBuffer||zr(t)||Bt(t))}function zr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Bt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&zr(t.slice(0,0))}import{encodeAddress as Xr,decodeAddress as en}from"algosdk";function qr(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function Jr(t){return t.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Pt(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),vt(r)))}function Pt(t){return new Uint8Array(c.from(t))}function vt(t){let r=c.alloc(8);for(let e=0;e<8;e++)r[7-e]=Number(BigInt(t)>>BigInt(e*8)&BigInt(255));return new Uint8Array(r)}function Z(t){return c.from(t,"base64")}import Dt from"bignumber.js";Dt.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var yn=`{"theme1":{"value":"${x.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var Qr={V1_1:"v1_1",V2:"v2"},Rn={[Qr.V1_1]:{testnet:62368684,mainnet:552635992},[Qr.V2]:{testnet:148607e3,mainnet:1002541853}};function Zr(t){return Object.keys(t).sort().reduce((r,e)=>({...r,[e]:t[e]}),{})}var li=(t,r)=>r.map(n=>({appIndex:t,name:qr(Jr(["WLP_",n]))}));function Ct(t){let r={};return t.forEach(e=>{let n=Z(e.key).toString(),i=e.value,o=i.type;o==2&&(i=i.uint),o==1&&(i=Z(i.bytes)),n=="gov"?r.gov=Xr(i):r[n]=i}),Zr(r)}var pi=t=>{let r={0:t.amount},e=t.assets;for(let n=0;n<e.length;n++){let i=e[n]["asset-id"],o=e[n].amount;r[i]=o}return console.log(`Account ${t.address} balances`,JSON.stringify(r)),r},hi=async(t,r)=>{let e=await t.getApplicationByID(r).do();return Ct(e.params["global-state"])},mi=async(t,r)=>{let{boxes:e}=await t.getApplicationBoxes(r).do();console.log("boxes",r,e.map(n=>n.name).filter(n=>n.length===32).map(n=>u.from(n).toString("base64")))},gi=async(t,r,e)=>{try{let{value:n}=await t.getApplicationBoxByName(r,e).do();return n}catch(n){if(n.message.includes("box not found"))return console.log(`Box not found '${u.from(e).toString("hex")}'`),null;throw n}},xi=async(t,r=1)=>{let e=await t.getTransactionParams().do();return r>1&&(e.fee=sr.ALGORAND_MIN_TX_FEE*r,e.flatFee=!0),{...e}},di=(t,r)=>Object.keys(t).includes(r.toString()),bi=t=>sr.decodeAddress(t.toUpperCase()).publicKey,Ei=(t,r,e,n)=>sr.verifyBytes(new Uint8Array(u.from(e,n)),Z(t),r);export{li as createBoxes,bi as decodeAndNormalizeAddress,Ct as decodeStateArray,pi as getAccountAssetBalances,mi as getAppBoxes,hi as getAppGlobalState,gi as getBoxByName,xi as getTxnParams,di as isAssetOptedIn,Ei as verifySignature};
|
|
1
|
+
function fr(){throw new Error("setTimeout has not been defined")}function lr(){throw new Error("clearTimeout has not been defined")}var v=fr,N=lr;typeof globalThis.setTimeout=="function"&&(v=setTimeout);typeof globalThis.clearTimeout=="function"&&(N=clearTimeout);function pr(t){if(v===setTimeout)return setTimeout(t,0);if((v===fr||!v)&&setTimeout)return v=setTimeout,setTimeout(t,0);try{return v(t,0)}catch{try{return v.call(null,t,0)}catch{return v.call(this,t,0)}}}function jr(t){if(N===clearTimeout)return clearTimeout(t);if((N===lr||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(t);try{return N(t)}catch{try{return N.call(null,t)}catch{return N.call(this,t)}}}var k=[],O=!1,P,L=-1;function re(){!O||!P||(O=!1,P.length?k=P.concat(k):L=-1,k.length&&hr())}function hr(){if(!O){var t=pr(re);O=!0;for(var r=k.length;r;){for(P=k,k=[];++L<r;)P&&P[L].run();L=-1,r=k.length}P=null,O=!1,jr(t)}}function ee(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];k.push(new gr(t,r)),k.length===1&&!O&&pr(hr)}function gr(t,r){this.fun=t,this.array=r}gr.prototype.run=function(){this.fun.apply(null,this.array)};var te="browser",ne="browser",ie=!0,oe={},ae=[],ue="",se={},ce={},fe={};function D(){}var le=D,pe=D,he=D,ge=D,me=D,xe=D,de=D;function be(t){throw new Error("process.binding is not supported")}function Ee(){return"/"}function we(t){throw new Error("process.chdir is not supported")}function ye(){return 0}var F=globalThis.performance||{},Te=F.now||F.mozNow||F.msNow||F.oNow||F.webkitNow||function(){return new Date().getTime()};function _e(t){var r=Te.call(F)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var Ae=new Date;function Ie(){var t=new Date,r=t-Ae;return r/1e3}var x={nextTick:ee,title:te,browser:ie,env:oe,argv:ae,version:ue,versions:se,on:le,addListener:pe,once:he,off:ge,removeListener:me,removeAllListeners:xe,emit:de,binding:be,cwd:Ee,chdir:we,umask:ye,hrtime:_e,platform:ne,release:ce,config:fe,uptime:Ie},cr={};Object.keys(cr).forEach(t=>{let r=t.split("."),e=x;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=cr[t]:e=e[i]||(e[i]={})}});var A=[],T=[],Re=typeof Uint8Array<"u"?Uint8Array:Array,er=!1;function br(){er=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)A[r]=t[r],T[t.charCodeAt(r)]=r;T[45]=62,T[95]=63}function Se(t){er||br();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new Re(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=T[t.charCodeAt(r)]<<18|T[t.charCodeAt(r+1)]<<12|T[t.charCodeAt(r+2)]<<6|T[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=T[t.charCodeAt(r)]<<2|T[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=T[t.charCodeAt(r)]<<10|T[t.charCodeAt(r+1)]<<4|T[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function ke(t){return A[t>>18&63]+A[t>>12&63]+A[t>>6&63]+A[t&63]}function Be(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(ke(n));return i.join("")}function mr(t){er||br();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(Be(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=A[r>>2],i+=A[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=A[r>>10],i+=A[r>>4&63],i+=A[r<<2&63],i+="="),o.push(i),o.join("")}u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function Y(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(Y()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return tr(this,t)}return Er(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Er(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Ne(t,r,e,n):typeof r=="string"?ve(t,r,e):Pe(t,r)}u.from=function(t,r,e){return Er(null,t,r,e)};u.kMaxLength=Y();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function wr(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ue(t,r,e,n){return wr(r),r<=0?B(t,r):e!==void 0?typeof n=="string"?B(t,r).fill(e,n):B(t,r).fill(e):B(t,r)}u.alloc=function(t,r,e){return Ue(null,t,r,e)};function tr(t,r){if(wr(r),t=B(t,r<0?0:nr(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return tr(null,t)};u.allocUnsafeSlow=function(t){return tr(null,t)};function ve(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=yr(r,e)|0;t=B(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function rr(t,r){var e=r.length<0?0:nr(r.length)|0;t=B(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Ne(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=rr(t,r),t}function Pe(t,r){if(I(r)){var e=nr(r.length)|0;return t=B(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ze(r.length)?B(t,0):rr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return rr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function nr(t){if(t>=Y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y().toString(16)+" bytes");return t|0}u.isBuffer=je;function I(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!I(r)||!I(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};u.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=u.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!I(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function yr(t,r){if(I(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return kr(t).length;default:if(n)return W(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=yr;function De(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ve(this,r,e);case"utf8":case"utf-8":return Ar(this,r,e);case"ascii":return Ge(this,r,e);case"latin1":case"binary":return He(this,r,e);case"base64":return Ye(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ke(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function C(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)C(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)C(this,e,e+3),C(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)C(this,e,e+7),C(this,e+1,e+6),C(this,e+2,e+5),C(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ar(this,0,r):De.apply(this,arguments)};u.prototype.equals=function(r){if(!I(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.compare=function(r,e,n,i,o){if(!I(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function Tr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),I(r))return r.length===0?-1:xr(t,r,e,n,i);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):xr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function xr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(g,y){return o===1?g[y]:g.readUInt16BE(y*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,m=0;m<s;m++)if(f(t,p+m)!==f(r,m)){l=!1;break}if(l)return p}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return Tr(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return Tr(this,r,e,n,!1)};function Ce(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function Me(t,r,e,n){return V(W(r,t.length-e),t,e,n)}function _r(t,r,e,n){return V(Xe(r),t,e,n)}function Fe(t,r,e,n){return _r(t,r,e,n)}function Oe(t,r,e,n){return V(kr(r),t,e,n)}function Le(t,r,e,n){return V(Qe(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|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 o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ce(this,r,e,n);case"utf8":case"utf-8":return Me(this,r,e,n);case"ascii":return _r(this,r,e,n);case"latin1":case"binary":return Fe(this,r,e,n);case"base64":return Oe(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Le(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ye(t,r,e){return r===0&&e===t.length?mr(t):mr(t.slice(r,e))}function Ar(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return We(n)}var dr=4096;function We(t){var r=t.length;if(r<=dr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=dr));return e}function Ge(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function He(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function Ve(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Je(t[o]);return i}function Ke(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(u.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=u.prototype;else{var o=e-r;i=new u(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function d(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};u.prototype.readUInt8=function(r,e){return e||d(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||d(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||d(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||d(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||d(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};u.prototype.readInt8=function(r,e){return e||d(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||d(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||d(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||d(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||d(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||d(r,4,this.length),K(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||d(r,4,this.length),K(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||d(r,8,this.length),K(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||d(r,8,this.length),K(this,r,!1,52,8)};function E(t,r,e,n,i,o){if(!I(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function G(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};function H(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):H(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):H(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};function Ir(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Rr(t,r,e,n,i){return i||Ir(t,r,e,4,34028234663852886e22,-34028234663852886e22),Ur(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return Rr(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return Rr(this,r,e,!1,n)};function Sr(t,r,e,n,i){return i||Ir(t,r,e,8,17976931348623157e292,-17976931348623157e292),Ur(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return Sr(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return Sr(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};u.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=I(r)?r:W(new u(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var $e=/[^+\/0-9A-Za-z-_]/g;function ze(t){if(t=qe(t).replace($e,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function qe(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Je(t){return t<16?"0"+t.toString(16):t.toString(16)}function W(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Xe(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Qe(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function kr(t){return Se(ze(t))}function V(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Ze(t){return t!==t}function je(t){return t!=null&&(!!t._isBuffer||Br(t)||rt(t))}function Br(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Br(t.slice(0,0))}function K(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,m=e?-1:1,g=t[r+l];for(l+=m,o=g&(1<<-h)-1,g>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=m,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=m,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(g?-1:1)*a*Math.pow(2,o-n)}function Ur(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,y=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=m/f:r+=m*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+g]=s&255,g+=y,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+g]=a&255,g+=y,a/=256,p-=8);t[e+g-y]|=j*128}import sr from"algosdk";import zt,{decodeAddress as qt,encodeAddress as Jt}from"algosdk";var R=[],_=[],et=typeof Uint8Array<"u"?Uint8Array:Array,or=!1;function Dr(){or=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],_[t.charCodeAt(r)]=r;_[45]=62,_[95]=63}function tt(t){or||Dr();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new et(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=_[t.charCodeAt(r)]<<18|_[t.charCodeAt(r+1)]<<12|_[t.charCodeAt(r+2)]<<6|_[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=_[t.charCodeAt(r)]<<2|_[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=_[t.charCodeAt(r)]<<10|_[t.charCodeAt(r+1)]<<4|_[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function nt(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function it(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(nt(n));return i.join("")}function vr(t){or||Dr();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(it(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=R[r>>2],i+=R[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=R[r>>10],i+=R[r>>4&63],i+=R[r<<2&63],i+="="),o.push(i),o.join("")}function q(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,m=e?-1:1,g=t[r+l];for(l+=m,o=g&(1<<-h)-1,g>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=m,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=m,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(g?-1:1)*a*Math.pow(2,o-n)}function Cr(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,y=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=m/f:r+=m*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+g]=s&255,g+=y,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+g]=a&255,g+=y,a/=256,p-=8);t[e+g-y]|=j*128}var ot={}.toString,Mr=Array.isArray||function(t){return ot.call(t)=="[object Array]"};var at=50;c.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Gt=$();function $(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(t,r){if($()<r)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=c.prototype):(t===null&&(t=new c(r)),t.length=r),t}function c(t,r,e){if(!c.TYPED_ARRAY_SUPPORT&&!(this instanceof c))return new c(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ar(this,t)}return Fr(this,t,r,e)}c.poolSize=8192;c._augment=function(t){return t.__proto__=c.prototype,t};function Fr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?ct(t,r,e,n):typeof r=="string"?st(t,r,e):ft(t,r)}c.from=function(t,r,e){return Fr(null,t,r,e)};c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array);function Or(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ut(t,r,e,n){return Or(r),r<=0?U(t,r):e!==void 0?typeof n=="string"?U(t,r).fill(e,n):U(t,r).fill(e):U(t,r)}c.alloc=function(t,r,e){return ut(null,t,r,e)};function ar(t,r){if(Or(r),t=U(t,r<0?0:ur(r)|0),!c.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}c.allocUnsafe=function(t){return ar(null,t)};c.allocUnsafeSlow=function(t){return ar(null,t)};function st(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Lr(r,e)|0;t=U(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function ir(t,r){var e=r.length<0?0:ur(r.length)|0;t=U(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ct(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),c.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=c.prototype):t=ir(t,r),t}function ft(t,r){if(S(r)){var e=ur(r.length)|0;return t=U(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Bt(r.length)?U(t,0):ir(t,r);if(r.type==="Buffer"&&Mr(r.data))return ir(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ur(t){if(t>=$())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$().toString(16)+" bytes");return t|0}c.isBuffer=Ut;function S(t){return!!(t!=null&&t._isBuffer)}c.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};c.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};c.concat=function(r,e){if(!Mr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return c.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=c.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!S(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Lr(t,r){if(S(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return $r(t).length;default:if(n)return z(t).length;r=(""+r).toLowerCase(),n=!0}}c.byteLength=Lr;function lt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return yt(this,r,e);case"utf8":case"utf-8":return Gr(this,r,e);case"ascii":return Et(this,r,e);case"latin1":case"binary":return wt(this,r,e);case"base64":return dt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}c.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};c.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};c.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};c.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Gr(this,0,r):lt.apply(this,arguments)};c.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:c.compare(this,r)===0};c.prototype.inspect=function(){var r="",e=at;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};c.prototype.compare=function(r,e,n,i,o){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function Yr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=c.from(r,n)),S(r))return r.length===0?-1:Nr(t,r,e,n,i);if(typeof r=="number")return r=r&255,c.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Nr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Nr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(g,y){return o===1?g[y]:g.readUInt16BE(y*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,m=0;m<s;m++)if(f(t,p+m)!==f(r,m)){l=!1;break}if(l)return p}return-1}c.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};c.prototype.indexOf=function(r,e,n){return Yr(this,r,e,n,!0)};c.prototype.lastIndexOf=function(r,e,n){return Yr(this,r,e,n,!1)};function pt(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function ht(t,r,e,n){return Q(z(r,t.length-e),t,e,n)}function Wr(t,r,e,n){return Q(St(r),t,e,n)}function gt(t,r,e,n){return Wr(t,r,e,n)}function mt(t,r,e,n){return Q($r(r),t,e,n)}function xt(t,r,e,n){return Q(kt(r,t.length-e),t,e,n)}c.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|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 o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return pt(this,r,e,n);case"utf8":case"utf-8":return ht(this,r,e,n);case"ascii":return Wr(this,r,e,n);case"latin1":case"binary":return gt(this,r,e,n);case"base64":return mt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(t,r,e){return r===0&&e===t.length?vr(t):vr(t.slice(r,e))}function Gr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return bt(n)}var Pr=4096;function bt(t){var r=t.length;if(r<=Pr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Pr));return e}function Et(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function wt(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function yt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Rt(t[o]);return i}function Tt(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}c.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(c.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=c.prototype;else{var o=e-r;i=new c(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};c.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};c.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};c.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};c.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};c.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};c.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};c.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};c.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};c.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};c.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};c.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};c.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};c.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};c.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),q(this,r,!0,23,4)};c.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),q(this,r,!1,23,4)};c.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),q(this,r,!0,52,8)};c.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),q(this,r,!1,52,8)};function w(t,r,e,n,i,o){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}c.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};c.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};c.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function J(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}c.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};function X(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}c.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):X(this,r,e,!0),e+4};c.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};c.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};c.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};c.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):X(this,r,e,!0),e+4};c.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};function Hr(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Vr(t,r,e,n,i){return i||Hr(t,r,e,4),Cr(t,r,e,n,23,4),e+4}c.prototype.writeFloatLE=function(r,e,n){return Vr(this,r,e,!0,n)};c.prototype.writeFloatBE=function(r,e,n){return Vr(this,r,e,!1,n)};function Kr(t,r,e,n,i){return i||Hr(t,r,e,8),Cr(t,r,e,n,52,8),e+8}c.prototype.writeDoubleLE=function(r,e,n){return Kr(this,r,e,!0,n)};c.prototype.writeDoubleBE=function(r,e,n){return Kr(this,r,e,!1,n)};c.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};c.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=S(r)?r:z(new c(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var _t=/[^+\/0-9A-Za-z-_]/g;function At(t){if(t=It(t).replace(_t,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function It(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Rt(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function St(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function kt(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function $r(t){return tt(At(t))}function Q(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Bt(t){return t!==t}function Ut(t){return t!=null&&(!!t._isBuffer||zr(t)||vt(t))}function zr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function vt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&zr(t.slice(0,0))}import{encodeAddress as Xr,decodeAddress as en}from"algosdk";function qr(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function Jr(t){return t.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Nt(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),Pt(r)))}function Nt(t){return new Uint8Array(c.from(t))}function Pt(t){let r=c.alloc(8);for(let e=0;e<8;e++)r[7-e]=Number(BigInt(t)>>BigInt(e*8)&BigInt(255));return new Uint8Array(r)}function Z(t){return c.from(t,"base64")}import Dt from"bignumber.js";Dt.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var An=`{"theme1":{"value":"${x.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var Qr={V1_1:"v1_1",V2:"v2"},kn={[Qr.V1_1]:{testnet:62368684,mainnet:552635992},[Qr.V2]:{testnet:148607e3,mainnet:1002541853}};function Zr(t){return Object.keys(t).sort().reduce((r,e)=>({...r,[e]:t[e]}),{})}var gi=(t,r)=>r.map(n=>({appIndex:t,name:qr(Jr(["WLP_",n]))}));function Ct(t){let r={};return t.forEach(e=>{let n=Z(e.key).toString(),i=e.value,o=i.type;o==2&&(i=i.uint),o==1&&(i=Z(i.bytes)),n=="gov"?r.gov=Xr(i):r[n]=i}),Zr(r)}var mi=t=>{let r={0:t.amount},e=t.assets;for(let n=0;n<e.length;n++){let i=e[n]["asset-id"],o=e[n].amount;r[i]=o}return console.log(`Account ${t.address} balances`,JSON.stringify(r)),r},xi=async(t,r)=>{let e=await t.getApplicationByID(r).do();return Ct(e.params["global-state"])},di=async(t,r)=>{let{boxes:e}=await t.getApplicationBoxes(r).do();console.log("boxes",r,e.map(n=>n.name).filter(n=>n.length===32).map(n=>u.from(n).toString("base64")))},bi=async(t,r,e)=>{try{let{value:n}=await t.getApplicationBoxByName(r,e).do();return n}catch(n){if(n.message.includes("box not found"))return console.log(`Box not found '${u.from(e).toString("hex")}'`),null;throw n}},Ei=async(t,r=1)=>{let e=await t.getTransactionParams().do();return r>1&&(e.fee=sr.ALGORAND_MIN_TX_FEE*r,e.flatFee=!0),{...e}},wi=(t,r)=>Object.keys(t).includes(r.toString()),yi=t=>sr.decodeAddress(t.toUpperCase()).publicKey,Ti=(t,r,e,n)=>sr.verifyBytes(new Uint8Array(u.from(e,n)),Z(t),r);export{gi as createBoxes,yi as decodeAndNormalizeAddress,Ct as decodeStateArray,mi as getAccountAssetBalances,di as getAppBoxes,xi as getAppGlobalState,bi as getBoxByName,Ei as getTxnParams,wi as isAssetOptedIn,Ti as verifySignature};
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|