@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 cr(){throw new Error("clearTimeout has not been defined")}var P=hr,S=cr;typeof globalThis.setTimeout=="function"&&(P=setTimeout);typeof globalThis.clearTimeout=="function"&&(S=clearTimeout);function sr(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 Xr(i){if(S===clearTimeout)return clearTimeout(i);if((S===cr||!S)&&clearTimeout)return S=clearTimeout,clearTimeout(i);try{return S(i)}catch{try{return S.call(null,i)}catch{return S.call(this,i)}}}var B=[],N=!1,D,$=-1;function Kr(){!N||!D||(N=!1,D.length?B=D.concat(B):$=-1,B.length&&pr())}function pr(){if(!N){var i=sr(Kr);N=!0;for(var r=B.length;r;){for(D=B,B=[];++$<r;)D&&D[$].run();$=-1,r=B.length}D=null,N=!1,Xr(i)}}function Qr(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 lr(i,r)),B.length===1&&!N&&sr(pr)}function lr(i,r){this.fun=i,this.array=r}lr.prototype.run=function(){this.fun.apply(null,this.array)};var Zr="browser",qr="browser",jr=!0,rn={},nn=[],en="",tn={},on={},un={};function Y(){}var fn=Y,an=Y,hn=Y,cn=Y,sn=Y,pn=Y,ln=Y;function xn(i){throw new Error("process.binding is not supported")}function wn(){return"/"}function En(i){throw new Error("process.chdir is not supported")}function gn(){return 0}var M=globalThis.performance||{},yn=M.now||M.mozNow||M.msNow||M.oNow||M.webkitNow||function(){return new Date().getTime()};function An(i){var r=yn.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 mn=new Date;function Un(){var i=new Date,r=i-mn;return r/1e3}var L={nextTick:Qr,title:Zr,browser:jr,env:rn,argv:nn,version:en,versions:tn,on:fn,addListener:an,once:hn,off:cn,removeListener:sn,removeAllListeners:pn,emit:ln,binding:xn,cwd:wn,chdir:En,umask:gn,hrtime:An,platform:qr,release:on,config:un,uptime:Un},ar={};Object.keys(ar).forEach(i=>{let r=i.split("."),n=L;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=ar[i]:n=n[t]||(n[t]={})}});var I=[],U=[],Tn=typeof Uint8Array<"u"?Uint8Array:Array,rr=!1;function gr(){rr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)I[r]=i[r],U[i.charCodeAt(r)]=r;U[45]=62,U[95]=63}function In(i){rr||gr();var r,n,e,t,o,u,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=i[f-2]==="="?2:i[f-1]==="="?1:0,u=new Tn(f*3/4-o),e=o>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)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=t&255;return o===2?(t=U[i.charCodeAt(r)]<<2|U[i.charCodeAt(r+1)]>>4,u[c++]=t&255):o===1&&(t=U[i.charCodeAt(r)]<<10|U[i.charCodeAt(r+1)]<<4|U[i.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=t&255),u}function dn(i){return I[i>>18&63]+I[i>>12&63]+I[i>>6&63]+I[i&63]}function Rn(i,r,n){for(var e,t=[],o=r;o<n;o+=3)e=(i[o]<<16)+(i[o+1]<<8)+i[o+2],t.push(dn(e));return t.join("")}function xr(i){rr||gr();for(var r,n=i.length,e=n%3,t="",o=[],u=16383,f=0,c=n-e;f<c;f+=u)o.push(Rn(i,f,f+u>c?c:f+u));return e===1?(r=i[n-1],t+=I[r>>2],t+=I[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=I[r>>10],t+=I[r>>4&63],t+=I[r<<2&63],t+="="),o.push(t),o.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?Fn(i,r,n,e):typeof r=="string"?Bn(i,r,n):vn(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 _n(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 _n(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 Bn(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=mr(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 Fn(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 vn(i,r){if(d(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"||Xn(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=Kn;function d(i){return!!(i!=null&&i._isBuffer)}a.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,o=0,u=Math.min(e,t);o<u;++o)if(r[o]!==n[o]){e=r[o],t=n[o];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),o=0;for(e=0;e<r.length;++e){var u=r[e];if(!d(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,o),o+=u.length}return t};function mr(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 b(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Br(i).length;default:if(e)return b(i).length;r=(""+r).toLowerCase(),e=!0}}a.byteLength=mr;function Pn(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 Wn(this,r,n);case"utf8":case"utf-8":return Ir(this,r,n);case"ascii":return Ln(this,r,n);case"latin1":case"binary":return $n(this,r,n);case"base64":return Mn(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bn(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):Pn.apply(this,arguments)};a.prototype.equals=function(r){if(!d(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,o){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),o===void 0&&(o=this.length),n<0||e>r.length||t<0||o>this.length)throw new RangeError("out of range index");if(t>=o&&n>=e)return 0;if(t>=o)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,o>>>=0,this===r)return 0;for(var u=o-t,f=e-n,c=Math.min(u,f),p=this.slice(t,o),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){u=p[s],f=l[s];break}return u<f?-1:f<u?1:0};function Ur(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)),d(r))return r.length===0?-1:wr(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):wr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function wr(i,r,n,e,t){var o=1,u=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;o=2,u/=2,f/=2,n/=2}function c(x,m){return o===1?x[m]:x.readUInt16BE(m*o)}var p;if(t){var l=-1;for(p=n;p<u;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*o}else l!==-1&&(p-=p-l),l=-1}else for(n+f>u&&(n=u-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 Ur(this,r,n,e,!0)};a.prototype.lastIndexOf=function(r,n,e){return Ur(this,r,n,e,!1)};function Sn(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");e>o/2&&(e=o/2);for(var u=0;u<e;++u){var f=parseInt(r.substr(u*2,2),16);if(isNaN(f))return u;i[n+u]=f}return u}function Dn(i,r,n,e){return G(b(r,i.length-n),i,n,e)}function Tr(i,r,n,e){return G(Hn(r),i,n,e)}function Yn(i,r,n,e){return Tr(i,r,n,e)}function kn(i,r,n,e){return G(Br(r),i,n,e)}function Cn(i,r,n,e){return G(Jn(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 o=this.length-n;if((e===void 0||e>o)&&(e=o),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return Sn(this,r,n,e);case"utf8":case"utf-8":return Dn(this,r,n,e);case"ascii":return Tr(this,r,n,e);case"latin1":case"binary":return Yn(this,r,n,e);case"base64":return kn(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Cn(this,r,n,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Mn(i,r,n){return r===0&&n===i.length?xr(i):xr(i.slice(r,n))}function Ir(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var o=i[t],u=null,f=o>239?4:o>223?3:o>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:o<128&&(u=o);break;case 2:c=i[t+1],(c&192)===128&&(s=(o&31)<<6|c&63,s>127&&(u=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(o&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(u=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=(o&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(u=s))}}u===null?(u=65533,f=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=f}return Nn(e)}var Er=4096;function Nn(i){var r=i.length;if(r<=Er)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=Er));return n}function Ln(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 $n(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 Wn(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",o=r;o<n;++o)t+=Vn(i[o]);return t}function bn(i,r,n){for(var e=i.slice(r,n),t="",o=0;o<e.length;o+=2)t+=String.fromCharCode(e[o]+e[o+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 o=n-r;t=new a(o,void 0);for(var u=0;u<o;++u)t[u]=this[u+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],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;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],o=1;n>0&&(o*=256);)t+=this[r+--n]*o;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],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;return o*=128,t>=o&&(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,o=1,u=this[r+--t];t>0&&(o*=256);)u+=this[r+--t]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*n)),u};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),V(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,n){return n||E(r,4,this.length),V(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,n){return n||E(r,8,this.length),V(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,n){return n||E(r,8,this.length),V(this,r,!1,52,8)};function y(i,r,n,e,t,o){if(!d(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<o)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 o=Math.pow(2,8*e)-1;y(this,r,n,e,o,0)}var u=1,f=0;for(this[n]=r&255;++f<e&&(u*=256);)this[n+f]=r/u&255;return n+e};a.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var o=Math.pow(2,8*e)-1;y(this,r,n,e,o,0)}var u=e-1,f=1;for(this[n+u]=r&255;--u>=0&&(f*=256);)this[n+u]=r/f&255;return n+e};a.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||y(this,r,n,1,255,0),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function z(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,o=Math.min(i.length-n,2);t<o;++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||y(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):z(this,r,n,!0),n+2};a.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||y(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):z(this,r,n,!1),n+2};function O(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,o=Math.min(i.length-n,4);t<o;++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||y(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):O(this,r,n,!0),n+4};a.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||y(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):O(this,r,n,!1),n+4};a.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var o=Math.pow(2,8*e-1);y(this,r,n,e,o-1,-o)}var u=0,f=1,c=0;for(this[n]=r&255;++u<e&&(f*=256);)r<0&&c===0&&this[n+u-1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};a.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var o=Math.pow(2,8*e-1);y(this,r,n,e,o-1,-o)}var u=e-1,f=1,c=0;for(this[n+u]=r&255;--u>=0&&(f*=256);)r<0&&c===0&&this[n+u+1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};a.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||y(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||y(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):z(this,r,n,!0),n+2};a.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||y(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):z(this,r,n,!1),n+2};a.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||y(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):O(this,r,n,!0),n+4};a.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||y(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):O(this,r,n,!1),n+4};function dr(i,r,n,e,t,o){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Rr(i,r,n,e,t){return t||dr(i,r,n,4,34028234663852886e22,-34028234663852886e22),vr(i,r,n,e,23,4),n+4}a.prototype.writeFloatLE=function(r,n,e){return Rr(this,r,n,!0,e)};a.prototype.writeFloatBE=function(r,n,e){return Rr(this,r,n,!1,e)};function _r(i,r,n,e,t){return t||dr(i,r,n,8,17976931348623157e292,-17976931348623157e292),vr(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 o=t-e,u;if(this===r&&e<n&&n<t)for(u=o-1;u>=0;--u)r[u+n]=this[u+e];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(u=0;u<o;++u)r[u+n]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+o),n);return o};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 o=r.charCodeAt(0);o<256&&(r=o)}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 u;if(typeof r=="number")for(u=n;u<e;++u)this[u]=r;else{var f=d(r)?r:b(new a(r,t).toString()),c=f.length;for(u=0;u<e-n;++u)this[u+n]=f[u%c]}return this};var zn=/[^+\/0-9A-Za-z-_]/g;function On(i){if(i=Gn(i).replace(zn,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Gn(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Vn(i){return i<16?"0"+i.toString(16):i.toString(16)}function b(i,r){r=r||1/0;for(var n,e=i.length,t=null,o=[],u=0;u<e;++u){if(n=i.charCodeAt(u),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&o.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&o.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&o.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;o.push(n)}else if(n<2048){if((r-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return o}function Hn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Jn(i,r){for(var n,e,t,o=[],u=0;u<i.length&&!((r-=2)<0);++u)n=i.charCodeAt(u),e=n>>8,t=n%256,o.push(t),o.push(e);return o}function Br(i){return In(On(i))}function G(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 Xn(i){return i!==i}function Kn(i){return i!=null&&(!!i._isBuffer||Fr(i)||Qn(i))}function Fr(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Qn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Fr(i.slice(0,0))}function V(i,r,n,e,t){var o,u,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,o=x&(1<<-l)-1,x>>=-l,l+=f;l>0;o=o*256+i[r+s],s+=w,l-=8);for(u=o&(1<<-l)-1,o>>=-l,l+=e;l>0;u=u*256+i[r+s],s+=w,l-=8);if(o===0)o=1-p;else{if(o===c)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),o=o-p}return(x?-1:1)*u*Math.pow(2,o-e)}function vr(i,r,n,e,t,o){var u,f,c,p=o*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:o-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,u=l):(u=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(u++,c/=2),u+s>=l?(f=0,u=l):u+s>=1?(f=(r*c-1)*Math.pow(2,t),u=u+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),u=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(u=u<<t|f,p+=t;p>0;i[n+x]=u&255,x+=m,u/=256,p-=8);i[n+x-m]|=q*128}import fr from"algosdk";import bi,{decodeAddress as zi,encodeAddress as Oi}from"algosdk";var R=[],T=[],Zn=typeof Uint8Array<"u"?Uint8Array:Array,tr=!1;function Yr(){tr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)R[r]=i[r],T[i.charCodeAt(r)]=r;T[45]=62,T[95]=63}function qn(i){tr||Yr();var r,n,e,t,o,u,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=i[f-2]==="="?2:i[f-1]==="="?1:0,u=new Zn(f*3/4-o),e=o>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=T[i.charCodeAt(r)]<<18|T[i.charCodeAt(r+1)]<<12|T[i.charCodeAt(r+2)]<<6|T[i.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=t&255;return o===2?(t=T[i.charCodeAt(r)]<<2|T[i.charCodeAt(r+1)]>>4,u[c++]=t&255):o===1&&(t=T[i.charCodeAt(r)]<<10|T[i.charCodeAt(r+1)]<<4|T[i.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=t&255),u}function jn(i){return R[i>>18&63]+R[i>>12&63]+R[i>>6&63]+R[i&63]}function ri(i,r,n){for(var e,t=[],o=r;o<n;o+=3)e=(i[o]<<16)+(i[o+1]<<8)+i[o+2],t.push(jn(e));return t.join("")}function Pr(i){tr||Yr();for(var r,n=i.length,e=n%3,t="",o=[],u=16383,f=0,c=n-e;f<c;f+=u)o.push(ri(i,f,f+u>c?c:f+u));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+="="),o.push(t),o.join("")}function X(i,r,n,e,t){var o,u,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,o=x&(1<<-l)-1,x>>=-l,l+=f;l>0;o=o*256+i[r+s],s+=w,l-=8);for(u=o&(1<<-l)-1,o>>=-l,l+=e;l>0;u=u*256+i[r+s],s+=w,l-=8);if(o===0)o=1-p;else{if(o===c)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),o=o-p}return(x?-1:1)*u*Math.pow(2,o-e)}function kr(i,r,n,e,t,o){var u,f,c,p=o*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:o-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,u=l):(u=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(u++,c/=2),u+s>=l?(f=0,u=l):u+s>=1?(f=(r*c-1)*Math.pow(2,t),u=u+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),u=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(u=u<<t|f,p+=t;p>0;i[n+x]=u&255,x+=m,u/=256,p-=8);i[n+x-m]|=q*128}var ni={}.toString,Cr=Array.isArray||function(i){return ni.call(i)=="[object Array]"};var ii=50;h.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Mi=H();function H(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(i,r){if(H()<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 or(this,i)}return Mr(this,i,r,n)}h.poolSize=8192;h._augment=function(i){return i.__proto__=h.prototype,i};function Mr(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?oi(i,r,n,e):typeof r=="string"?ti(i,r,n):ui(i,r)}h.from=function(i,r,n){return Mr(null,i,r,n)};h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function Nr(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 ei(i,r,n,e){return Nr(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 ei(null,i,r,n)};function or(i,r){if(Nr(r),i=v(i,r<0?0:ur(r)|0),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}h.allocUnsafe=function(i){return or(null,i)};h.allocUnsafeSlow=function(i){return or(null,i)};function ti(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=Lr(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:ur(r.length)|0;i=v(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function oi(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 ui(i,r){if(_(r)){var n=ur(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"||Ri(r.length)?v(i,0):er(i,r);if(r.type==="Buffer"&&Cr(r.data))return er(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ur(i){if(i>=H())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H().toString(16)+" bytes");return i|0}h.isBuffer=_i;function _(i){return!!(i!=null&&i._isBuffer)}h.compare=function(r,n){if(!_(r)||!_(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,o=0,u=Math.min(e,t);o<u;++o)if(r[o]!==n[o]){e=r[o],t=n[o];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(!Cr(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),o=0;for(e=0;e<r.length;++e){var u=r[e];if(!_(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,o),o+=u.length}return t};function Lr(i,r){if(_(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 Vr(i).length;default:if(e)return J(i).length;r=(""+r).toLowerCase(),e=!0}}h.byteLength=Lr;function fi(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 gi(this,r,n);case"utf8":case"utf-8":return br(this,r,n);case"ascii":return wi(this,r,n);case"latin1":case"binary":return Ei(this,r,n);case"base64":return li(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yi(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?br(this,0,r):fi.apply(this,arguments)};h.prototype.equals=function(r){if(!_(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=ii;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,o){if(!_(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),o===void 0&&(o=this.length),n<0||e>r.length||t<0||o>this.length)throw new RangeError("out of range index");if(t>=o&&n>=e)return 0;if(t>=o)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,o>>>=0,this===r)return 0;for(var u=o-t,f=e-n,c=Math.min(u,f),p=this.slice(t,o),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){u=p[s],f=l[s];break}return u<f?-1:f<u?1:0};function $r(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)),_(r))return r.length===0?-1:Sr(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):Sr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Sr(i,r,n,e,t){var o=1,u=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;o=2,u/=2,f/=2,n/=2}function c(x,m){return o===1?x[m]:x.readUInt16BE(m*o)}var p;if(t){var l=-1;for(p=n;p<u;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*o}else l!==-1&&(p-=p-l),l=-1}else for(n+f>u&&(n=u-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 $r(this,r,n,e,!0)};h.prototype.lastIndexOf=function(r,n,e){return $r(this,r,n,e,!1)};function ai(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");e>o/2&&(e=o/2);for(var u=0;u<e;++u){var f=parseInt(r.substr(u*2,2),16);if(isNaN(f))return u;i[n+u]=f}return u}function hi(i,r,n,e){return Z(J(r,i.length-n),i,n,e)}function Wr(i,r,n,e){return Z(Ii(r),i,n,e)}function ci(i,r,n,e){return Wr(i,r,n,e)}function si(i,r,n,e){return Z(Vr(r),i,n,e)}function pi(i,r,n,e){return Z(di(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 o=this.length-n;if((e===void 0||e>o)&&(e=o),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return ai(this,r,n,e);case"utf8":case"utf-8":return hi(this,r,n,e);case"ascii":return Wr(this,r,n,e);case"latin1":case"binary":return ci(this,r,n,e);case"base64":return si(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pi(this,r,n,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function li(i,r,n){return r===0&&n===i.length?Pr(i):Pr(i.slice(r,n))}function br(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var o=i[t],u=null,f=o>239?4:o>223?3:o>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:o<128&&(u=o);break;case 2:c=i[t+1],(c&192)===128&&(s=(o&31)<<6|c&63,s>127&&(u=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(o&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(u=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=(o&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(u=s))}}u===null?(u=65533,f=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=f}return xi(e)}var Dr=4096;function xi(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 wi(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 Ei(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 gi(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",o=r;o<n;++o)t+=Ti(i[o]);return t}function yi(i,r,n){for(var e=i.slice(r,n),t="",o=0;o<e.length;o+=2)t+=String.fromCharCode(e[o]+e[o+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 o=n-r;t=new h(o,void 0);for(var u=0;u<o;++u)t[u]=this[u+r]}return t};function g(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||g(r,n,this.length);for(var t=this[r],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;return t};h.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||g(r,n,this.length);for(var t=this[r+--n],o=1;n>0&&(o*=256);)t+=this[r+--n]*o;return t};h.prototype.readUInt8=function(r,n){return n||g(r,1,this.length),this[r]};h.prototype.readUInt16LE=function(r,n){return n||g(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUInt16BE=function(r,n){return n||g(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUInt32LE=function(r,n){return n||g(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||g(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||g(r,n,this.length);for(var t=this[r],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;return o*=128,t>=o&&(t-=Math.pow(2,8*n)),t};h.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||g(r,n,this.length);for(var t=n,o=1,u=this[r+--t];t>0&&(o*=256);)u+=this[r+--t]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*n)),u};h.prototype.readInt8=function(r,n){return n||g(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,n){n||g(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||g(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||g(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||g(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||g(r,4,this.length),X(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,n){return n||g(r,4,this.length),X(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,n){return n||g(r,8,this.length),X(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,n){return n||g(r,8,this.length),X(this,r,!1,52,8)};function A(i,r,n,e,t,o){if(!_(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<o)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 o=Math.pow(2,8*e)-1;A(this,r,n,e,o,0)}var u=1,f=0;for(this[n]=r&255;++f<e&&(u*=256);)this[n+f]=r/u&255;return n+e};h.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var o=Math.pow(2,8*e)-1;A(this,r,n,e,o,0)}var u=e-1,f=1;for(this[n+u]=r&255;--u>=0&&(f*=256);)this[n+u]=r/f&255;return n+e};h.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||A(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,o=Math.min(i.length-n,2);t<o;++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||A(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||A(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,o=Math.min(i.length-n,4);t<o;++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||A(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||A(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 o=Math.pow(2,8*e-1);A(this,r,n,e,o-1,-o)}var u=0,f=1,c=0;for(this[n]=r&255;++u<e&&(f*=256);)r<0&&c===0&&this[n+u-1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};h.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var o=Math.pow(2,8*e-1);A(this,r,n,e,o-1,-o)}var u=e-1,f=1,c=0;for(this[n+u]=r&255;--u>=0&&(f*=256);)r<0&&c===0&&this[n+u+1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};h.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||A(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||A(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||A(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||A(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||A(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,o){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Or(i,r,n,e,t){return t||zr(i,r,n,4),kr(i,r,n,e,23,4),n+4}h.prototype.writeFloatLE=function(r,n,e){return Or(this,r,n,!0,e)};h.prototype.writeFloatBE=function(r,n,e){return Or(this,r,n,!1,e)};function Gr(i,r,n,e,t){return t||zr(i,r,n,8),kr(i,r,n,e,52,8),n+8}h.prototype.writeDoubleLE=function(r,n,e){return Gr(this,r,n,!0,e)};h.prototype.writeDoubleBE=function(r,n,e){return Gr(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 o=t-e,u;if(this===r&&e<n&&n<t)for(u=o-1;u>=0;--u)r[u+n]=this[u+e];else if(o<1e3||!h.TYPED_ARRAY_SUPPORT)for(u=0;u<o;++u)r[u+n]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+o),n);return o};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 o=r.charCodeAt(0);o<256&&(r=o)}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 u;if(typeof r=="number")for(u=n;u<e;++u)this[u]=r;else{var f=_(r)?r:J(new h(r,t).toString()),c=f.length;for(u=0;u<e-n;++u)this[u+n]=f[u%c]}return this};var Ai=/[^+\/0-9A-Za-z-_]/g;function mi(i){if(i=Ui(i).replace(Ai,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Ui(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Ti(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,o=[],u=0;u<e;++u){if(n=i.charCodeAt(u),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&o.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&o.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&o.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;o.push(n)}else if(n<2048){if((r-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return o}function Ii(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function di(i,r){for(var n,e,t,o=[],u=0;u<i.length&&!((r-=2)<0);++u)n=i.charCodeAt(u),e=n>>8,t=n%256,o.push(t),o.push(e);return o}function Vr(i){return qn(mi(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 Ri(i){return i!==i}function _i(i){return i!=null&&(!!i._isBuffer||Hr(i)||Bi(i))}function Hr(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Bi(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Hr(i.slice(0,0))}import{encodeAddress as Ki,decodeAddress as Qi}from"algosdk";function Jr(i){return new Uint8Array(h.from(i))}function ji(i){return Jr(i)}function Fi(i,r,n){return fr.makePaymentTxnWithSuggestedParamsFromObject({from:i,to:i,amount:0,note:r&&new Uint8Array(a.from(r,n)),suggestedParams:{fee:0,firstRound:1,lastRound:2,genesisHash:"SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",genesisID:"testnet-v1.0"}})}function re(i,r,n,e){return vi(Fi(i,r,n),e)}async function vi(i,r){let n=fr.encodeUnsignedTransaction(i),e=await r([n]),t=fr.decodeSignedTransaction(e[0]);return new Uint8Array(t.sig)}export{ji as encodeMessage,Fi as generateTxnForSign,re as signTxn};
|
|
1
|
+
function hr(){throw new Error("setTimeout has not been defined")}function cr(){throw new Error("clearTimeout has not been defined")}var P=hr,S=cr;typeof globalThis.setTimeout=="function"&&(P=setTimeout);typeof globalThis.clearTimeout=="function"&&(S=clearTimeout);function sr(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 Xr(i){if(S===clearTimeout)return clearTimeout(i);if((S===cr||!S)&&clearTimeout)return S=clearTimeout,clearTimeout(i);try{return S(i)}catch{try{return S.call(null,i)}catch{return S.call(this,i)}}}var B=[],N=!1,D,$=-1;function Kr(){!N||!D||(N=!1,D.length?B=D.concat(B):$=-1,B.length&&pr())}function pr(){if(!N){var i=sr(Kr);N=!0;for(var r=B.length;r;){for(D=B,B=[];++$<r;)D&&D[$].run();$=-1,r=B.length}D=null,N=!1,Xr(i)}}function Qr(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 lr(i,r)),B.length===1&&!N&&sr(pr)}function lr(i,r){this.fun=i,this.array=r}lr.prototype.run=function(){this.fun.apply(null,this.array)};var Zr="browser",qr="browser",jr=!0,rn={},nn=[],en="",tn={},on={},un={};function Y(){}var fn=Y,an=Y,hn=Y,cn=Y,sn=Y,pn=Y,ln=Y;function xn(i){throw new Error("process.binding is not supported")}function wn(){return"/"}function En(i){throw new Error("process.chdir is not supported")}function gn(){return 0}var M=globalThis.performance||{},yn=M.now||M.mozNow||M.msNow||M.oNow||M.webkitNow||function(){return new Date().getTime()};function An(i){var r=yn.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 mn=new Date;function Un(){var i=new Date,r=i-mn;return r/1e3}var L={nextTick:Qr,title:Zr,browser:jr,env:rn,argv:nn,version:en,versions:tn,on:fn,addListener:an,once:hn,off:cn,removeListener:sn,removeAllListeners:pn,emit:ln,binding:xn,cwd:wn,chdir:En,umask:gn,hrtime:An,platform:qr,release:on,config:un,uptime:Un},ar={};Object.keys(ar).forEach(i=>{let r=i.split("."),n=L;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=ar[i]:n=n[t]||(n[t]={})}});var I=[],U=[],Tn=typeof Uint8Array<"u"?Uint8Array:Array,rr=!1;function gr(){rr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)I[r]=i[r],U[i.charCodeAt(r)]=r;U[45]=62,U[95]=63}function In(i){rr||gr();var r,n,e,t,o,u,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=i[f-2]==="="?2:i[f-1]==="="?1:0,u=new Tn(f*3/4-o),e=o>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)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=t&255;return o===2?(t=U[i.charCodeAt(r)]<<2|U[i.charCodeAt(r+1)]>>4,u[c++]=t&255):o===1&&(t=U[i.charCodeAt(r)]<<10|U[i.charCodeAt(r+1)]<<4|U[i.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=t&255),u}function dn(i){return I[i>>18&63]+I[i>>12&63]+I[i>>6&63]+I[i&63]}function Rn(i,r,n){for(var e,t=[],o=r;o<n;o+=3)e=(i[o]<<16)+(i[o+1]<<8)+i[o+2],t.push(dn(e));return t.join("")}function xr(i){rr||gr();for(var r,n=i.length,e=n%3,t="",o=[],u=16383,f=0,c=n-e;f<c;f+=u)o.push(Rn(i,f,f+u>c?c:f+u));return e===1?(r=i[n-1],t+=I[r>>2],t+=I[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=I[r>>10],t+=I[r>>4&63],t+=I[r<<2&63],t+="="),o.push(t),o.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?Fn(i,r,n,e):typeof r=="string"?Bn(i,r,n):vn(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 _n(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 _n(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 Bn(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=mr(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 Fn(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 vn(i,r){if(d(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"||Xn(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=Kn;function d(i){return!!(i!=null&&i._isBuffer)}a.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,o=0,u=Math.min(e,t);o<u;++o)if(r[o]!==n[o]){e=r[o],t=n[o];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),o=0;for(e=0;e<r.length;++e){var u=r[e];if(!d(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,o),o+=u.length}return t};function mr(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 b(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Br(i).length;default:if(e)return b(i).length;r=(""+r).toLowerCase(),e=!0}}a.byteLength=mr;function Pn(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 Wn(this,r,n);case"utf8":case"utf-8":return Ir(this,r,n);case"ascii":return Ln(this,r,n);case"latin1":case"binary":return $n(this,r,n);case"base64":return Mn(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bn(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):Pn.apply(this,arguments)};a.prototype.equals=function(r){if(!d(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,o){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),o===void 0&&(o=this.length),n<0||e>r.length||t<0||o>this.length)throw new RangeError("out of range index");if(t>=o&&n>=e)return 0;if(t>=o)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,o>>>=0,this===r)return 0;for(var u=o-t,f=e-n,c=Math.min(u,f),p=this.slice(t,o),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){u=p[s],f=l[s];break}return u<f?-1:f<u?1:0};function Ur(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)),d(r))return r.length===0?-1:wr(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):wr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function wr(i,r,n,e,t){var o=1,u=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;o=2,u/=2,f/=2,n/=2}function c(x,m){return o===1?x[m]:x.readUInt16BE(m*o)}var p;if(t){var l=-1;for(p=n;p<u;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*o}else l!==-1&&(p-=p-l),l=-1}else for(n+f>u&&(n=u-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 Ur(this,r,n,e,!0)};a.prototype.lastIndexOf=function(r,n,e){return Ur(this,r,n,e,!1)};function Sn(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");e>o/2&&(e=o/2);for(var u=0;u<e;++u){var f=parseInt(r.substr(u*2,2),16);if(isNaN(f))return u;i[n+u]=f}return u}function Dn(i,r,n,e){return G(b(r,i.length-n),i,n,e)}function Tr(i,r,n,e){return G(Vn(r),i,n,e)}function Yn(i,r,n,e){return Tr(i,r,n,e)}function kn(i,r,n,e){return G(Br(r),i,n,e)}function Cn(i,r,n,e){return G(Jn(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 o=this.length-n;if((e===void 0||e>o)&&(e=o),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return Sn(this,r,n,e);case"utf8":case"utf-8":return Dn(this,r,n,e);case"ascii":return Tr(this,r,n,e);case"latin1":case"binary":return Yn(this,r,n,e);case"base64":return kn(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Cn(this,r,n,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Mn(i,r,n){return r===0&&n===i.length?xr(i):xr(i.slice(r,n))}function Ir(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var o=i[t],u=null,f=o>239?4:o>223?3:o>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:o<128&&(u=o);break;case 2:c=i[t+1],(c&192)===128&&(s=(o&31)<<6|c&63,s>127&&(u=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(o&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(u=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=(o&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(u=s))}}u===null?(u=65533,f=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=f}return Nn(e)}var Er=4096;function Nn(i){var r=i.length;if(r<=Er)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=Er));return n}function Ln(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 $n(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 Wn(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",o=r;o<n;++o)t+=Hn(i[o]);return t}function bn(i,r,n){for(var e=i.slice(r,n),t="",o=0;o<e.length;o+=2)t+=String.fromCharCode(e[o]+e[o+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 o=n-r;t=new a(o,void 0);for(var u=0;u<o;++u)t[u]=this[u+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],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;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],o=1;n>0&&(o*=256);)t+=this[r+--n]*o;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],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;return o*=128,t>=o&&(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,o=1,u=this[r+--t];t>0&&(o*=256);)u+=this[r+--t]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*n)),u};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),H(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,n){return n||E(r,4,this.length),H(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,n){return n||E(r,8,this.length),H(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,n){return n||E(r,8,this.length),H(this,r,!1,52,8)};function y(i,r,n,e,t,o){if(!d(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<o)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 o=Math.pow(2,8*e)-1;y(this,r,n,e,o,0)}var u=1,f=0;for(this[n]=r&255;++f<e&&(u*=256);)this[n+f]=r/u&255;return n+e};a.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var o=Math.pow(2,8*e)-1;y(this,r,n,e,o,0)}var u=e-1,f=1;for(this[n+u]=r&255;--u>=0&&(f*=256);)this[n+u]=r/f&255;return n+e};a.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||y(this,r,n,1,255,0),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function z(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,o=Math.min(i.length-n,2);t<o;++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||y(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):z(this,r,n,!0),n+2};a.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||y(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):z(this,r,n,!1),n+2};function O(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,o=Math.min(i.length-n,4);t<o;++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||y(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):O(this,r,n,!0),n+4};a.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||y(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):O(this,r,n,!1),n+4};a.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var o=Math.pow(2,8*e-1);y(this,r,n,e,o-1,-o)}var u=0,f=1,c=0;for(this[n]=r&255;++u<e&&(f*=256);)r<0&&c===0&&this[n+u-1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};a.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var o=Math.pow(2,8*e-1);y(this,r,n,e,o-1,-o)}var u=e-1,f=1,c=0;for(this[n+u]=r&255;--u>=0&&(f*=256);)r<0&&c===0&&this[n+u+1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};a.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||y(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||y(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):z(this,r,n,!0),n+2};a.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||y(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):z(this,r,n,!1),n+2};a.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||y(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):O(this,r,n,!0),n+4};a.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||y(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):O(this,r,n,!1),n+4};function dr(i,r,n,e,t,o){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Rr(i,r,n,e,t){return t||dr(i,r,n,4,34028234663852886e22,-34028234663852886e22),vr(i,r,n,e,23,4),n+4}a.prototype.writeFloatLE=function(r,n,e){return Rr(this,r,n,!0,e)};a.prototype.writeFloatBE=function(r,n,e){return Rr(this,r,n,!1,e)};function _r(i,r,n,e,t){return t||dr(i,r,n,8,17976931348623157e292,-17976931348623157e292),vr(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 o=t-e,u;if(this===r&&e<n&&n<t)for(u=o-1;u>=0;--u)r[u+n]=this[u+e];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(u=0;u<o;++u)r[u+n]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+o),n);return o};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 o=r.charCodeAt(0);o<256&&(r=o)}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 u;if(typeof r=="number")for(u=n;u<e;++u)this[u]=r;else{var f=d(r)?r:b(new a(r,t).toString()),c=f.length;for(u=0;u<e-n;++u)this[u+n]=f[u%c]}return this};var zn=/[^+\/0-9A-Za-z-_]/g;function On(i){if(i=Gn(i).replace(zn,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Gn(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Hn(i){return i<16?"0"+i.toString(16):i.toString(16)}function b(i,r){r=r||1/0;for(var n,e=i.length,t=null,o=[],u=0;u<e;++u){if(n=i.charCodeAt(u),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&o.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&o.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&o.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;o.push(n)}else if(n<2048){if((r-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return o}function Vn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Jn(i,r){for(var n,e,t,o=[],u=0;u<i.length&&!((r-=2)<0);++u)n=i.charCodeAt(u),e=n>>8,t=n%256,o.push(t),o.push(e);return o}function Br(i){return In(On(i))}function G(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 Xn(i){return i!==i}function Kn(i){return i!=null&&(!!i._isBuffer||Fr(i)||Qn(i))}function Fr(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Qn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Fr(i.slice(0,0))}function H(i,r,n,e,t){var o,u,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,o=x&(1<<-l)-1,x>>=-l,l+=f;l>0;o=o*256+i[r+s],s+=w,l-=8);for(u=o&(1<<-l)-1,o>>=-l,l+=e;l>0;u=u*256+i[r+s],s+=w,l-=8);if(o===0)o=1-p;else{if(o===c)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),o=o-p}return(x?-1:1)*u*Math.pow(2,o-e)}function vr(i,r,n,e,t,o){var u,f,c,p=o*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:o-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,u=l):(u=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(u++,c/=2),u+s>=l?(f=0,u=l):u+s>=1?(f=(r*c-1)*Math.pow(2,t),u=u+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),u=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(u=u<<t|f,p+=t;p>0;i[n+x]=u&255,x+=m,u/=256,p-=8);i[n+x-m]|=q*128}import fr from"algosdk";import bi,{decodeAddress as zi,encodeAddress as Oi}from"algosdk";var R=[],T=[],Zn=typeof Uint8Array<"u"?Uint8Array:Array,tr=!1;function Yr(){tr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)R[r]=i[r],T[i.charCodeAt(r)]=r;T[45]=62,T[95]=63}function qn(i){tr||Yr();var r,n,e,t,o,u,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=i[f-2]==="="?2:i[f-1]==="="?1:0,u=new Zn(f*3/4-o),e=o>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=T[i.charCodeAt(r)]<<18|T[i.charCodeAt(r+1)]<<12|T[i.charCodeAt(r+2)]<<6|T[i.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=t&255;return o===2?(t=T[i.charCodeAt(r)]<<2|T[i.charCodeAt(r+1)]>>4,u[c++]=t&255):o===1&&(t=T[i.charCodeAt(r)]<<10|T[i.charCodeAt(r+1)]<<4|T[i.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=t&255),u}function jn(i){return R[i>>18&63]+R[i>>12&63]+R[i>>6&63]+R[i&63]}function ri(i,r,n){for(var e,t=[],o=r;o<n;o+=3)e=(i[o]<<16)+(i[o+1]<<8)+i[o+2],t.push(jn(e));return t.join("")}function Pr(i){tr||Yr();for(var r,n=i.length,e=n%3,t="",o=[],u=16383,f=0,c=n-e;f<c;f+=u)o.push(ri(i,f,f+u>c?c:f+u));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+="="),o.push(t),o.join("")}function X(i,r,n,e,t){var o,u,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,o=x&(1<<-l)-1,x>>=-l,l+=f;l>0;o=o*256+i[r+s],s+=w,l-=8);for(u=o&(1<<-l)-1,o>>=-l,l+=e;l>0;u=u*256+i[r+s],s+=w,l-=8);if(o===0)o=1-p;else{if(o===c)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),o=o-p}return(x?-1:1)*u*Math.pow(2,o-e)}function kr(i,r,n,e,t,o){var u,f,c,p=o*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:o-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,u=l):(u=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(u++,c/=2),u+s>=l?(f=0,u=l):u+s>=1?(f=(r*c-1)*Math.pow(2,t),u=u+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),u=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(u=u<<t|f,p+=t;p>0;i[n+x]=u&255,x+=m,u/=256,p-=8);i[n+x-m]|=q*128}var ni={}.toString,Cr=Array.isArray||function(i){return ni.call(i)=="[object Array]"};var ii=50;h.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Mi=V();function V(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(i,r){if(V()<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 or(this,i)}return Mr(this,i,r,n)}h.poolSize=8192;h._augment=function(i){return i.__proto__=h.prototype,i};function Mr(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?oi(i,r,n,e):typeof r=="string"?ti(i,r,n):ui(i,r)}h.from=function(i,r,n){return Mr(null,i,r,n)};h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function Nr(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 ei(i,r,n,e){return Nr(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 ei(null,i,r,n)};function or(i,r){if(Nr(r),i=v(i,r<0?0:ur(r)|0),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}h.allocUnsafe=function(i){return or(null,i)};h.allocUnsafeSlow=function(i){return or(null,i)};function ti(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=Lr(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:ur(r.length)|0;i=v(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function oi(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 ui(i,r){if(_(r)){var n=ur(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"||Ri(r.length)?v(i,0):er(i,r);if(r.type==="Buffer"&&Cr(r.data))return er(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ur(i){if(i>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return i|0}h.isBuffer=_i;function _(i){return!!(i!=null&&i._isBuffer)}h.compare=function(r,n){if(!_(r)||!_(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,o=0,u=Math.min(e,t);o<u;++o)if(r[o]!==n[o]){e=r[o],t=n[o];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(!Cr(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),o=0;for(e=0;e<r.length;++e){var u=r[e];if(!_(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,o),o+=u.length}return t};function Lr(i,r){if(_(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=Lr;function fi(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 gi(this,r,n);case"utf8":case"utf-8":return br(this,r,n);case"ascii":return wi(this,r,n);case"latin1":case"binary":return Ei(this,r,n);case"base64":return li(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yi(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?br(this,0,r):fi.apply(this,arguments)};h.prototype.equals=function(r){if(!_(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=ii;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,o){if(!_(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),o===void 0&&(o=this.length),n<0||e>r.length||t<0||o>this.length)throw new RangeError("out of range index");if(t>=o&&n>=e)return 0;if(t>=o)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,o>>>=0,this===r)return 0;for(var u=o-t,f=e-n,c=Math.min(u,f),p=this.slice(t,o),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){u=p[s],f=l[s];break}return u<f?-1:f<u?1:0};function $r(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)),_(r))return r.length===0?-1:Sr(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):Sr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Sr(i,r,n,e,t){var o=1,u=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;o=2,u/=2,f/=2,n/=2}function c(x,m){return o===1?x[m]:x.readUInt16BE(m*o)}var p;if(t){var l=-1;for(p=n;p<u;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*o}else l!==-1&&(p-=p-l),l=-1}else for(n+f>u&&(n=u-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 $r(this,r,n,e,!0)};h.prototype.lastIndexOf=function(r,n,e){return $r(this,r,n,e,!1)};function ai(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");e>o/2&&(e=o/2);for(var u=0;u<e;++u){var f=parseInt(r.substr(u*2,2),16);if(isNaN(f))return u;i[n+u]=f}return u}function hi(i,r,n,e){return Z(J(r,i.length-n),i,n,e)}function Wr(i,r,n,e){return Z(Ii(r),i,n,e)}function ci(i,r,n,e){return Wr(i,r,n,e)}function si(i,r,n,e){return Z(Hr(r),i,n,e)}function pi(i,r,n,e){return Z(di(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 o=this.length-n;if((e===void 0||e>o)&&(e=o),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return ai(this,r,n,e);case"utf8":case"utf-8":return hi(this,r,n,e);case"ascii":return Wr(this,r,n,e);case"latin1":case"binary":return ci(this,r,n,e);case"base64":return si(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pi(this,r,n,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function li(i,r,n){return r===0&&n===i.length?Pr(i):Pr(i.slice(r,n))}function br(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var o=i[t],u=null,f=o>239?4:o>223?3:o>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:o<128&&(u=o);break;case 2:c=i[t+1],(c&192)===128&&(s=(o&31)<<6|c&63,s>127&&(u=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(o&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(u=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=(o&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(u=s))}}u===null?(u=65533,f=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=f}return xi(e)}var Dr=4096;function xi(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 wi(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 Ei(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 gi(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",o=r;o<n;++o)t+=Ti(i[o]);return t}function yi(i,r,n){for(var e=i.slice(r,n),t="",o=0;o<e.length;o+=2)t+=String.fromCharCode(e[o]+e[o+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 o=n-r;t=new h(o,void 0);for(var u=0;u<o;++u)t[u]=this[u+r]}return t};function g(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||g(r,n,this.length);for(var t=this[r],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;return t};h.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||g(r,n,this.length);for(var t=this[r+--n],o=1;n>0&&(o*=256);)t+=this[r+--n]*o;return t};h.prototype.readUInt8=function(r,n){return n||g(r,1,this.length),this[r]};h.prototype.readUInt16LE=function(r,n){return n||g(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUInt16BE=function(r,n){return n||g(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUInt32LE=function(r,n){return n||g(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||g(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||g(r,n,this.length);for(var t=this[r],o=1,u=0;++u<n&&(o*=256);)t+=this[r+u]*o;return o*=128,t>=o&&(t-=Math.pow(2,8*n)),t};h.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||g(r,n,this.length);for(var t=n,o=1,u=this[r+--t];t>0&&(o*=256);)u+=this[r+--t]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*n)),u};h.prototype.readInt8=function(r,n){return n||g(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,n){n||g(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||g(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||g(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||g(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||g(r,4,this.length),X(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,n){return n||g(r,4,this.length),X(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,n){return n||g(r,8,this.length),X(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,n){return n||g(r,8,this.length),X(this,r,!1,52,8)};function A(i,r,n,e,t,o){if(!_(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<o)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 o=Math.pow(2,8*e)-1;A(this,r,n,e,o,0)}var u=1,f=0;for(this[n]=r&255;++f<e&&(u*=256);)this[n+f]=r/u&255;return n+e};h.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var o=Math.pow(2,8*e)-1;A(this,r,n,e,o,0)}var u=e-1,f=1;for(this[n+u]=r&255;--u>=0&&(f*=256);)this[n+u]=r/f&255;return n+e};h.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||A(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,o=Math.min(i.length-n,2);t<o;++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||A(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||A(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,o=Math.min(i.length-n,4);t<o;++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||A(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||A(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 o=Math.pow(2,8*e-1);A(this,r,n,e,o-1,-o)}var u=0,f=1,c=0;for(this[n]=r&255;++u<e&&(f*=256);)r<0&&c===0&&this[n+u-1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};h.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var o=Math.pow(2,8*e-1);A(this,r,n,e,o-1,-o)}var u=e-1,f=1,c=0;for(this[n+u]=r&255;--u>=0&&(f*=256);)r<0&&c===0&&this[n+u+1]!==0&&(c=1),this[n+u]=(r/f>>0)-c&255;return n+e};h.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||A(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||A(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||A(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||A(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||A(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,o){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Or(i,r,n,e,t){return t||zr(i,r,n,4),kr(i,r,n,e,23,4),n+4}h.prototype.writeFloatLE=function(r,n,e){return Or(this,r,n,!0,e)};h.prototype.writeFloatBE=function(r,n,e){return Or(this,r,n,!1,e)};function Gr(i,r,n,e,t){return t||zr(i,r,n,8),kr(i,r,n,e,52,8),n+8}h.prototype.writeDoubleLE=function(r,n,e){return Gr(this,r,n,!0,e)};h.prototype.writeDoubleBE=function(r,n,e){return Gr(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 o=t-e,u;if(this===r&&e<n&&n<t)for(u=o-1;u>=0;--u)r[u+n]=this[u+e];else if(o<1e3||!h.TYPED_ARRAY_SUPPORT)for(u=0;u<o;++u)r[u+n]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+o),n);return o};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 o=r.charCodeAt(0);o<256&&(r=o)}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 u;if(typeof r=="number")for(u=n;u<e;++u)this[u]=r;else{var f=_(r)?r:J(new h(r,t).toString()),c=f.length;for(u=0;u<e-n;++u)this[u+n]=f[u%c]}return this};var Ai=/[^+\/0-9A-Za-z-_]/g;function mi(i){if(i=Ui(i).replace(Ai,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Ui(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Ti(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,o=[],u=0;u<e;++u){if(n=i.charCodeAt(u),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&o.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&o.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&o.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;o.push(n)}else if(n<2048){if((r-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return o}function Ii(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function di(i,r){for(var n,e,t,o=[],u=0;u<i.length&&!((r-=2)<0);++u)n=i.charCodeAt(u),e=n>>8,t=n%256,o.push(t),o.push(e);return o}function Hr(i){return qn(mi(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 Ri(i){return i!==i}function _i(i){return i!=null&&(!!i._isBuffer||Vr(i)||Bi(i))}function Vr(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Bi(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Vr(i.slice(0,0))}import{encodeAddress as Ki,decodeAddress as Qi}from"algosdk";function Jr(i){return new Uint8Array(h.from(i))}function ji(i){return Jr(i)}function Fi(i,r,n){return fr.makePaymentTxnWithSuggestedParamsFromObject({from:i,to:i,amount:0,note:r&&new Uint8Array(a.from(r,n)),suggestedParams:{fee:0,firstRound:1,lastRound:2,genesisHash:"SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",genesisID:"testnet-v1.0"}})}function re(i,r,n,e){return vi(Fi(i,r,n),e)}async function vi(i,r){let n=fr.encodeUnsignedTransaction(i),e=await r([n]),t=fr.decodeSignedTransaction(e[0]);return new Uint8Array(t.sig)}export{ji as encodeMessage,Fi as generateTxnForSign,re as signTxn};
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function lr(){throw new Error("setTimeout has not been defined")}function Er(){throw new Error("clearTimeout has not been defined")}var L=lr,S=Er;typeof globalThis.setTimeout=="function"&&(L=setTimeout);typeof globalThis.clearTimeout=="function"&&(S=clearTimeout);function xr(t){if(L===setTimeout)return setTimeout(t,0);if((L===lr||!L)&&setTimeout)return L=setTimeout,setTimeout(t,0);try{return L(t,0)}catch{try{return L.call(null,t,0)}catch{return L.call(this,t,0)}}}function he(t){if(S===clearTimeout)return clearTimeout(t);if((S===Er||!S)&&clearTimeout)return S=clearTimeout,clearTimeout(t);try{return S(t)}catch{try{return S.call(null,t)}catch{return S.call(this,t)}}}var O=[],G=!1,P,H=-1;function le(){!G||!P||(G=!1,P.length?O=P.concat(O):H=-1,O.length&&mr())}function mr(){if(!G){var t=xr(le);G=!0;for(var r=O.length;r;){for(P=O,O=[];++H<r;)P&&P[H].run();H=-1,r=O.length}P=null,G=!1,he(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];O.push(new Ar(t,r)),O.length===1&&!G&&xr(mr)}function Ar(t,r){this.fun=t,this.array=r}Ar.prototype.run=function(){this.fun.apply(null,this.array)};var xe="browser",me="browser",Ae=!0,de={},we=[],ge="",Ie={},Te={},_e={};function v(){}var Re=v,ye=v,be=v,Ce=v,Ne=v,De=v,Ue=v;function Oe(t){throw new Error("process.binding is not supported")}function Fe(){return"/"}function Be(t){throw new Error("process.chdir is not supported")}function Le(){return 0}var Y=globalThis.performance||{},Se=Y.now||Y.mozNow||Y.msNow||Y.oNow||Y.webkitNow||function(){return new Date().getTime()};function Pe(t){var r=Se.call(Y)*.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 ve=new Date;function ke(){var t=new Date,r=t-ve;return r/1e3}var E={nextTick:Ee,title:xe,browser:Ae,env:de,argv:we,version:ge,versions:Ie,on:Re,addListener:ye,once:be,off:Ce,removeListener:Ne,removeAllListeners:De,emit:Ue,binding:Oe,cwd:Fe,chdir:Be,umask:Le,hrtime:Pe,platform:me,release:Te,config:_e,uptime:ke},hr={};Object.keys(hr).forEach(t=>{let r=t.split("."),e=E;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=hr[t]:e=e[i]||(e[i]={})}});var y=[],T=[],Me=typeof Uint8Array<"u"?Uint8Array:Array,ir=!1;function Ir(){ir=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)y[r]=t[r],T[t.charCodeAt(r)]=r;T[45]=62,T[95]=63}function Ye(t){ir||Ir();var r,e,n,i,o,a,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[p-2]==="="?2:t[p-1]==="="?1:0,a=new Me(p*3/4-o),n=o>0?p-4:p;var c=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[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return o===2?(i=T[t.charCodeAt(r)]<<2|T[t.charCodeAt(r+1)]>>4,a[c++]=i&255):o===1&&(i=T[t.charCodeAt(r)]<<10|T[t.charCodeAt(r+1)]<<4|T[t.charCodeAt(r+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function Ge(t){return y[t>>18&63]+y[t>>12&63]+y[t>>6&63]+y[t&63]}function He(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(Ge(n));return i.join("")}function dr(t){ir||Ir();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,p=0,c=e-n;p<c;p+=a)o.push(He(t,p,p+a>c?c:p+a));return n===1?(r=t[e-1],i+=y[r>>2],i+=y[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=y[r>>10],i+=y[r>>4&63],i+=y[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 W(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function F(t,r){if(W()<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 or(this,t)}return Tr(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Tr(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?Ke(t,r,e,n):typeof r=="string"?Ve(t,r,e):ze(t,r)}u.from=function(t,r,e){return Tr(null,t,r,e)};u.kMaxLength=W();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function _r(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 We(t,r,e,n){return _r(r),r<=0?F(t,r):e!==void 0?typeof n=="string"?F(t,r).fill(e,n):F(t,r).fill(e):F(t,r)}u.alloc=function(t,r,e){return We(null,t,r,e)};function or(t,r){if(_r(r),t=F(t,r<0?0:ar(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return or(null,t)};u.allocUnsafeSlow=function(t){return or(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=Rr(r,e)|0;t=F(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function nr(t,r){var e=r.length<0?0:ar(r.length)|0;t=F(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Ke(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=nr(t,r),t}function ze(t,r){if(b(r)){var e=ar(r.length)|0;return t=F(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"||ft(r.length)?F(t,0):nr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return nr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ar(t){if(t>=W())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W().toString(16)+" bytes");return t|0}u.isBuffer=ht;function b(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!b(r)||!b(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(!b(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Rr(t,r){if(b(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 V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Or(t).length;default:if(n)return V(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=Rr;function Xe(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 nt(this,r,e);case"utf8":case"utf-8":return Cr(this,r,e);case"ascii":return et(this,r,e);case"latin1":case"binary":return tt(this,r,e);case"base64":return je(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return it(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function k(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)k(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)k(this,e,e+3),k(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)k(this,e,e+7),k(this,e+1,e+6),k(this,e+2,e+5),k(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Cr(this,0,r):Xe.apply(this,arguments)};u.prototype.equals=function(r){if(!b(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(!b(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,p=n-e,c=Math.min(a,p),l=this.slice(i,o),f=r.slice(e,n),h=0;h<c;++h)if(l[h]!==f[h]){a=l[h],p=f[h];break}return a<p?-1:p<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)),b(r))return r.length===0?-1:wr(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):wr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function wr(t,r,e,n,i){var o=1,a=t.length,p=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,p/=2,e/=2}function c(x,I){return o===1?x[I]:x.readUInt16BE(I*o)}var l;if(i){var f=-1;for(l=e;l<a;l++)if(c(t,l)===c(r,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===p)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(e+p>a&&(e=a-p),l=e;l>=0;l--){for(var h=!0,m=0;m<p;m++)if(c(t,l+m)!==c(r,m)){h=!1;break}if(h)return l}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 qe(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 p=parseInt(r.substr(a*2,2),16);if(isNaN(p))return a;t[e+a]=p}return a}function $e(t,r,e,n){return X(V(r,t.length-e),t,e,n)}function br(t,r,e,n){return X(st(r),t,e,n)}function Je(t,r,e,n){return br(t,r,e,n)}function Qe(t,r,e,n){return X(Or(r),t,e,n)}function Ze(t,r,e,n){return X(ct(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 qe(this,r,e,n);case"utf8":case"utf-8":return $e(this,r,e,n);case"ascii":return br(this,r,e,n);case"latin1":case"binary":return Je(this,r,e,n);case"base64":return Qe(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ze(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 je(t,r,e){return r===0&&e===t.length?dr(t):dr(t.slice(r,e))}function Cr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var c,l,f,h;switch(p){case 1:o<128&&(a=o);break;case 2:c=t[i+1],(c&192)===128&&(h=(o&31)<<6|c&63,h>127&&(a=h));break;case 3:c=t[i+1],l=t[i+2],(c&192)===128&&(l&192)===128&&(h=(o&15)<<12|(c&63)<<6|l&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:c=t[i+1],l=t[i+2],f=t[i+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(h=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=p}return rt(n)}var gr=4096;function rt(t){var r=t.length;if(r<=gr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=gr));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 tt(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 nt(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+=pt(t[o]);return i}function it(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 A(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||A(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||A(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||A(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||A(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||A(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||A(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||A(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||A(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||A(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||A(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||A(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||A(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||A(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||A(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||A(r,4,this.length),q(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||A(r,4,this.length),q(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||A(r,8,this.length),q(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||A(r,8,this.length),q(this,r,!1,52,8)};function w(t,r,e,n,i,o){if(!b(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;w(this,r,e,n,o,0)}var a=1,p=0;for(this[e]=r&255;++p<n&&(a*=256);)this[e+p]=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;w(this,r,e,n,o,0)}var a=n-1,p=1;for(this[e+a]=r&255;--a>=0&&(p*=256);)this[e+a]=r/p&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function K(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||w(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):K(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):K(this,r,e,!1),e+2};function z(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||w(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):z(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(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):z(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);w(this,r,e,n,o-1,-o)}var a=0,p=1,c=0;for(this[e]=r&255;++a<n&&(p*=256);)r<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&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);w(this,r,e,n,o-1,-o)}var a=n-1,p=1,c=0;for(this[e+a]=r&255;--a>=0&&(p*=256);)r<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||w(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||w(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):K(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):K(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(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):z(this,r,e,!0),e+4};u.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),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):z(this,r,e,!1),e+4};function Nr(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 Dr(t,r,e,n,i){return i||Nr(t,r,e,4,34028234663852886e22,-34028234663852886e22),Br(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return Dr(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return Dr(this,r,e,!1,n)};function Ur(t,r,e,n,i){return i||Nr(t,r,e,8,17976931348623157e292,-17976931348623157e292),Br(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return Ur(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return Ur(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 p=b(r)?r:V(new u(r,i).toString()),c=p.length;for(a=0;a<n-e;++a)this[a+e]=p[a%c]}return this};var ot=/[^+\/0-9A-Za-z-_]/g;function at(t){if(t=ut(t).replace(ot,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ut(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function pt(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(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 ct(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 Or(t){return Ye(at(t))}function X(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 ft(t){return t!==t}function ht(t){return t!=null&&(!!t._isBuffer||Fr(t)||lt(t))}function Fr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function lt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Fr(t.slice(0,0))}function q(t,r,e,n,i){var o,a,p=i*8-n-1,c=(1<<p)-1,l=c>>1,f=-7,h=e?i-1:0,m=e?-1:1,x=t[r+h];for(h+=m,o=x&(1<<-f)-1,x>>=-f,f+=p;f>0;o=o*256+t[r+h],h+=m,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+t[r+h],h+=m,f-=8);if(o===0)o=1-l;else{if(o===c)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(x?-1:1)*a*Math.pow(2,o-n)}function Br(t,r,e,n,i,o){var a,p,c,l=o*8-i-1,f=(1<<l)-1,h=f>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,I=n?1:-1,tr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+h>=1?r+=m/c:r+=m*Math.pow(2,1-h),r*c>=2&&(a++,c/=2),a+h>=f?(p=0,a=f):a+h>=1?(p=(r*c-1)*Math.pow(2,i),a=a+h):(p=r*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[e+x]=p&255,x+=I,p/=256,i-=8);for(a=a<<i|p,l+=i;l>0;t[e+x]=a&255,x+=I,a/=256,l-=8);t[e+x-I]|=tr*128}function on(t,r){return{id:t.id,address:t.address,chainId:t.chainId,name:t.name,unitName:t.unitName,decimals:t.decimals,isGas:t.isGas,img:t.img,cmcLink:t.cmcLink,isArchived:r?r(t):!1}}function sn(t){return{hash:t.hash,loginAddress:t.loginAddress,loginChainId:t.loginChainId,tokenId:t.token?.id,tokenAddress:t.tokenId,tokenChainId:t.tokenChainId,amount:t.amount,lockedAmount:t.lockedAmount}}var Lr=(e=>(e[e.Buy=0]="Buy",e[e.Sell=1]="Sell",e))(Lr||{}),C=Lr;var Sr=(i=>(i.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",i.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",i.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",i.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",i))(Sr||{}),Pr=(n=>(n.ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT="ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT",n.ACCOUNT_KYC_STATUS_CHANGED="ACCOUNT_KYC_STATUS_CHANGED",n.ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED="ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED",n))(Pr||{}),mi={...Sr,...Pr};function vr(t){switch(t){case C.Buy:return"B";case C.Sell:return"S";default:throw new Error("Unknown order side type: "+t)}}var yo=t=>{let r=new Date(t),e=r.toLocaleDateString("default",{year:"numeric",month:"numeric",day:"numeric"}),n=r.toLocaleTimeString("en-US",{hour12:!0,hour:"2-digit",minute:"2-digit"});return e+" "+n},Yr=(t,r)=>String(t).toLowerCase()===String(r).toLowerCase();function bo(t,r){return t=Math.ceil(t),r=Math.floor(r),Math.floor(Math.random()*(r-t+1))+t}function Co(t){let r=[],e=t.split(".");for(let n=0;n<e.length-1;n++)r.push(e.slice(n).join("."));return r}function No(t){let r=t.headers&&$({Authorization:t.headers.Authorization?.substring(0,200),"CloudFront-Viewer-Country":t.headers["CloudFront-Viewer-Country"],Host:t.headers.Host,origin:t.headers.origin,Referer:t.headers.Referer,"User-Agent":t.headers["User-Agent"],"wl-domain":t.headers["wl-domain"],"X-API-Key":kr(t.headers["X-API-Key"]),"X-Forwarded-For":t.headers["X-Forwarded-For"],"X-Forwarded-Port":t.headers["X-Forwarded-Port"],"X-Forwarded-Proto":t.headers["X-Forwarded-Proto"],"X-Trading-Key":t.headers["X-Trading-Key"],"X-Wallet-Address":t.headers["X-Wallet-Address"],"X-Wallet-Token":t.headers["X-Wallet-Token"],accessToken:kr(t.headers.accessToken),companyId:t.headers.companyId,seasonId:t.headers.seasonId}),e=t.requestContext&&$({identity:t.requestContext.identity&&$({userAgent:t.requestContext.identity.userAgent,sourceIp:t.requestContext.identity.sourceIp}),domainName:t.requestContext.domainName});return $({manage:t.manage,path:t.path,httpMethod:t.httpMethod,headers:r,requestContext:e})}function kr(t){if(!t?.length)return t;let r=Math.round(t.length/3),e=r,n=t.length-r;return t.substring(0,e)+"*".repeat(r)+t.substring(n)}function Mr(t,r){return Array.isArray(t)?t.map(e=>Mr(e,r)):typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t).filter(([e])=>e!==r).map(([e,n])=>[e,Mr(n,r)])):t}function $(t){return Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0))}import _ from"bignumber.js";_.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var xt=(f=>(f.MINUS="-",f.PLUS="+",f.MULTIPLY="*",f.DIVIDE="/",f.GREATER_THAN_OR_EQUAL=">=",f.GREATER_THAN=">",f.LESS_THAN_OR_EQUAL="<=",f.LESS_THAN="<",f.EQUAL="==",f.MOD="mod",f))(xt||{});function Bo(t){return new _(t).abs().toString()}function Lo(t){let e=new _(String(t)).integerValue(_.ROUND_CEIL).toString();return Vr(t,e)||console.log("Ceil value",{value:t,res:e}),e}function So(t,r,e=!1){let n=new _(String(t)),i;if(e){let o=n.toFixed(),a=o.indexOf(".");if(a>=0){let p=o.slice(a+1),c=0;for(let f of p)if(f==="0")c++;else break;let l=c+1;i=n.toFixed(l,_.ROUND_UP)}else i=n.toFixed(0)}else i=n.toFixed(r);return console.log("Fixed value",{value:t,res:i}),i}function Po(t){let e=new _(String(t)).integerValue(_.ROUND_FLOOR).toString();return console.log("Floor value",{value:t,res:e}),e}function vo(t){let e=new _(String(t)).integerValue(_.ROUND_HALF_UP).toString();return console.log("Round value",{value:t,res:e}),e}function Wr(t,r){return N(t,r,"+")}function ko(t,r){return N(t,r,"-")}function mt(t,r){return N(t,r,"*")}function Mo(t,r){return mt(t,r||0)}function Yo(t,r){return N(t,r,"/")}function Go(t,r){return!!N(t,r,">=")}function Ho(t,r){return!!N(t,r,">")}function Wo(t,r){return!!N(t,r,"<=")}function Vo(t,r){return!!N(t,r,"<")}function Vr(t,r){return!!N(t,r,"==")}function At(t,r){return N(t,r,"mod")}function Ko(t,r){return Vr(At(t,r),0)}function N(t,r,e){switch(t=new _(String(t)),r=new _(String(r)),e.toLowerCase()){case"-":return t.minus(r).toString();case"+":return t.plus(r).toString();case"*":case"x":return t.multipliedBy(r).toString();case"\xF7":case"/":return t.dividedBy(r).toString();case">=":return t.isGreaterThanOrEqualTo(r);case">":return t.isGreaterThan(r);case"<=":return t.isLessThanOrEqualTo(r);case"<":return t.isLessThan(r);case"==":return t.isEqualTo(r);case"mod":return t.modulo(r);default:break}}function Gr(t){if(t.toString().includes("e")){let r=t.toString().split("e");return[parseFloat(r[0]),parseFloat(r[1])]}return[t,0]}function Hr(t,r){return t+(r<0?`e${r}`:`e+${r}`)}function Kr({decimalPlaces:t=0},r){if(t>0){let[e,n]=Gr(r),[i,o]=Gr(Math.round(Number(Hr(e,n+t))));return Number(Hr(i,o-t))}return Math.round(r)}function zo(t,r){let e=Number(t);return Kr({decimalPlaces:e},Math.pow(10,-e)*Number(r))}function Xo(t,r){let e=Math.pow(10,Number(t))*Number(r);return Kr({decimalPlaces:0},e)}function ea(t,r,e){let n=t.buyOrder&&t.sellOrder?t.buyOrderId>t.sellOrderId?t.buyOrder:t.sellOrder:t.buyOrder||t.sellOrder;return{pairId:t.pairId,orderId:n?.id,orderSide:n&&vr(n.side),...zr(r,e),...Xr(t,n)}}function ta(t,r,e,n,i){return{id:t.id,pairId:t.pairId,pair:e||t.pair?.pairKey,...zr(n,i),amount:t.amount,price:t.price,total:t.total,filledAmount:t.filledAmount,filledTotal:t.filledTotal,avgPrice:t.excutedPrice,status:t.status,side:t.side,type:t.type,userId:t.userId,createdAt:t.createdAt?.getTime(),completedAt:t.completedAt?.getTime()||null,updatedAt:t.updatedAt?.getTime(),trades:r&&r.map(o=>Xr(o,t))}}function zr(t,r){return{baseTokenId:t?.id,baseTokenDecimal:t?.decimals,quoteTokenId:r?.id,quoteTokenDecimal:r?.decimals}}function Xr(t,r){return{tradeId:t.tradeId,status:t.txStatus,amount:t.amount,total:t.total,price:t.price,fee:r&&t.tradeFees.filter(e=>Yr(e.address,r.userId)).reduce((e,n)=>Wr(e,n.fee),"0"),createdAt:t.createdAt?.getTime(),updatedAt:t.updatedAt?.getTime(),isBuyer:r&&r.side===C.Buy,isMaker:r&&dt(r.side,t.tradeSide)}}function dt(t,r){return t===C.Buy&&r===C.Sell||t===C.Sell&&r===C.Buy}import fr from"algosdk";import Aa,{decodeAddress as da,encodeAddress as wa}from"algosdk";var D=[],R=[],wt=typeof Uint8Array<"u"?Uint8Array:Array,pr=!1;function Qr(){pr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)D[r]=t[r],R[t.charCodeAt(r)]=r;R[45]=62,R[95]=63}function gt(t){pr||Qr();var r,e,n,i,o,a,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[p-2]==="="?2:t[p-1]==="="?1:0,a=new wt(p*3/4-o),n=o>0?p-4:p;var c=0;for(r=0,e=0;r<n;r+=4,e+=3)i=R[t.charCodeAt(r)]<<18|R[t.charCodeAt(r+1)]<<12|R[t.charCodeAt(r+2)]<<6|R[t.charCodeAt(r+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return o===2?(i=R[t.charCodeAt(r)]<<2|R[t.charCodeAt(r+1)]>>4,a[c++]=i&255):o===1&&(i=R[t.charCodeAt(r)]<<10|R[t.charCodeAt(r+1)]<<4|R[t.charCodeAt(r+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function It(t){return D[t>>18&63]+D[t>>12&63]+D[t>>6&63]+D[t&63]}function Tt(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(It(n));return i.join("")}function qr(t){pr||Qr();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,p=0,c=e-n;p<c;p+=a)o.push(Tt(t,p,p+a>c?c:p+a));return n===1?(r=t[e-1],i+=D[r>>2],i+=D[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=D[r>>10],i+=D[r>>4&63],i+=D[r<<2&63],i+="="),o.push(i),o.join("")}function Z(t,r,e,n,i){var o,a,p=i*8-n-1,c=(1<<p)-1,l=c>>1,f=-7,h=e?i-1:0,m=e?-1:1,x=t[r+h];for(h+=m,o=x&(1<<-f)-1,x>>=-f,f+=p;f>0;o=o*256+t[r+h],h+=m,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+t[r+h],h+=m,f-=8);if(o===0)o=1-l;else{if(o===c)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(x?-1:1)*a*Math.pow(2,o-n)}function Zr(t,r,e,n,i,o){var a,p,c,l=o*8-i-1,f=(1<<l)-1,h=f>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,I=n?1:-1,tr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+h>=1?r+=m/c:r+=m*Math.pow(2,1-h),r*c>=2&&(a++,c/=2),a+h>=f?(p=0,a=f):a+h>=1?(p=(r*c-1)*Math.pow(2,i),a=a+h):(p=r*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[e+x]=p&255,x+=I,p/=256,i-=8);for(a=a<<i|p,l+=i;l>0;t[e+x]=a&255,x+=I,a/=256,l-=8);t[e+x-I]|=tr*128}var _t={}.toString,jr=Array.isArray||function(t){return _t.call(t)=="[object Array]"};var Rt=50;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var ha=J();function J(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(J()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=s.prototype):(t===null&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(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 sr(this,t)}return re(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function re(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"?bt(t,r,e):Nt(t,r)}s.from=function(t,r,e){return re(null,t,r,e)};s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array);function ee(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 yt(t,r,e,n){return ee(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)}s.alloc=function(t,r,e){return yt(null,t,r,e)};function sr(t,r){if(ee(r),t=B(t,r<0?0:cr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return sr(null,t)};s.allocUnsafeSlow=function(t){return sr(null,t)};function bt(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=te(r,e)|0;t=B(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function ur(t,r){var e=r.length<0?0:cr(r.length)|0;t=B(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),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=ur(t,r),t}function Nt(t,r){if(U(r)){var e=cr(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"||Xt(r.length)?B(t,0):ur(t,r);if(r.type==="Buffer"&&jr(r.data))return ur(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function cr(t){if(t>=J())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+J().toString(16)+" bytes");return t|0}s.isBuffer=qt;function U(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!U(r)||!U(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};s.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}};s.concat=function(r,e){if(!jr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=s.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!U(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function te(t,r){if(U(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 Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return se(t).length;default:if(n)return Q(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=te;function Dt(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 Mt(this,r,e);case"utf8":case"utf-8":return oe(this,r,e);case"ascii":return vt(this,r,e);case"latin1":case"binary":return kt(this,r,e);case"base64":return St(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}}s.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}s.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};s.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};s.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};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?oe(this,0,r):Dt.apply(this,arguments)};s.prototype.equals=function(r){if(!U(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.inspect=function(){var r="",e=Rt;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};s.prototype.compare=function(r,e,n,i,o){if(!U(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,p=n-e,c=Math.min(a,p),l=this.slice(i,o),f=r.slice(e,n),h=0;h<c;++h)if(l[h]!==f[h]){a=l[h],p=f[h];break}return a<p?-1:p<a?1:0};function ne(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=s.from(r,n)),U(r))return r.length===0?-1:$r(t,r,e,n,i);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):$r(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function $r(t,r,e,n,i){var o=1,a=t.length,p=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,p/=2,e/=2}function c(x,I){return o===1?x[I]:x.readUInt16BE(I*o)}var l;if(i){var f=-1;for(l=e;l<a;l++)if(c(t,l)===c(r,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===p)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(e+p>a&&(e=a-p),l=e;l>=0;l--){for(var h=!0,m=0;m<p;m++)if(c(t,l+m)!==c(r,m)){h=!1;break}if(h)return l}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return ne(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return ne(this,r,e,n,!1)};function Ut(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 p=parseInt(r.substr(a*2,2),16);if(isNaN(p))return a;t[e+a]=p}return a}function Ot(t,r,e,n){return er(Q(r,t.length-e),t,e,n)}function ie(t,r,e,n){return er(Kt(r),t,e,n)}function Ft(t,r,e,n){return ie(t,r,e,n)}function Bt(t,r,e,n){return er(se(r),t,e,n)}function Lt(t,r,e,n){return er(zt(r,t.length-e),t,e,n)}s.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 Ut(this,r,e,n);case"utf8":case"utf-8":return Ot(this,r,e,n);case"ascii":return ie(this,r,e,n);case"latin1":case"binary":return Ft(this,r,e,n);case"base64":return Bt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function St(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function oe(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var c,l,f,h;switch(p){case 1:o<128&&(a=o);break;case 2:c=t[i+1],(c&192)===128&&(h=(o&31)<<6|c&63,h>127&&(a=h));break;case 3:c=t[i+1],l=t[i+2],(c&192)===128&&(l&192)===128&&(h=(o&15)<<12|(c&63)<<6|l&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:c=t[i+1],l=t[i+2],f=t[i+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(h=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=p}return Pt(n)}var Jr=4096;function Pt(t){var r=t.length;if(r<=Jr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Jr));return e}function vt(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 kt(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 Mt(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+=Vt(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}s.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(s.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=s.prototype;else{var o=e-r;i=new s(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")}s.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};s.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};s.prototype.readUInt8=function(r,e){return e||d(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||d(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||d(r,2,this.length),this[r]<<8|this[r+1]};s.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};s.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])};s.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};s.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};s.prototype.readInt8=function(r,e){return e||d(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.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};s.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};s.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};s.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]};s.prototype.readFloatLE=function(r,e){return e||d(r,4,this.length),Z(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||d(r,4,this.length),Z(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||d(r,8,this.length),Z(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||d(r,8,this.length),Z(this,r,!1,52,8)};function g(t,r,e,n,i,o){if(!U(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")}s.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;g(this,r,e,n,o,0)}var a=1,p=0;for(this[e]=r&255;++p<n&&(a*=256);)this[e+p]=r/a&255;return e+n};s.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;g(this,r,e,n,o,0)}var a=n-1,p=1;for(this[e+a]=r&255;--a>=0&&(p*=256);)this[e+a]=r/p&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,1,255,0),s.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}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):j(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):j(this,r,e,!1),e+2};function rr(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}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):rr(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):rr(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);g(this,r,e,n,o-1,-o)}var a=0,p=1,c=0;for(this[e]=r&255;++a<n&&(p*=256);)r<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&255;return e+n};s.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);g(this,r,e,n,o-1,-o)}var a=n-1,p=1,c=0;for(this[e+a]=r&255;--a>=0&&(p*=256);)r<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};s.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):j(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):j(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):rr(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):rr(this,r,e,!1),e+4};function ae(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 ue(t,r,e,n,i){return i||ae(t,r,e,4),Zr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return ue(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return ue(this,r,e,!1,n)};function pe(t,r,e,n,i){return i||ae(t,r,e,8),Zr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return pe(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return pe(this,r,e,!1,n)};s.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||!s.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};s.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"&&!s.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 p=U(r)?r:Q(new s(r,i).toString()),c=p.length;for(a=0;a<n-e;++a)this[a+e]=p[a%c]}return this};var Gt=/[^+\/0-9A-Za-z-_]/g;function Ht(t){if(t=Wt(t).replace(Gt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Wt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Vt(t){return t<16?"0"+t.toString(16):t.toString(16)}function Q(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 Kt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function zt(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 se(t){return gt(Ht(t))}function er(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 Xt(t){return t!==t}function qt(t){return t!=null&&(!!t._isBuffer||ce(t)||$t(t))}function ce(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function $t(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ce(t.slice(0,0))}import{encodeAddress as ya,decodeAddress as ba}from"algosdk";function fe(t){return new Uint8Array(s.from(t))}function Da(t){return fe(t)}function Jt(t,r,e){return fr.makePaymentTxnWithSuggestedParamsFromObject({from:t,to:t,amount:0,note:r&&new Uint8Array(u.from(r,e)),suggestedParams:{fee:0,firstRound:1,lastRound:2,genesisHash:"SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",genesisID:"testnet-v1.0"}})}function Ua(t,r,e,n){return Qt(Jt(t,r,e),n)}async function Qt(t,r){let e=fr.encodeUnsignedTransaction(t),n=await r([e]),i=fr.decodeSignedTransaction(n[0]);return new Uint8Array(i.sig)}export{xt as Operations,Bo as absolute,N as bn_operation,Lo as ceil,zo as convertFromBaseUnits,Xo as convertToBaseUnits,No as cutEvent,Yo as divide,Da as encodeMessage,Vr as equal,Yr as equalIgnoreCase,Po as floor,Jt as generateTxnForSign,Co as getDomains,bo as getRandomInt,Ho as greaterThan,Go as greaterThanOrEqual,dt as isMaker,Vo as lessThan,Wo as lessThanOrEqual,yo as listDateFormat,on as mapToCodexAssetDto,sn as mapToCodexBalanceDto,ta as mapToOrderTradeDto,ea as mapToUserTradeDto,kr as maskingString,ko as minus,At as mod,Ko as modZero,mt as multiply,Wr as plus,Mr as removeField,vo as round,Kr as roundNumber,Ua as signTxn,So as toFixed,Mo as toUsd};
|
|
1
|
+
function lr(){throw new Error("setTimeout has not been defined")}function Er(){throw new Error("clearTimeout has not been defined")}var L=lr,P=Er;typeof globalThis.setTimeout=="function"&&(L=setTimeout);typeof globalThis.clearTimeout=="function"&&(P=clearTimeout);function xr(t){if(L===setTimeout)return setTimeout(t,0);if((L===lr||!L)&&setTimeout)return L=setTimeout,setTimeout(t,0);try{return L(t,0)}catch{try{return L.call(null,t,0)}catch{return L.call(this,t,0)}}}function he(t){if(P===clearTimeout)return clearTimeout(t);if((P===Er||!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 O=[],G=!1,S,H=-1;function le(){!G||!S||(G=!1,S.length?O=S.concat(O):H=-1,O.length&&mr())}function mr(){if(!G){var t=xr(le);G=!0;for(var r=O.length;r;){for(S=O,O=[];++H<r;)S&&S[H].run();H=-1,r=O.length}S=null,G=!1,he(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];O.push(new Ar(t,r)),O.length===1&&!G&&xr(mr)}function Ar(t,r){this.fun=t,this.array=r}Ar.prototype.run=function(){this.fun.apply(null,this.array)};var xe="browser",me="browser",Ae=!0,de={},we=[],ge="",Ie={},Te={},_e={};function v(){}var Re=v,ye=v,be=v,Ce=v,Ue=v,Ne=v,De=v;function Oe(t){throw new Error("process.binding is not supported")}function Fe(){return"/"}function Be(t){throw new Error("process.chdir is not supported")}function Le(){return 0}var Y=globalThis.performance||{},Pe=Y.now||Y.mozNow||Y.msNow||Y.oNow||Y.webkitNow||function(){return new Date().getTime()};function Se(t){var r=Pe.call(Y)*.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 ve=new Date;function ke(){var t=new Date,r=t-ve;return r/1e3}var E={nextTick:Ee,title:xe,browser:Ae,env:de,argv:we,version:ge,versions:Ie,on:Re,addListener:ye,once:be,off:Ce,removeListener:Ue,removeAllListeners:Ne,emit:De,binding:Oe,cwd:Fe,chdir:Be,umask:Le,hrtime:Se,platform:me,release:Te,config:_e,uptime:ke},hr={};Object.keys(hr).forEach(t=>{let r=t.split("."),e=E;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=hr[t]:e=e[i]||(e[i]={})}});var y=[],T=[],Me=typeof Uint8Array<"u"?Uint8Array:Array,ir=!1;function Ir(){ir=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)y[r]=t[r],T[t.charCodeAt(r)]=r;T[45]=62,T[95]=63}function Ye(t){ir||Ir();var r,e,n,i,o,a,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[p-2]==="="?2:t[p-1]==="="?1:0,a=new Me(p*3/4-o),n=o>0?p-4:p;var c=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[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return o===2?(i=T[t.charCodeAt(r)]<<2|T[t.charCodeAt(r+1)]>>4,a[c++]=i&255):o===1&&(i=T[t.charCodeAt(r)]<<10|T[t.charCodeAt(r+1)]<<4|T[t.charCodeAt(r+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function Ge(t){return y[t>>18&63]+y[t>>12&63]+y[t>>6&63]+y[t&63]}function He(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(Ge(n));return i.join("")}function dr(t){ir||Ir();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,p=0,c=e-n;p<c;p+=a)o.push(He(t,p,p+a>c?c:p+a));return n===1?(r=t[e-1],i+=y[r>>2],i+=y[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=y[r>>10],i+=y[r>>4&63],i+=y[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 W(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function F(t,r){if(W()<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 or(this,t)}return Tr(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Tr(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?Ke(t,r,e,n):typeof r=="string"?Ve(t,r,e):ze(t,r)}u.from=function(t,r,e){return Tr(null,t,r,e)};u.kMaxLength=W();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function _r(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 We(t,r,e,n){return _r(r),r<=0?F(t,r):e!==void 0?typeof n=="string"?F(t,r).fill(e,n):F(t,r).fill(e):F(t,r)}u.alloc=function(t,r,e){return We(null,t,r,e)};function or(t,r){if(_r(r),t=F(t,r<0?0:ar(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return or(null,t)};u.allocUnsafeSlow=function(t){return or(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=Rr(r,e)|0;t=F(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function nr(t,r){var e=r.length<0?0:ar(r.length)|0;t=F(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Ke(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=nr(t,r),t}function ze(t,r){if(b(r)){var e=ar(r.length)|0;return t=F(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"||ft(r.length)?F(t,0):nr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return nr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ar(t){if(t>=W())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W().toString(16)+" bytes");return t|0}u.isBuffer=ht;function b(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!b(r)||!b(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(!b(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Rr(t,r){if(b(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 V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Or(t).length;default:if(n)return V(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=Rr;function Xe(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 nt(this,r,e);case"utf8":case"utf-8":return Cr(this,r,e);case"ascii":return et(this,r,e);case"latin1":case"binary":return tt(this,r,e);case"base64":return je(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return it(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function k(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)k(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)k(this,e,e+3),k(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)k(this,e,e+7),k(this,e+1,e+6),k(this,e+2,e+5),k(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Cr(this,0,r):Xe.apply(this,arguments)};u.prototype.equals=function(r){if(!b(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(!b(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,p=n-e,c=Math.min(a,p),l=this.slice(i,o),f=r.slice(e,n),h=0;h<c;++h)if(l[h]!==f[h]){a=l[h],p=f[h];break}return a<p?-1:p<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)),b(r))return r.length===0?-1:wr(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):wr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function wr(t,r,e,n,i){var o=1,a=t.length,p=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,p/=2,e/=2}function c(x,I){return o===1?x[I]:x.readUInt16BE(I*o)}var l;if(i){var f=-1;for(l=e;l<a;l++)if(c(t,l)===c(r,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===p)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(e+p>a&&(e=a-p),l=e;l>=0;l--){for(var h=!0,m=0;m<p;m++)if(c(t,l+m)!==c(r,m)){h=!1;break}if(h)return l}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 qe(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 p=parseInt(r.substr(a*2,2),16);if(isNaN(p))return a;t[e+a]=p}return a}function $e(t,r,e,n){return X(V(r,t.length-e),t,e,n)}function br(t,r,e,n){return X(st(r),t,e,n)}function Je(t,r,e,n){return br(t,r,e,n)}function Qe(t,r,e,n){return X(Or(r),t,e,n)}function Ze(t,r,e,n){return X(ct(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 qe(this,r,e,n);case"utf8":case"utf-8":return $e(this,r,e,n);case"ascii":return br(this,r,e,n);case"latin1":case"binary":return Je(this,r,e,n);case"base64":return Qe(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ze(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 je(t,r,e){return r===0&&e===t.length?dr(t):dr(t.slice(r,e))}function Cr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var c,l,f,h;switch(p){case 1:o<128&&(a=o);break;case 2:c=t[i+1],(c&192)===128&&(h=(o&31)<<6|c&63,h>127&&(a=h));break;case 3:c=t[i+1],l=t[i+2],(c&192)===128&&(l&192)===128&&(h=(o&15)<<12|(c&63)<<6|l&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:c=t[i+1],l=t[i+2],f=t[i+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(h=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=p}return rt(n)}var gr=4096;function rt(t){var r=t.length;if(r<=gr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=gr));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 tt(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 nt(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+=pt(t[o]);return i}function it(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 A(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||A(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||A(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||A(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||A(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||A(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||A(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||A(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||A(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||A(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||A(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||A(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||A(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||A(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||A(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||A(r,4,this.length),q(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||A(r,4,this.length),q(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||A(r,8,this.length),q(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||A(r,8,this.length),q(this,r,!1,52,8)};function w(t,r,e,n,i,o){if(!b(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;w(this,r,e,n,o,0)}var a=1,p=0;for(this[e]=r&255;++p<n&&(a*=256);)this[e+p]=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;w(this,r,e,n,o,0)}var a=n-1,p=1;for(this[e+a]=r&255;--a>=0&&(p*=256);)this[e+a]=r/p&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function K(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||w(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):K(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):K(this,r,e,!1),e+2};function z(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||w(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):z(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(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):z(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);w(this,r,e,n,o-1,-o)}var a=0,p=1,c=0;for(this[e]=r&255;++a<n&&(p*=256);)r<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&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);w(this,r,e,n,o-1,-o)}var a=n-1,p=1,c=0;for(this[e+a]=r&255;--a>=0&&(p*=256);)r<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||w(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||w(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):K(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):K(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(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):z(this,r,e,!0),e+4};u.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),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):z(this,r,e,!1),e+4};function Ur(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 Nr(t,r,e,n,i){return i||Ur(t,r,e,4,34028234663852886e22,-34028234663852886e22),Br(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return Nr(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return Nr(this,r,e,!1,n)};function Dr(t,r,e,n,i){return i||Ur(t,r,e,8,17976931348623157e292,-17976931348623157e292),Br(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return Dr(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return Dr(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 p=b(r)?r:V(new u(r,i).toString()),c=p.length;for(a=0;a<n-e;++a)this[a+e]=p[a%c]}return this};var ot=/[^+\/0-9A-Za-z-_]/g;function at(t){if(t=ut(t).replace(ot,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ut(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function pt(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(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 ct(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 Or(t){return Ye(at(t))}function X(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 ft(t){return t!==t}function ht(t){return t!=null&&(!!t._isBuffer||Fr(t)||lt(t))}function Fr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function lt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Fr(t.slice(0,0))}function q(t,r,e,n,i){var o,a,p=i*8-n-1,c=(1<<p)-1,l=c>>1,f=-7,h=e?i-1:0,m=e?-1:1,x=t[r+h];for(h+=m,o=x&(1<<-f)-1,x>>=-f,f+=p;f>0;o=o*256+t[r+h],h+=m,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+t[r+h],h+=m,f-=8);if(o===0)o=1-l;else{if(o===c)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(x?-1:1)*a*Math.pow(2,o-n)}function Br(t,r,e,n,i,o){var a,p,c,l=o*8-i-1,f=(1<<l)-1,h=f>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,I=n?1:-1,tr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+h>=1?r+=m/c:r+=m*Math.pow(2,1-h),r*c>=2&&(a++,c/=2),a+h>=f?(p=0,a=f):a+h>=1?(p=(r*c-1)*Math.pow(2,i),a=a+h):(p=r*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[e+x]=p&255,x+=I,p/=256,i-=8);for(a=a<<i|p,l+=i;l>0;t[e+x]=a&255,x+=I,a/=256,l-=8);t[e+x-I]|=tr*128}function on(t,r){return{id:t.id,address:t.address,chainId:t.chainId,name:t.name,unitName:t.unitName,decimals:t.decimals,isGas:t.isGas,img:t.img,cmcLink:t.cmcLink,isArchived:r?r(t):!1}}function sn(t){return{hash:t.hash,loginAddress:t.loginAddress,loginChainId:t.loginChainId,tokenId:t.token?.id,tokenAddress:t.tokenId,tokenChainId:t.tokenChainId,amount:t.amount,lockedAmount:t.lockedAmount}}var Lr=(e=>(e[e.Buy=0]="Buy",e[e.Sell=1]="Sell",e))(Lr||{}),C=Lr;var Pr=(i=>(i.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",i.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",i.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",i.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",i))(Pr||{}),Sr=(n=>(n.ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT="ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT",n.ACCOUNT_KYC_STATUS_CHANGED="ACCOUNT_KYC_STATUS_CHANGED",n.ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED="ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED",n))(Sr||{}),mi={...Pr,...Sr};function vr(t){switch(t){case C.Buy:return"B";case C.Sell:return"S";default:throw new Error("Unknown order side type: "+t)}}var yo=t=>{let r=new Date(t),e=r.toLocaleDateString("default",{year:"numeric",month:"numeric",day:"numeric"}),n=r.toLocaleTimeString("en-US",{hour12:!0,hour:"2-digit",minute:"2-digit"});return e+" "+n},Yr=(t,r)=>String(t).toLowerCase()===String(r).toLowerCase();function bo(t,r){return t=Math.ceil(t),r=Math.floor(r),Math.floor(Math.random()*(r-t+1))+t}function Co(t){let r=[],e=t.split(".");for(let n=0;n<e.length-1;n++)r.push(e.slice(n).join("."));return r}function Uo(t){let r=t.headers&&$({Authorization:t.headers.Authorization?.substring(0,200),"CloudFront-Viewer-Country":t.headers["CloudFront-Viewer-Country"],Host:t.headers.Host,origin:t.headers.origin,Referer:t.headers.Referer,"User-Agent":t.headers["User-Agent"],"wl-domain":t.headers["wl-domain"],"X-API-Key":kr(t.headers["X-API-Key"]),"X-Forwarded-For":t.headers["X-Forwarded-For"],"X-Forwarded-Port":t.headers["X-Forwarded-Port"],"X-Forwarded-Proto":t.headers["X-Forwarded-Proto"],"X-Trading-Key":t.headers["X-Trading-Key"],"X-Wallet-Address":t.headers["X-Wallet-Address"],"X-Wallet-Token":t.headers["X-Wallet-Token"],accessToken:kr(t.headers.accessToken),companyId:t.headers.companyId,seasonId:t.headers.seasonId}),e=t.requestContext&&$({identity:t.requestContext.identity&&$({userAgent:t.requestContext.identity.userAgent,sourceIp:t.requestContext.identity.sourceIp}),domainName:t.requestContext.domainName});return $({manage:t.manage,path:t.path,httpMethod:t.httpMethod,headers:r,requestContext:e})}function kr(t){if(!t?.length)return t;let r=Math.round(t.length/3),e=r,n=t.length-r;return t.substring(0,e)+"*".repeat(r)+t.substring(n)}function Mr(t,r){return Array.isArray(t)?t.map(e=>Mr(e,r)):typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t).filter(([e])=>e!==r).map(([e,n])=>[e,Mr(n,r)])):t}function $(t){return Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0))}import _ from"bignumber.js";_.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var xt=(f=>(f.MINUS="-",f.PLUS="+",f.MULTIPLY="*",f.DIVIDE="/",f.GREATER_THAN_OR_EQUAL=">=",f.GREATER_THAN=">",f.LESS_THAN_OR_EQUAL="<=",f.LESS_THAN="<",f.EQUAL="==",f.MOD="mod",f))(xt||{});function Bo(t){return new _(t).abs().toString()}function Lo(t){let e=new _(String(t)).integerValue(_.ROUND_CEIL).toString();return Vr(t,e)||console.log("Ceil value",{value:t,res:e}),e}function Po(t,r,e=!1){let n=new _(String(t)),i;if(e){let o=n.toFixed(),a=o.indexOf(".");if(a>=0){let p=o.slice(a+1),c=0;for(let f of p)if(f==="0")c++;else break;let l=c+1;i=n.toFixed(l,_.ROUND_UP)}else i=n.toFixed(0)}else i=n.toFixed(r);return console.log("Fixed value",{value:t,res:i}),i}function So(t){let e=new _(String(t)).integerValue(_.ROUND_FLOOR).toString();return console.log("Floor value",{value:t,res:e}),e}function vo(t){let e=new _(String(t)).integerValue(_.ROUND_HALF_UP).toString();return console.log("Round value",{value:t,res:e}),e}function Wr(t,r){return U(t,r,"+")}function ko(t,r){return U(t,r,"-")}function mt(t,r){return U(t,r,"*")}function Mo(t,r){return mt(t,r||0)}function Yo(t,r){return U(t,r,"/")}function Go(t,r){return!!U(t,r,">=")}function Ho(t,r){return!!U(t,r,">")}function Wo(t,r){return!!U(t,r,"<=")}function Vo(t,r){return!!U(t,r,"<")}function Vr(t,r){return!!U(t,r,"==")}function At(t,r){return U(t,r,"mod")}function Ko(t,r){return Vr(At(t,r),0)}function U(t,r,e){switch(t=new _(String(t)),r=new _(String(r)),e.toLowerCase()){case"-":return t.minus(r).toString();case"+":return t.plus(r).toString();case"*":case"x":return t.multipliedBy(r).toString();case"\xF7":case"/":return t.dividedBy(r).toString();case">=":return t.isGreaterThanOrEqualTo(r);case">":return t.isGreaterThan(r);case"<=":return t.isLessThanOrEqualTo(r);case"<":return t.isLessThan(r);case"==":return t.isEqualTo(r);case"mod":return t.modulo(r);default:break}}function Gr(t){if(t.toString().includes("e")){let r=t.toString().split("e");return[parseFloat(r[0]),parseFloat(r[1])]}return[t,0]}function Hr(t,r){return t+(r<0?`e${r}`:`e+${r}`)}function Kr({decimalPlaces:t=0},r){if(t>0){let[e,n]=Gr(r),[i,o]=Gr(Math.round(Number(Hr(e,n+t))));return Number(Hr(i,o-t))}return Math.round(r)}function zo(t,r){let e=Number(t);return Kr({decimalPlaces:e},Math.pow(10,-e)*Number(r))}function Xo(t,r){let e=Math.pow(10,Number(t))*Number(r);return Kr({decimalPlaces:0},e)}function ea(t,r,e){let n=t.buyOrder&&t.sellOrder?t.buyOrderId>t.sellOrderId?t.buyOrder:t.sellOrder:t.buyOrder||t.sellOrder;return{pairId:t.pairId,orderId:n?.id,orderSide:n&&vr(n.side),...zr(r,e),...Xr(t,n)}}function ta(t,r,e,n,i){return{id:t.id,pairId:t.pairId,pair:e||t.pair?.pairKey,...zr(n,i),amount:t.amount,price:t.price,total:t.total,filledAmount:t.filledAmount,filledTotal:t.filledTotal,avgPrice:t.excutedPrice,status:t.status,side:t.side,type:t.type,userId:t.userId,createdAt:t.createdAt?.getTime(),completedAt:t.completedAt?.getTime()||null,updatedAt:t.updatedAt?.getTime(),trades:r&&r.map(o=>Xr(o,t))}}function zr(t,r){return{baseTokenId:t?.id,baseTokenDecimal:t?.decimals,quoteTokenId:r?.id,quoteTokenDecimal:r?.decimals}}function Xr(t,r){return{tradeId:t.tradeId,status:t.txStatus,amount:t.amount,total:t.total,price:t.price,fee:r&&t.tradeFees.filter(e=>Yr(e.address,r.userId)).reduce((e,n)=>Wr(e,n.fee),"0"),createdAt:t.createdAt?.getTime(),updatedAt:t.updatedAt?.getTime(),isBuyer:r&&r.side===C.Buy,isMaker:r&&dt(r.side,t.tradeSide)}}function dt(t,r){return t===C.Buy&&r===C.Sell||t===C.Sell&&r===C.Buy}import fr from"algosdk";import Aa,{decodeAddress as da,encodeAddress as wa}from"algosdk";var N=[],R=[],wt=typeof Uint8Array<"u"?Uint8Array:Array,pr=!1;function Qr(){pr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)N[r]=t[r],R[t.charCodeAt(r)]=r;R[45]=62,R[95]=63}function gt(t){pr||Qr();var r,e,n,i,o,a,p=t.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[p-2]==="="?2:t[p-1]==="="?1:0,a=new wt(p*3/4-o),n=o>0?p-4:p;var c=0;for(r=0,e=0;r<n;r+=4,e+=3)i=R[t.charCodeAt(r)]<<18|R[t.charCodeAt(r+1)]<<12|R[t.charCodeAt(r+2)]<<6|R[t.charCodeAt(r+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=i&255;return o===2?(i=R[t.charCodeAt(r)]<<2|R[t.charCodeAt(r+1)]>>4,a[c++]=i&255):o===1&&(i=R[t.charCodeAt(r)]<<10|R[t.charCodeAt(r+1)]<<4|R[t.charCodeAt(r+2)]>>2,a[c++]=i>>8&255,a[c++]=i&255),a}function It(t){return N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[t&63]}function Tt(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(It(n));return i.join("")}function qr(t){pr||Qr();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,p=0,c=e-n;p<c;p+=a)o.push(Tt(t,p,p+a>c?c:p+a));return n===1?(r=t[e-1],i+=N[r>>2],i+=N[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=N[r>>10],i+=N[r>>4&63],i+=N[r<<2&63],i+="="),o.push(i),o.join("")}function Z(t,r,e,n,i){var o,a,p=i*8-n-1,c=(1<<p)-1,l=c>>1,f=-7,h=e?i-1:0,m=e?-1:1,x=t[r+h];for(h+=m,o=x&(1<<-f)-1,x>>=-f,f+=p;f>0;o=o*256+t[r+h],h+=m,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+t[r+h],h+=m,f-=8);if(o===0)o=1-l;else{if(o===c)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(x?-1:1)*a*Math.pow(2,o-n)}function Zr(t,r,e,n,i,o){var a,p,c,l=o*8-i-1,f=(1<<l)-1,h=f>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,I=n?1:-1,tr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+h>=1?r+=m/c:r+=m*Math.pow(2,1-h),r*c>=2&&(a++,c/=2),a+h>=f?(p=0,a=f):a+h>=1?(p=(r*c-1)*Math.pow(2,i),a=a+h):(p=r*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[e+x]=p&255,x+=I,p/=256,i-=8);for(a=a<<i|p,l+=i;l>0;t[e+x]=a&255,x+=I,a/=256,l-=8);t[e+x-I]|=tr*128}var _t={}.toString,jr=Array.isArray||function(t){return _t.call(t)=="[object Array]"};var Rt=50;s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var ha=J();function J(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(J()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=s.prototype):(t===null&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(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 sr(this,t)}return re(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function re(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"?bt(t,r,e):Ut(t,r)}s.from=function(t,r,e){return re(null,t,r,e)};s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array);function ee(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 yt(t,r,e,n){return ee(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)}s.alloc=function(t,r,e){return yt(null,t,r,e)};function sr(t,r){if(ee(r),t=B(t,r<0?0:cr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return sr(null,t)};s.allocUnsafeSlow=function(t){return sr(null,t)};function bt(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=te(r,e)|0;t=B(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function ur(t,r){var e=r.length<0?0:cr(r.length)|0;t=B(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),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=ur(t,r),t}function Ut(t,r){if(D(r)){var e=cr(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"||Xt(r.length)?B(t,0):ur(t,r);if(r.type==="Buffer"&&jr(r.data))return ur(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function cr(t){if(t>=J())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+J().toString(16)+" bytes");return t|0}s.isBuffer=qt;function D(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!D(r)||!D(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};s.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}};s.concat=function(r,e){if(!jr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=s.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!D(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function te(t,r){if(D(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 Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return se(t).length;default:if(n)return Q(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=te;function Nt(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 Mt(this,r,e);case"utf8":case"utf-8":return oe(this,r,e);case"ascii":return vt(this,r,e);case"latin1":case"binary":return kt(this,r,e);case"base64":return Pt(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}}s.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}s.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};s.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};s.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};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?oe(this,0,r):Nt.apply(this,arguments)};s.prototype.equals=function(r){if(!D(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.inspect=function(){var r="",e=Rt;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};s.prototype.compare=function(r,e,n,i,o){if(!D(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,p=n-e,c=Math.min(a,p),l=this.slice(i,o),f=r.slice(e,n),h=0;h<c;++h)if(l[h]!==f[h]){a=l[h],p=f[h];break}return a<p?-1:p<a?1:0};function ne(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=s.from(r,n)),D(r))return r.length===0?-1:$r(t,r,e,n,i);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):$r(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function $r(t,r,e,n,i){var o=1,a=t.length,p=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,p/=2,e/=2}function c(x,I){return o===1?x[I]:x.readUInt16BE(I*o)}var l;if(i){var f=-1;for(l=e;l<a;l++)if(c(t,l)===c(r,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===p)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(e+p>a&&(e=a-p),l=e;l>=0;l--){for(var h=!0,m=0;m<p;m++)if(c(t,l+m)!==c(r,m)){h=!1;break}if(h)return l}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return ne(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return ne(this,r,e,n,!1)};function Dt(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 p=parseInt(r.substr(a*2,2),16);if(isNaN(p))return a;t[e+a]=p}return a}function Ot(t,r,e,n){return er(Q(r,t.length-e),t,e,n)}function ie(t,r,e,n){return er(Kt(r),t,e,n)}function Ft(t,r,e,n){return ie(t,r,e,n)}function Bt(t,r,e,n){return er(se(r),t,e,n)}function Lt(t,r,e,n){return er(zt(r,t.length-e),t,e,n)}s.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 Dt(this,r,e,n);case"utf8":case"utf-8":return Ot(this,r,e,n);case"ascii":return ie(this,r,e,n);case"latin1":case"binary":return Ft(this,r,e,n);case"base64":return Bt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pt(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function oe(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,p=o>239?4:o>223?3:o>191?2:1;if(i+p<=e){var c,l,f,h;switch(p){case 1:o<128&&(a=o);break;case 2:c=t[i+1],(c&192)===128&&(h=(o&31)<<6|c&63,h>127&&(a=h));break;case 3:c=t[i+1],l=t[i+2],(c&192)===128&&(l&192)===128&&(h=(o&15)<<12|(c&63)<<6|l&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:c=t[i+1],l=t[i+2],f=t[i+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(h=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,p=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=p}return St(n)}var Jr=4096;function St(t){var r=t.length;if(r<=Jr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Jr));return e}function vt(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 kt(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 Mt(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+=Vt(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}s.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(s.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=s.prototype;else{var o=e-r;i=new s(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")}s.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};s.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};s.prototype.readUInt8=function(r,e){return e||d(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||d(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||d(r,2,this.length),this[r]<<8|this[r+1]};s.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};s.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])};s.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};s.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};s.prototype.readInt8=function(r,e){return e||d(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.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};s.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};s.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};s.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]};s.prototype.readFloatLE=function(r,e){return e||d(r,4,this.length),Z(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||d(r,4,this.length),Z(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||d(r,8,this.length),Z(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||d(r,8,this.length),Z(this,r,!1,52,8)};function g(t,r,e,n,i,o){if(!D(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")}s.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;g(this,r,e,n,o,0)}var a=1,p=0;for(this[e]=r&255;++p<n&&(a*=256);)this[e+p]=r/a&255;return e+n};s.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;g(this,r,e,n,o,0)}var a=n-1,p=1;for(this[e+a]=r&255;--a>=0&&(p*=256);)this[e+a]=r/p&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,1,255,0),s.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}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):j(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):j(this,r,e,!1),e+2};function rr(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}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):rr(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):rr(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);g(this,r,e,n,o-1,-o)}var a=0,p=1,c=0;for(this[e]=r&255;++a<n&&(p*=256);)r<0&&c===0&&this[e+a-1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&255;return e+n};s.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);g(this,r,e,n,o-1,-o)}var a=n-1,p=1,c=0;for(this[e+a]=r&255;--a>=0&&(p*=256);)r<0&&c===0&&this[e+a+1]!==0&&(c=1),this[e+a]=(r/p>>0)-c&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};s.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):j(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):j(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):rr(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||g(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):rr(this,r,e,!1),e+4};function ae(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 ue(t,r,e,n,i){return i||ae(t,r,e,4),Zr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return ue(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return ue(this,r,e,!1,n)};function pe(t,r,e,n,i){return i||ae(t,r,e,8),Zr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return pe(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return pe(this,r,e,!1,n)};s.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||!s.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};s.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"&&!s.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 p=D(r)?r:Q(new s(r,i).toString()),c=p.length;for(a=0;a<n-e;++a)this[a+e]=p[a%c]}return this};var Gt=/[^+\/0-9A-Za-z-_]/g;function Ht(t){if(t=Wt(t).replace(Gt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Wt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Vt(t){return t<16?"0"+t.toString(16):t.toString(16)}function Q(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 Kt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function zt(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 se(t){return gt(Ht(t))}function er(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 Xt(t){return t!==t}function qt(t){return t!=null&&(!!t._isBuffer||ce(t)||$t(t))}function ce(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function $t(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ce(t.slice(0,0))}import{encodeAddress as ya,decodeAddress as ba}from"algosdk";function fe(t){return new Uint8Array(s.from(t))}function Na(t){return fe(t)}function Jt(t,r,e){return fr.makePaymentTxnWithSuggestedParamsFromObject({from:t,to:t,amount:0,note:r&&new Uint8Array(u.from(r,e)),suggestedParams:{fee:0,firstRound:1,lastRound:2,genesisHash:"SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",genesisID:"testnet-v1.0"}})}function Da(t,r,e,n){return Qt(Jt(t,r,e),n)}async function Qt(t,r){let e=fr.encodeUnsignedTransaction(t),n=await r([e]),i=fr.decodeSignedTransaction(n[0]);return new Uint8Array(i.sig)}export{xt as Operations,Bo as absolute,U as bn_operation,Lo as ceil,zo as convertFromBaseUnits,Xo as convertToBaseUnits,Uo as cutEvent,Yo as divide,Na as encodeMessage,Vr as equal,Yr as equalIgnoreCase,So as floor,Jt as generateTxnForSign,Co as getDomains,bo as getRandomInt,Ho as greaterThan,Go as greaterThanOrEqual,dt as isMaker,Vo as lessThan,Wo as lessThanOrEqual,yo as listDateFormat,on as mapToCodexAssetDto,sn as mapToCodexBalanceDto,ta as mapToOrderTradeDto,ea as mapToUserTradeDto,kr as maskingString,ko as minus,At as mod,Ko as modZero,mt as multiply,Wr as plus,Mr as removeField,vo as round,Kr as roundNumber,Da as signTxn,Po as toFixed,Mo as toUsd};
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|