@ultrade/shared 1.0.23 → 1.0.25
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/constants/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/assert.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/pointSystem.helper.js +1 -1
- 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/dist/src/types/settings.type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function fr(){throw new Error("setTimeout has not been defined")}function lr(){throw new Error("clearTimeout has not been defined")}var B=fr,P=lr;typeof globalThis.setTimeout=="function"&&(B=setTimeout);typeof globalThis.clearTimeout=="function"&&(P=clearTimeout);function pr(t){if(B===setTimeout)return setTimeout(t,0);if((B===fr||!B)&&setTimeout)return B=setTimeout,setTimeout(t,0);try{return B(t,0)}catch{try{return B.call(null,t,0)}catch{return B.call(this,t,0)}}}function jr(t){if(P===clearTimeout)return clearTimeout(t);if((P===lr||!P)&&clearTimeout)return P=clearTimeout,clearTimeout(t);try{return P(t)}catch{try{return P.call(null,t)}catch{return P.call(this,t)}}}var k=[],O=!1,v,L=-1;function re(){!O||!v||(O=!1,v.length?k=v.concat(k):L=-1,k.length&&hr())}function hr(){if(!O){var t=pr(re);O=!0;for(var r=k.length;r;){for(v=k,k=[];++L<r;)v&&v[L].run();L=-1,r=k.length}v=null,O=!1,jr(t)}}function ee(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];k.push(new mr(t,r)),k.length===1&&!O&&pr(hr)}function mr(t,r){this.fun=t,this.array=r}mr.prototype.run=function(){this.fun.apply(null,this.array)};var te="browser",ne="browser",ie=!0,oe={},ae=[],ue="",se={},ce={},fe={};function D(){}var le=D,pe=D,he=D,me=D,ge=D,xe=D,de=D;function be(t){throw new Error("process.binding is not supported")}function Ee(){return"/"}function we(t){throw new Error("process.chdir is not supported")}function Te(){return 0}var F=globalThis.performance||{},ye=F.now||F.mozNow||F.msNow||F.oNow||F.webkitNow||function(){return new Date().getTime()};function _e(t){var r=ye.call(F)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var Ae=new Date;function Ie(){var t=new Date,r=t-Ae;return r/1e3}var x={nextTick:ee,title:te,browser:ie,env:oe,argv:ae,version:ue,versions:se,on:le,addListener:pe,once:he,off:me,removeListener:ge,removeAllListeners:xe,emit:de,binding:be,cwd:Ee,chdir:we,umask:Te,hrtime:_e,platform:ne,release:ce,config:fe,uptime:Ie},cr={};Object.keys(cr).forEach(t=>{let r=t.split("."),e=x;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=cr[t]:e=e[i]||(e[i]={})}});var A=[],y=[],Re=typeof Uint8Array<"u"?Uint8Array:Array,er=!1;function br(){er=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)A[r]=t[r],y[t.charCodeAt(r)]=r;y[45]=62,y[95]=63}function Se(t){er||br();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new Re(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=y[t.charCodeAt(r)]<<18|y[t.charCodeAt(r+1)]<<12|y[t.charCodeAt(r+2)]<<6|y[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=y[t.charCodeAt(r)]<<2|y[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=y[t.charCodeAt(r)]<<10|y[t.charCodeAt(r+1)]<<4|y[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function ke(t){return A[t>>18&63]+A[t>>12&63]+A[t>>6&63]+A[t&63]}function Ue(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(ke(n));return i.join("")}function gr(t){er||br();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(Ue(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=A[r>>2],i+=A[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=A[r>>10],i+=A[r>>4&63],i+=A[r<<2&63],i+="="),o.push(i),o.join("")}u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function Y(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(t,r){if(Y()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return tr(this,t)}return Er(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Er(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Pe(t,r,e,n):typeof r=="string"?Be(t,r,e):ve(t,r)}u.from=function(t,r,e){return Er(null,t,r,e)};u.kMaxLength=Y();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function wr(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ne(t,r,e,n){return wr(r),r<=0?U(t,r):e!==void 0?typeof n=="string"?U(t,r).fill(e,n):U(t,r).fill(e):U(t,r)}u.alloc=function(t,r,e){return Ne(null,t,r,e)};function tr(t,r){if(wr(r),t=U(t,r<0?0:nr(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return tr(null,t)};u.allocUnsafeSlow=function(t){return tr(null,t)};function Be(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Tr(r,e)|0;t=U(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function rr(t,r){var e=r.length<0?0:nr(r.length)|0;t=U(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Pe(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=rr(t,r),t}function ve(t,r){if(I(r)){var e=nr(r.length)|0;return t=U(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ze(r.length)?U(t,0):rr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return rr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function nr(t){if(t>=Y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y().toString(16)+" bytes");return t|0}u.isBuffer=je;function I(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!I(r)||!I(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};u.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=u.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!I(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Tr(t,r){if(I(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return kr(t).length;default:if(n)return W(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=Tr;function De(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ve(this,r,e);case"utf8":case"utf-8":return Ar(this,r,e);case"ascii":return Ge(this,r,e);case"latin1":case"binary":return He(this,r,e);case"base64":return Ye(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ke(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function C(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)C(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)C(this,e,e+3),C(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)C(this,e,e+7),C(this,e+1,e+6),C(this,e+2,e+5),C(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ar(this,0,r):De.apply(this,arguments)};u.prototype.equals=function(r){if(!I(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.compare=function(r,e,n,i,o){if(!I(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function yr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),I(r))return r.length===0?-1:xr(t,r,e,n,i);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):xr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function xr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(m,T){return o===1?m[T]:m.readUInt16BE(T*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,g=0;g<s;g++)if(f(t,p+g)!==f(r,g)){l=!1;break}if(l)return p}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return yr(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return yr(this,r,e,n,!1)};function Ce(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function Me(t,r,e,n){return V(W(r,t.length-e),t,e,n)}function _r(t,r,e,n){return V(Xe(r),t,e,n)}function Fe(t,r,e,n){return _r(t,r,e,n)}function Oe(t,r,e,n){return V(kr(r),t,e,n)}function Le(t,r,e,n){return V(Qe(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ce(this,r,e,n);case"utf8":case"utf-8":return Me(this,r,e,n);case"ascii":return _r(this,r,e,n);case"latin1":case"binary":return Fe(this,r,e,n);case"base64":return Oe(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Le(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ye(t,r,e){return r===0&&e===t.length?gr(t):gr(t.slice(r,e))}function Ar(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return We(n)}var dr=4096;function We(t){var r=t.length;if(r<=dr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=dr));return e}function Ge(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function He(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function Ve(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Je(t[o]);return i}function Ke(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(u.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=u.prototype;else{var o=e-r;i=new u(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function d(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};u.prototype.readUInt8=function(r,e){return e||d(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||d(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||d(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||d(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||d(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};u.prototype.readInt8=function(r,e){return e||d(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||d(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||d(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||d(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||d(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||d(r,4,this.length),K(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||d(r,4,this.length),K(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||d(r,8,this.length),K(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||d(r,8,this.length),K(this,r,!1,52,8)};function E(t,r,e,n,i,o){if(!I(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function G(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};function H(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):H(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):H(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};function Ir(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Rr(t,r,e,n,i){return i||Ir(t,r,e,4,34028234663852886e22,-34028234663852886e22),Nr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return Rr(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return Rr(this,r,e,!1,n)};function Sr(t,r,e,n,i){return i||Ir(t,r,e,8,17976931348623157e292,-17976931348623157e292),Nr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return Sr(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return Sr(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};u.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=I(r)?r:W(new u(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var $e=/[^+\/0-9A-Za-z-_]/g;function ze(t){if(t=qe(t).replace($e,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function qe(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Je(t){return t<16?"0"+t.toString(16):t.toString(16)}function W(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Xe(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Qe(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function kr(t){return Se(ze(t))}function V(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Ze(t){return t!==t}function je(t){return t!=null&&(!!t._isBuffer||Ur(t)||rt(t))}function Ur(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Ur(t.slice(0,0))}function K(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,g=e?-1:1,m=t[r+l];for(l+=g,o=m&(1<<-h)-1,m>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=g,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=g,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(m?-1:1)*a*Math.pow(2,o-n)}function Nr(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,T=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=g/f:r+=g*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+m]=s&255,m+=T,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+m]=a&255,m+=T,a/=256,p-=8);t[e+m-T]|=j*128}import sr from"algosdk";import zt,{decodeAddress as qt,encodeAddress as Jt}from"algosdk";var R=[],_=[],et=typeof Uint8Array<"u"?Uint8Array:Array,or=!1;function Dr(){or=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],_[t.charCodeAt(r)]=r;_[45]=62,_[95]=63}function tt(t){or||Dr();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new et(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=_[t.charCodeAt(r)]<<18|_[t.charCodeAt(r+1)]<<12|_[t.charCodeAt(r+2)]<<6|_[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=_[t.charCodeAt(r)]<<2|_[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=_[t.charCodeAt(r)]<<10|_[t.charCodeAt(r+1)]<<4|_[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function nt(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function it(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(nt(n));return i.join("")}function Br(t){or||Dr();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(it(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=R[r>>2],i+=R[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=R[r>>10],i+=R[r>>4&63],i+=R[r<<2&63],i+="="),o.push(i),o.join("")}function q(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,g=e?-1:1,m=t[r+l];for(l+=g,o=m&(1<<-h)-1,m>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=g,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=g,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(m?-1:1)*a*Math.pow(2,o-n)}function Cr(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,T=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=g/f:r+=g*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+m]=s&255,m+=T,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+m]=a&255,m+=T,a/=256,p-=8);t[e+m-T]|=j*128}var ot={}.toString,Mr=Array.isArray||function(t){return ot.call(t)=="[object Array]"};var at=50;c.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Gt=$();function $(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function N(t,r){if($()<r)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=c.prototype):(t===null&&(t=new c(r)),t.length=r),t}function c(t,r,e){if(!c.TYPED_ARRAY_SUPPORT&&!(this instanceof c))return new c(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ar(this,t)}return Fr(this,t,r,e)}c.poolSize=8192;c._augment=function(t){return t.__proto__=c.prototype,t};function Fr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?ct(t,r,e,n):typeof r=="string"?st(t,r,e):ft(t,r)}c.from=function(t,r,e){return Fr(null,t,r,e)};c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array);function Or(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ut(t,r,e,n){return Or(r),r<=0?N(t,r):e!==void 0?typeof n=="string"?N(t,r).fill(e,n):N(t,r).fill(e):N(t,r)}c.alloc=function(t,r,e){return ut(null,t,r,e)};function ar(t,r){if(Or(r),t=N(t,r<0?0:ur(r)|0),!c.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}c.allocUnsafe=function(t){return ar(null,t)};c.allocUnsafeSlow=function(t){return ar(null,t)};function st(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Lr(r,e)|0;t=N(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function ir(t,r){var e=r.length<0?0:ur(r.length)|0;t=N(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ct(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),c.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=c.prototype):t=ir(t,r),t}function ft(t,r){if(S(r)){var e=ur(r.length)|0;return t=N(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ut(r.length)?N(t,0):ir(t,r);if(r.type==="Buffer"&&Mr(r.data))return ir(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ur(t){if(t>=$())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$().toString(16)+" bytes");return t|0}c.isBuffer=Nt;function S(t){return!!(t!=null&&t._isBuffer)}c.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};c.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};c.concat=function(r,e){if(!Mr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return c.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=c.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!S(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Lr(t,r){if(S(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return $r(t).length;default:if(n)return z(t).length;r=(""+r).toLowerCase(),n=!0}}c.byteLength=Lr;function lt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Tt(this,r,e);case"utf8":case"utf-8":return Gr(this,r,e);case"ascii":return Et(this,r,e);case"latin1":case"binary":return wt(this,r,e);case"base64":return dt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}c.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};c.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};c.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};c.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Gr(this,0,r):lt.apply(this,arguments)};c.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:c.compare(this,r)===0};c.prototype.inspect=function(){var r="",e=at;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};c.prototype.compare=function(r,e,n,i,o){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function Yr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=c.from(r,n)),S(r))return r.length===0?-1:Pr(t,r,e,n,i);if(typeof r=="number")return r=r&255,c.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Pr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Pr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(m,T){return o===1?m[T]:m.readUInt16BE(T*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,g=0;g<s;g++)if(f(t,p+g)!==f(r,g)){l=!1;break}if(l)return p}return-1}c.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};c.prototype.indexOf=function(r,e,n){return Yr(this,r,e,n,!0)};c.prototype.lastIndexOf=function(r,e,n){return Yr(this,r,e,n,!1)};function pt(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function ht(t,r,e,n){return Q(z(r,t.length-e),t,e,n)}function Wr(t,r,e,n){return Q(St(r),t,e,n)}function mt(t,r,e,n){return Wr(t,r,e,n)}function gt(t,r,e,n){return Q($r(r),t,e,n)}function xt(t,r,e,n){return Q(kt(r,t.length-e),t,e,n)}c.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return pt(this,r,e,n);case"utf8":case"utf-8":return ht(this,r,e,n);case"ascii":return Wr(this,r,e,n);case"latin1":case"binary":return mt(this,r,e,n);case"base64":return gt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(t,r,e){return r===0&&e===t.length?Br(t):Br(t.slice(r,e))}function Gr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return bt(n)}var vr=4096;function bt(t){var r=t.length;if(r<=vr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=vr));return e}function Et(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function wt(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function Tt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Rt(t[o]);return i}function yt(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}c.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(c.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=c.prototype;else{var o=e-r;i=new c(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};c.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};c.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};c.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};c.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};c.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};c.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};c.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};c.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};c.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};c.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};c.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};c.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};c.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};c.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),q(this,r,!0,23,4)};c.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),q(this,r,!1,23,4)};c.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),q(this,r,!0,52,8)};c.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),q(this,r,!1,52,8)};function w(t,r,e,n,i,o){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}c.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};c.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};c.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function J(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}c.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};function X(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}c.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):X(this,r,e,!0),e+4};c.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};c.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};c.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};c.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):X(this,r,e,!0),e+4};c.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};function Hr(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Vr(t,r,e,n,i){return i||Hr(t,r,e,4),Cr(t,r,e,n,23,4),e+4}c.prototype.writeFloatLE=function(r,e,n){return Vr(this,r,e,!0,n)};c.prototype.writeFloatBE=function(r,e,n){return Vr(this,r,e,!1,n)};function Kr(t,r,e,n,i){return i||Hr(t,r,e,8),Cr(t,r,e,n,52,8),e+8}c.prototype.writeDoubleLE=function(r,e,n){return Kr(this,r,e,!0,n)};c.prototype.writeDoubleBE=function(r,e,n){return Kr(this,r,e,!1,n)};c.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};c.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=S(r)?r:z(new c(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var _t=/[^+\/0-9A-Za-z-_]/g;function At(t){if(t=It(t).replace(_t,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function It(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Rt(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function St(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function kt(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function $r(t){return tt(At(t))}function Q(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Ut(t){return t!==t}function Nt(t){return t!=null&&(!!t._isBuffer||zr(t)||Bt(t))}function zr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Bt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&zr(t.slice(0,0))}import{encodeAddress as Xr,decodeAddress as en}from"algosdk";function qr(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function Jr(t){return t.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Pt(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),vt(r)))}function Pt(t){return new Uint8Array(c.from(t))}function vt(t){let r=c.alloc(8);for(let e=0;e<8;e++)r[7-e]=Number(BigInt(t)>>BigInt(e*8)&BigInt(255));return new Uint8Array(r)}function Z(t){return c.from(t,"base64")}import Dt from"bignumber.js";Dt.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var yn=`{"theme1":{"value":"${x.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var Qr={V1_1:"v1_1",V2:"v2"},Rn={[Qr.V1_1]:{testnet:62368684,mainnet:552635992},[Qr.V2]:{testnet:148607e3,mainnet:1002541853}};function Zr(t){return Object.keys(t).sort().reduce((r,e)=>({...r,[e]:t[e]}),{})}var li=(t,r)=>r.map(n=>({appIndex:t,name:qr(Jr(["WLP_",n]))}));function Ct(t){let r={};return t.forEach(e=>{let n=Z(e.key).toString(),i=e.value,o=i.type;o==2&&(i=i.uint),o==1&&(i=Z(i.bytes)),n=="gov"?r.gov=Xr(i):r[n]=i}),Zr(r)}var pi=t=>{let r={0:t.amount},e=t.assets;for(let n=0;n<e.length;n++){let i=e[n]["asset-id"],o=e[n].amount;r[i]=o}return console.log(`Account ${t.address} balances`,JSON.stringify(r)),r},hi=async(t,r)=>{let e=await t.getApplicationByID(r).do();return Ct(e.params["global-state"])},mi=async(t,r)=>{let{boxes:e}=await t.getApplicationBoxes(r).do();console.log("boxes",r,e.map(n=>n.name).filter(n=>n.length===32).map(n=>u.from(n).toString("base64")))},gi=async(t,r,e)=>{try{let{value:n}=await t.getApplicationBoxByName(r,e).do();return n}catch(n){if(n.message.includes("box not found"))return console.log(`Box not found '${u.from(e).toString("hex")}'`),null;throw n}},xi=async(t,r=1)=>{let e=await t.getTransactionParams().do();return r>1&&(e.fee=sr.ALGORAND_MIN_TX_FEE*r,e.flatFee=!0),{...e}},di=(t,r)=>Object.keys(t).includes(r.toString()),bi=t=>sr.decodeAddress(t.toUpperCase()).publicKey,Ei=(t,r,e,n)=>sr.verifyBytes(new Uint8Array(u.from(e,n)),Z(t),r);export{li as createBoxes,bi as decodeAndNormalizeAddress,Ct as decodeStateArray,pi as getAccountAssetBalances,mi as getAppBoxes,hi as getAppGlobalState,gi as getBoxByName,xi as getTxnParams,di as isAssetOptedIn,Ei as verifySignature};
|
|
1
|
+
function fr(){throw new Error("setTimeout has not been defined")}function lr(){throw new Error("clearTimeout has not been defined")}var v=fr,N=lr;typeof globalThis.setTimeout=="function"&&(v=setTimeout);typeof globalThis.clearTimeout=="function"&&(N=clearTimeout);function pr(t){if(v===setTimeout)return setTimeout(t,0);if((v===fr||!v)&&setTimeout)return v=setTimeout,setTimeout(t,0);try{return v(t,0)}catch{try{return v.call(null,t,0)}catch{return v.call(this,t,0)}}}function jr(t){if(N===clearTimeout)return clearTimeout(t);if((N===lr||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(t);try{return N(t)}catch{try{return N.call(null,t)}catch{return N.call(this,t)}}}var k=[],O=!1,P,L=-1;function re(){!O||!P||(O=!1,P.length?k=P.concat(k):L=-1,k.length&&hr())}function hr(){if(!O){var t=pr(re);O=!0;for(var r=k.length;r;){for(P=k,k=[];++L<r;)P&&P[L].run();L=-1,r=k.length}P=null,O=!1,jr(t)}}function ee(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];k.push(new gr(t,r)),k.length===1&&!O&&pr(hr)}function gr(t,r){this.fun=t,this.array=r}gr.prototype.run=function(){this.fun.apply(null,this.array)};var te="browser",ne="browser",ie=!0,oe={},ae=[],ue="",se={},ce={},fe={};function D(){}var le=D,pe=D,he=D,ge=D,me=D,xe=D,de=D;function be(t){throw new Error("process.binding is not supported")}function Ee(){return"/"}function we(t){throw new Error("process.chdir is not supported")}function ye(){return 0}var F=globalThis.performance||{},Te=F.now||F.mozNow||F.msNow||F.oNow||F.webkitNow||function(){return new Date().getTime()};function _e(t){var r=Te.call(F)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var Ae=new Date;function Ie(){var t=new Date,r=t-Ae;return r/1e3}var x={nextTick:ee,title:te,browser:ie,env:oe,argv:ae,version:ue,versions:se,on:le,addListener:pe,once:he,off:ge,removeListener:me,removeAllListeners:xe,emit:de,binding:be,cwd:Ee,chdir:we,umask:ye,hrtime:_e,platform:ne,release:ce,config:fe,uptime:Ie},cr={};Object.keys(cr).forEach(t=>{let r=t.split("."),e=x;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=cr[t]:e=e[i]||(e[i]={})}});var A=[],T=[],Re=typeof Uint8Array<"u"?Uint8Array:Array,er=!1;function br(){er=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)A[r]=t[r],T[t.charCodeAt(r)]=r;T[45]=62,T[95]=63}function Se(t){er||br();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new Re(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=T[t.charCodeAt(r)]<<18|T[t.charCodeAt(r+1)]<<12|T[t.charCodeAt(r+2)]<<6|T[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=T[t.charCodeAt(r)]<<2|T[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=T[t.charCodeAt(r)]<<10|T[t.charCodeAt(r+1)]<<4|T[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function ke(t){return A[t>>18&63]+A[t>>12&63]+A[t>>6&63]+A[t&63]}function Be(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(ke(n));return i.join("")}function mr(t){er||br();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(Be(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=A[r>>2],i+=A[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=A[r>>10],i+=A[r>>4&63],i+=A[r<<2&63],i+="="),o.push(i),o.join("")}u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function Y(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(Y()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return tr(this,t)}return Er(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Er(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Ne(t,r,e,n):typeof r=="string"?ve(t,r,e):Pe(t,r)}u.from=function(t,r,e){return Er(null,t,r,e)};u.kMaxLength=Y();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function wr(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ue(t,r,e,n){return wr(r),r<=0?B(t,r):e!==void 0?typeof n=="string"?B(t,r).fill(e,n):B(t,r).fill(e):B(t,r)}u.alloc=function(t,r,e){return Ue(null,t,r,e)};function tr(t,r){if(wr(r),t=B(t,r<0?0:nr(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return tr(null,t)};u.allocUnsafeSlow=function(t){return tr(null,t)};function ve(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=yr(r,e)|0;t=B(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function rr(t,r){var e=r.length<0?0:nr(r.length)|0;t=B(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Ne(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=rr(t,r),t}function Pe(t,r){if(I(r)){var e=nr(r.length)|0;return t=B(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Ze(r.length)?B(t,0):rr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return rr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function nr(t){if(t>=Y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y().toString(16)+" bytes");return t|0}u.isBuffer=je;function I(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!I(r)||!I(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};u.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=u.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!I(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function yr(t,r){if(I(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return kr(t).length;default:if(n)return W(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=yr;function De(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ve(this,r,e);case"utf8":case"utf-8":return Ar(this,r,e);case"ascii":return Ge(this,r,e);case"latin1":case"binary":return He(this,r,e);case"base64":return Ye(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ke(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function C(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)C(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)C(this,e,e+3),C(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)C(this,e,e+7),C(this,e+1,e+6),C(this,e+2,e+5),C(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ar(this,0,r):De.apply(this,arguments)};u.prototype.equals=function(r){if(!I(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.compare=function(r,e,n,i,o){if(!I(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function Tr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),I(r))return r.length===0?-1:xr(t,r,e,n,i);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):xr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function xr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(g,y){return o===1?g[y]:g.readUInt16BE(y*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,m=0;m<s;m++)if(f(t,p+m)!==f(r,m)){l=!1;break}if(l)return p}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return Tr(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return Tr(this,r,e,n,!1)};function Ce(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function Me(t,r,e,n){return V(W(r,t.length-e),t,e,n)}function _r(t,r,e,n){return V(Xe(r),t,e,n)}function Fe(t,r,e,n){return _r(t,r,e,n)}function Oe(t,r,e,n){return V(kr(r),t,e,n)}function Le(t,r,e,n){return V(Qe(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ce(this,r,e,n);case"utf8":case"utf-8":return Me(this,r,e,n);case"ascii":return _r(this,r,e,n);case"latin1":case"binary":return Fe(this,r,e,n);case"base64":return Oe(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Le(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ye(t,r,e){return r===0&&e===t.length?mr(t):mr(t.slice(r,e))}function Ar(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return We(n)}var dr=4096;function We(t){var r=t.length;if(r<=dr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=dr));return e}function Ge(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function He(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function Ve(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Je(t[o]);return i}function Ke(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(u.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=u.prototype;else{var o=e-r;i=new u(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function d(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};u.prototype.readUInt8=function(r,e){return e||d(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||d(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||d(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||d(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||d(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||d(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};u.prototype.readInt8=function(r,e){return e||d(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||d(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||d(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||d(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||d(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||d(r,4,this.length),K(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||d(r,4,this.length),K(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||d(r,8,this.length),K(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||d(r,8,this.length),K(this,r,!1,52,8)};function E(t,r,e,n,i,o){if(!I(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;E(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function G(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};function H(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):H(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);E(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):G(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):G(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):H(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||E(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):H(this,r,e,!1),e+4};function Ir(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Rr(t,r,e,n,i){return i||Ir(t,r,e,4,34028234663852886e22,-34028234663852886e22),Ur(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return Rr(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return Rr(this,r,e,!1,n)};function Sr(t,r,e,n,i){return i||Ir(t,r,e,8,17976931348623157e292,-17976931348623157e292),Ur(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return Sr(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return Sr(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};u.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=I(r)?r:W(new u(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var $e=/[^+\/0-9A-Za-z-_]/g;function ze(t){if(t=qe(t).replace($e,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function qe(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Je(t){return t<16?"0"+t.toString(16):t.toString(16)}function W(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Xe(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Qe(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function kr(t){return Se(ze(t))}function V(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Ze(t){return t!==t}function je(t){return t!=null&&(!!t._isBuffer||Br(t)||rt(t))}function Br(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Br(t.slice(0,0))}function K(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,m=e?-1:1,g=t[r+l];for(l+=m,o=g&(1<<-h)-1,g>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=m,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=m,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(g?-1:1)*a*Math.pow(2,o-n)}function Ur(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,y=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=m/f:r+=m*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+g]=s&255,g+=y,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+g]=a&255,g+=y,a/=256,p-=8);t[e+g-y]|=j*128}import sr from"algosdk";import zt,{decodeAddress as qt,encodeAddress as Jt}from"algosdk";var R=[],_=[],et=typeof Uint8Array<"u"?Uint8Array:Array,or=!1;function Dr(){or=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],_[t.charCodeAt(r)]=r;_[45]=62,_[95]=63}function tt(t){or||Dr();var r,e,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[s-2]==="="?2:t[s-1]==="="?1:0,a=new et(s*3/4-o),n=o>0?s-4:s;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=_[t.charCodeAt(r)]<<18|_[t.charCodeAt(r+1)]<<12|_[t.charCodeAt(r+2)]<<6|_[t.charCodeAt(r+3)],a[f++]=i>>16&255,a[f++]=i>>8&255,a[f++]=i&255;return o===2?(i=_[t.charCodeAt(r)]<<2|_[t.charCodeAt(r+1)]>>4,a[f++]=i&255):o===1&&(i=_[t.charCodeAt(r)]<<10|_[t.charCodeAt(r+1)]<<4|_[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=i&255),a}function nt(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function it(t,r,e){for(var n,i=[],o=r;o<e;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(nt(n));return i.join("")}function vr(t){or||Dr();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,s=0,f=e-n;s<f;s+=a)o.push(it(t,s,s+a>f?f:s+a));return n===1?(r=t[e-1],i+=R[r>>2],i+=R[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=R[r>>10],i+=R[r>>4&63],i+=R[r<<2&63],i+="="),o.push(i),o.join("")}function q(t,r,e,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,p=f>>1,h=-7,l=e?i-1:0,m=e?-1:1,g=t[r+l];for(l+=m,o=g&(1<<-h)-1,g>>=-h,h+=s;h>0;o=o*256+t[r+l],l+=m,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[r+l],l+=m,h-=8);if(o===0)o=1-p;else{if(o===f)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(g?-1:1)*a*Math.pow(2,o-n)}function Cr(t,r,e,n,i,o){var a,s,f,p=o*8-i-1,h=(1<<p)-1,l=h>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,y=n?1:-1,j=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+l>=1?r+=m/f:r+=m*Math.pow(2,1-l),r*f>=2&&(a++,f/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(r*f-1)*Math.pow(2,i),a=a+l):(s=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+g]=s&255,g+=y,s/=256,i-=8);for(a=a<<i|s,p+=i;p>0;t[e+g]=a&255,g+=y,a/=256,p-=8);t[e+g-y]|=j*128}var ot={}.toString,Mr=Array.isArray||function(t){return ot.call(t)=="[object Array]"};var at=50;c.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Gt=$();function $(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(t,r){if($()<r)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=c.prototype):(t===null&&(t=new c(r)),t.length=r),t}function c(t,r,e){if(!c.TYPED_ARRAY_SUPPORT&&!(this instanceof c))return new c(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ar(this,t)}return Fr(this,t,r,e)}c.poolSize=8192;c._augment=function(t){return t.__proto__=c.prototype,t};function Fr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?ct(t,r,e,n):typeof r=="string"?st(t,r,e):ft(t,r)}c.from=function(t,r,e){return Fr(null,t,r,e)};c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array);function Or(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ut(t,r,e,n){return Or(r),r<=0?U(t,r):e!==void 0?typeof n=="string"?U(t,r).fill(e,n):U(t,r).fill(e):U(t,r)}c.alloc=function(t,r,e){return ut(null,t,r,e)};function ar(t,r){if(Or(r),t=U(t,r<0?0:ur(r)|0),!c.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}c.allocUnsafe=function(t){return ar(null,t)};c.allocUnsafeSlow=function(t){return ar(null,t)};function st(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Lr(r,e)|0;t=U(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function ir(t,r){var e=r.length<0?0:ur(r.length)|0;t=U(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ct(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),c.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=c.prototype):t=ir(t,r),t}function ft(t,r){if(S(r)){var e=ur(r.length)|0;return t=U(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Bt(r.length)?U(t,0):ir(t,r);if(r.type==="Buffer"&&Mr(r.data))return ir(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ur(t){if(t>=$())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$().toString(16)+" bytes");return t|0}c.isBuffer=Ut;function S(t){return!!(t!=null&&t._isBuffer)}c.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,i=e.length,o=0,a=Math.min(n,i);o<a;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return n<i?-1:i<n?1:0};c.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};c.concat=function(r,e){if(!Mr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return c.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var i=c.allocUnsafe(e),o=0;for(n=0;n<r.length;++n){var a=r[n];if(!S(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Lr(t,r){if(S(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return $r(t).length;default:if(n)return z(t).length;r=(""+r).toLowerCase(),n=!0}}c.byteLength=Lr;function lt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return yt(this,r,e);case"utf8":case"utf-8":return Gr(this,r,e);case"ascii":return Et(this,r,e);case"latin1":case"binary":return wt(this,r,e);case"base64":return dt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}c.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};c.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};c.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};c.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Gr(this,0,r):lt.apply(this,arguments)};c.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:c.compare(this,r)===0};c.prototype.inspect=function(){var r="",e=at;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};c.prototype.compare=function(r,e,n,i,o){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,s=n-e,f=Math.min(a,s),p=this.slice(i,o),h=r.slice(e,n),l=0;l<f;++l)if(p[l]!==h[l]){a=p[l],s=h[l];break}return a<s?-1:s<a?1:0};function Yr(t,r,e,n,i){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=c.from(r,n)),S(r))return r.length===0?-1:Nr(t,r,e,n,i);if(typeof r=="number")return r=r&255,c.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Nr(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Nr(t,r,e,n,i){var o=1,a=t.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,s/=2,e/=2}function f(g,y){return o===1?g[y]:g.readUInt16BE(y*o)}var p;if(i){var h=-1;for(p=e;p<a;p++)if(f(t,p)===f(r,h===-1?0:p-h)){if(h===-1&&(h=p),p-h+1===s)return h*o}else h!==-1&&(p-=p-h),h=-1}else for(e+s>a&&(e=a-s),p=e;p>=0;p--){for(var l=!0,m=0;m<s;m++)if(f(t,p+m)!==f(r,m)){l=!1;break}if(l)return p}return-1}c.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};c.prototype.indexOf=function(r,e,n){return Yr(this,r,e,n,!0)};c.prototype.lastIndexOf=function(r,e,n){return Yr(this,r,e,n,!1)};function pt(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(r.substr(a*2,2),16);if(isNaN(s))return a;t[e+a]=s}return a}function ht(t,r,e,n){return Q(z(r,t.length-e),t,e,n)}function Wr(t,r,e,n){return Q(St(r),t,e,n)}function gt(t,r,e,n){return Wr(t,r,e,n)}function mt(t,r,e,n){return Q($r(r),t,e,n)}function xt(t,r,e,n){return Q(kt(r,t.length-e),t,e,n)}c.prototype.write=function(r,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return pt(this,r,e,n);case"utf8":case"utf-8":return ht(this,r,e,n);case"ascii":return Wr(this,r,e,n);case"latin1":case"binary":return gt(this,r,e,n);case"base64":return mt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(t,r,e){return r===0&&e===t.length?vr(t):vr(t.slice(r,e))}function Gr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=e){var f,p,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(a=l));break;case 3:f=t[i+1],p=t[i+2],(f&192)===128&&(p&192)===128&&(l=(o&15)<<12|(f&63)<<6|p&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=t[i+1],p=t[i+2],h=t[i+3],(f&192)===128&&(p&192)===128&&(h&192)===128&&(l=(o&15)<<18|(f&63)<<12|(p&63)<<6|h&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=s}return bt(n)}var Pr=4096;function bt(t){var r=t.length;if(r<=Pr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Pr));return e}function Et(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]&127);return n}function wt(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function yt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Rt(t[o]);return i}function Tt(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}c.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var i;if(c.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=c.prototype;else{var o=e-r;i=new c(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+r]}return i};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i};c.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i};c.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};c.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};c.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};c.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};c.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};c.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};c.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a};c.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};c.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};c.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};c.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};c.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};c.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),q(this,r,!0,23,4)};c.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),q(this,r,!1,23,4)};c.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),q(this,r,!0,52,8)};c.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),q(this,r,!1,52,8)};function w(t,r,e,n,i,o){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}c.prototype.writeUIntLE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=1,s=0;for(this[e]=r&255;++s<n&&(a*=256);)this[e+s]=r/a&255;return e+n};c.prototype.writeUIntBE=function(r,e,n,i){if(r=+r,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;w(this,r,e,n,o,0)}var a=n-1,s=1;for(this[e+a]=r&255;--a>=0&&(s*=256);)this[e+a]=r/s&255;return e+n};c.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function J(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}c.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};function X(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>(n?i:3-i)*8&255}c.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):X(this,r,e,!0),e+4};c.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};c.prototype.writeIntLE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=0,s=1,f=0;for(this[e]=r&255;++a<n&&(s*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeIntBE=function(r,e,n,i){if(r=+r,e=e|0,!i){var o=Math.pow(2,8*n-1);w(this,r,e,n,o-1,-o)}var a=n-1,s=1,f=0;for(this[e+a]=r&255;--a>=0&&(s*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/s>>0)-f&255;return e+n};c.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};c.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):J(this,r,e,!0),e+2};c.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):J(this,r,e,!1),e+2};c.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):X(this,r,e,!0),e+4};c.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||w(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),c.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};function Hr(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Vr(t,r,e,n,i){return i||Hr(t,r,e,4),Cr(t,r,e,n,23,4),e+4}c.prototype.writeFloatLE=function(r,e,n){return Vr(this,r,e,!0,n)};c.prototype.writeFloatBE=function(r,e,n){return Vr(this,r,e,!1,n)};function Kr(t,r,e,n,i){return i||Hr(t,r,e,8),Cr(t,r,e,n,52,8),e+8}c.prototype.writeDoubleLE=function(r,e,n){return Kr(this,r,e,!0,n)};c.prototype.writeDoubleBE=function(r,e,n){return Kr(this,r,e,!1,n)};c.prototype.copy=function(r,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-n&&(i=r.length-e+n);var o=i-n,a;if(this===r&&n<e&&e<i)for(a=o-1;a>=0;--a)r[a+e]=this[a+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+o),e);return o};c.prototype.fill=function(r,e,n,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var s=S(r)?r:z(new c(r,i).toString()),f=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%f]}return this};var _t=/[^+\/0-9A-Za-z-_]/g;function At(t){if(t=It(t).replace(_t,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function It(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Rt(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function St(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function kt(t,r){for(var e,n,i,o=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function $r(t){return tt(At(t))}function Q(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Bt(t){return t!==t}function Ut(t){return t!=null&&(!!t._isBuffer||zr(t)||vt(t))}function zr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function vt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&zr(t.slice(0,0))}import{encodeAddress as Xr,decodeAddress as en}from"algosdk";function qr(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function Jr(t){return t.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Nt(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),Pt(r)))}function Nt(t){return new Uint8Array(c.from(t))}function Pt(t){let r=c.alloc(8);for(let e=0;e<8;e++)r[7-e]=Number(BigInt(t)>>BigInt(e*8)&BigInt(255));return new Uint8Array(r)}function Z(t){return c.from(t,"base64")}import Dt from"bignumber.js";Dt.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var An=`{"theme1":{"value":"${x.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${x.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var Qr={V1_1:"v1_1",V2:"v2"},kn={[Qr.V1_1]:{testnet:62368684,mainnet:552635992},[Qr.V2]:{testnet:148607e3,mainnet:1002541853}};function Zr(t){return Object.keys(t).sort().reduce((r,e)=>({...r,[e]:t[e]}),{})}var gi=(t,r)=>r.map(n=>({appIndex:t,name:qr(Jr(["WLP_",n]))}));function Ct(t){let r={};return t.forEach(e=>{let n=Z(e.key).toString(),i=e.value,o=i.type;o==2&&(i=i.uint),o==1&&(i=Z(i.bytes)),n=="gov"?r.gov=Xr(i):r[n]=i}),Zr(r)}var mi=t=>{let r={0:t.amount},e=t.assets;for(let n=0;n<e.length;n++){let i=e[n]["asset-id"],o=e[n].amount;r[i]=o}return console.log(`Account ${t.address} balances`,JSON.stringify(r)),r},xi=async(t,r)=>{let e=await t.getApplicationByID(r).do();return Ct(e.params["global-state"])},di=async(t,r)=>{let{boxes:e}=await t.getApplicationBoxes(r).do();console.log("boxes",r,e.map(n=>n.name).filter(n=>n.length===32).map(n=>u.from(n).toString("base64")))},bi=async(t,r,e)=>{try{let{value:n}=await t.getApplicationBoxByName(r,e).do();return n}catch(n){if(n.message.includes("box not found"))return console.log(`Box not found '${u.from(e).toString("hex")}'`),null;throw n}},Ei=async(t,r=1)=>{let e=await t.getTransactionParams().do();return r>1&&(e.fee=sr.ALGORAND_MIN_TX_FEE*r,e.flatFee=!0),{...e}},wi=(t,r)=>Object.keys(t).includes(r.toString()),yi=t=>sr.decodeAddress(t.toUpperCase()).publicKey,Ti=(t,r,e,n)=>sr.verifyBytes(new Uint8Array(u.from(e,n)),Z(t),r);export{gi as createBoxes,yi as decodeAndNormalizeAddress,Ct as decodeStateArray,mi as getAccountAssetBalances,di as getAppBoxes,xi as getAppGlobalState,bi as getBoxByName,Ei as getTxnParams,wi as isAssetOptedIn,Ti as verifySignature};
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _r(){throw new Error("setTimeout has not been defined")}function yr(){throw new Error("clearTimeout has not been defined")}var D=_r,P=yr;typeof globalThis.setTimeout=="function"&&(D=setTimeout);typeof globalThis.clearTimeout=="function"&&(P=clearTimeout);function Ir(t){if(D===setTimeout)return setTimeout(t,0);if((D===_r||!D)&&setTimeout)return D=setTimeout,setTimeout(t,0);try{return D(t,0)}catch{try{return D.call(null,t,0)}catch{return D.call(this,t,0)}}}function Ie(t){if(P===clearTimeout)return clearTimeout(t);if((P===yr||!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 C=[],F=!1,k,H=-1;function Re(){!F||!k||(F=!1,k.length?C=k.concat(C):H=-1,C.length&&Rr())}function Rr(){if(!F){var t=Ir(Re);F=!0;for(var r=C.length;r;){for(k=C,C=[];++H<r;)k&&k[H].run();H=-1,r=C.length}k=null,F=!1,Ie(t)}}function we(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];C.push(new wr(t,r)),C.length===1&&!F&&Ir(Rr)}function wr(t,r){this.fun=t,this.array=r}wr.prototype.run=function(){this.fun.apply(null,this.array)};var Ne="browser",Se="browser",Ce=!0,Oe={},Be=[],De="",Pe={},ke={},Ue={};function U(){}var Le=U,Me=U,ve=U,Fe=U,Ye=U,Ge=U,Ke=U;function We(t){throw new Error("process.binding is not supported")}function He(){return"/"}function Ve(t){throw new Error("process.chdir is not supported")}function $e(){return 0}var v=globalThis.performance||{},Xe=v.now||v.mozNow||v.msNow||v.oNow||v.webkitNow||function(){return new Date().getTime()};function ze(t){var r=Xe.call(v)*.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 qe=new Date;function Je(){var t=new Date,r=t-qe;return r/1e3}var l={nextTick:we,title:Ne,browser:Ce,env:Oe,argv:Be,version:De,versions:Pe,on:Le,addListener:Me,once:ve,off:Fe,removeListener:Ye,removeAllListeners:Ge,emit:Ke,binding:We,cwd:He,chdir:Ve,umask:$e,hrtime:ze,platform:Se,release:ke,config:Ue,uptime:Je},Tr={};Object.keys(Tr).forEach(t=>{let r=t.split("."),e=l;for(let n=0;n<r.length;n++){let o=r[n];n===r.length-1?e[o]=Tr[t]:e=e[o]||(e[o]={})}});var R=[],y=[],je=typeof Uint8Array<"u"?Uint8Array:Array,cr=!1;function Or(){cr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],y[t.charCodeAt(r)]=r;y[45]=62,y[95]=63}function Qe(t){cr||Or();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new je(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=y[t.charCodeAt(r)]<<18|y[t.charCodeAt(r+1)]<<12|y[t.charCodeAt(r+2)]<<6|y[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=y[t.charCodeAt(r)]<<2|y[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=y[t.charCodeAt(r)]<<10|y[t.charCodeAt(r+1)]<<4|y[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Ze(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function rt(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Ze(n));return o.join("")}function Nr(t){cr||Or();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(rt(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=R[r>>2],o+=R[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=R[r>>10],o+=R[r>>4&63],o+=R[r<<2&63],o+="="),a.push(o),a.join("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function V(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function O(t,r){if(V()<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 ur(this,t)}return Br(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Br(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?nt(t,r,e,n):typeof r=="string"?tt(t,r,e):ot(t,r)}s.from=function(t,r,e){return Br(null,t,r,e)};s.kMaxLength=V();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function Dr(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 et(t,r,e,n){return Dr(r),r<=0?O(t,r):e!==void 0?typeof n=="string"?O(t,r).fill(e,n):O(t,r).fill(e):O(t,r)}s.alloc=function(t,r,e){return et(null,t,r,e)};function ur(t,r){if(Dr(r),t=O(t,r<0?0:pr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return ur(null,t)};s.allocUnsafeSlow=function(t){return ur(null,t)};function tt(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=Pr(r,e)|0;t=O(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function sr(t,r){var e=r.length<0?0:pr(r.length)|0;t=O(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function nt(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=sr(t,r),t}function ot(t,r){if(w(r)){var e=pr(r.length)|0;return t=O(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"||yt(r.length)?O(t,0):sr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return sr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function pr(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return t|0}s.isBuffer=It;function w(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!w(r)||!w(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<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(!Array.isArray(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 o=s.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!w(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function Pr(t,r){if(w(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 $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Yr(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=Pr;function it(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 gt(this,r,e);case"utf8":case"utf-8":return Lr(this,r,e);case"ascii":return dt(this,r,e);case"latin1":case"binary":return ft(this,r,e);case"base64":return lt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function L(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)L(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)L(this,e,e+3),L(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)L(this,e,e+7),L(this,e+1,e+6),L(this,e+2,e+5),L(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Lr(this,0,r):it.apply(this,arguments)};s.prototype.equals=function(r){if(!w(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.compare=function(r,e,n,o,a){if(!w(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),m=0;m<p;++m)if(f[m]!==d[m]){i=f[m],c=d[m];break}return i<c?-1:c<i?1:0};function kr(t,r,e,n,o){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=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),w(r))return r.length===0?-1:Sr(t,r,e,n,o);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Sr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Sr(t,r,e,n,o){var a=1,i=t.length,c=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;a=2,i/=2,c/=2,e/=2}function p(g,_){return a===1?g[_]:g.readUInt16BE(_*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var m=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){m=!1;break}if(m)return f}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return kr(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return kr(this,r,e,n,!1)};function at(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function st(t,r,e,n){return q($(r,t.length-e),t,e,n)}function Ur(t,r,e,n){return q(Tt(r),t,e,n)}function ct(t,r,e,n){return Ur(t,r,e,n)}function ut(t,r,e,n){return q(Yr(r),t,e,n)}function pt(t,r,e,n){return q(_t(r,t.length-e),t,e,n)}s.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return at(this,r,e,n);case"utf8":case"utf-8":return st(this,r,e,n);case"ascii":return Ur(this,r,e,n);case"latin1":case"binary":return ct(this,r,e,n);case"base64":return ut(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lt(t,r,e){return r===0&&e===t.length?Nr(t):Nr(t.slice(r,e))}function Lr(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,m;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(m=(a&31)<<6|p&63,m>127&&(i=m));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(m=(a&15)<<12|(p&63)<<6|f&63,m>2047&&(m<55296||m>57343)&&(i=m));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(m=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,m>65535&&m<1114112&&(i=m))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return mt(n)}var Cr=4096;function mt(t){var r=t.length;if(r<=Cr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Cr));return e}function dt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function ft(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function gt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=At(t[a]);return o}function ht(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}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 o;if(s.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=s.prototype;else{var a=e-r;o=new s(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function x(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||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};s.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};s.prototype.readUInt8=function(r,e){return e||x(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||x(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||x(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUInt32LE=function(r,e){return e||x(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||x(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||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};s.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};s.prototype.readInt8=function(r,e){return e||x(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,e){e||x(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||x(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||x(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||x(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||x(r,4,this.length),J(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||x(r,4,this.length),J(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||x(r,8,this.length),J(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||x(r,8,this.length),J(this,r,!1,52,8)};function A(t,r,e,n,o,a){if(!w(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)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,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};s.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function X(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||A(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||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!1),e+4};function Mr(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function vr(t,r,e,n,o){return o||Mr(t,r,e,4,34028234663852886e22,-34028234663852886e22),Kr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return vr(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return vr(this,r,e,!1,n)};function Fr(t,r,e,n,o){return o||Mr(t,r,e,8,17976931348623157e292,-17976931348623157e292),Kr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return Fr(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return Fr(this,r,e,!1,n)};s.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};s.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}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 i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=w(r)?r:$(new s(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var xt=/[^+\/0-9A-Za-z-_]/g;function bt(t){if(t=Et(t).replace(xt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Et(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function At(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function Tt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function _t(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function Yr(t){return Qe(bt(t))}function q(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function yt(t){return t!==t}function It(t){return t!=null&&(!!t._isBuffer||Gr(t)||Rt(t))}function Gr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Rt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Gr(t.slice(0,0))}function J(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+m],m+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+m],m+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Kr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,m=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,_=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(i++,p/=2),i+m>=d?(c=0,i=d):i+m>=1?(c=(r*p-1)*Math.pow(2,o),i=i+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=_,i/=256,f-=8);t[e+g-_]|=ar*128}import lr from"bignumber.js";lr.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});function mr(t,r){return Wr(t,r,"*")}function G(t,r){return Wr(t,r,"/")}function Wr(t,r,e){switch(t=new lr(String(t)),r=new lr(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}}var Hr=(e=>(e[e.Buy=0]="Buy",e[e.Sell=1]="Sell",e))(Hr||{}),K=Hr;var Vr=(o=>(o[o.Limit=0]="Limit",o[o.IOC=1]="IOC",o[o.POST=2]="POST",o[o.Market=3]="Market",o))(Vr||{}),j=Vr;var $r=(o=>(o.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",o.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",o.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",o.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",o))($r||{}),Xr=(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))(Xr||{}),Mo={...$r,...Xr};var dr={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Ji={SMALLESTUNIT:l.env.SMALLEST_UNIT},ji={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var ea=`{"theme1":{"value":"${l.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var aa=["point-system.discordEnabled","point-system.telegramBotName","point-system.telegramBotId","point-system.telegramEnabled","point-system.telegramGroupId","point-system.telegramGroupName","point-system.twitterAccountId","point-system.twitterAccountName","point-system.twitterEnabled","point-system.twitterJobEnabled","point-system.guideLink"];var da=l.env.REACT_APP_API_URL,fa=l.env.REACT_APP_SOCKET_URL,ga=l.env.REACT_APP_ALGO_SERVER,ha=l.env.REACT_APP_ALGO_SERVER_PORT||"",xa=l.env.REACT_APP_ALGOD_TOKEN||"",ba=l.env.REACT_APP_DISPENSER_LINK,Ea=l.env.REACT_APP_FRONTEND_LINK||"",Aa=l.env.REACT_APP_ALGO_EXPLORER_LINK,Ta=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,_a=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",ya=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,Ia=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var Ra=.001*10**6,wa=.002*10**6;var Na=l.env.REACT_APP_MASTER_APP_ID||"406",Sa=l.env.REACT_APP_AGG_APP_ID||"408",Nt=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",Nt);var St=l.env.REACT_APP_ALGO_NETWORK||"";var Ca=St.toLowerCase()==="mainnet"?"mainnet":"testnet";var fr=(t,r)=>G(t,10**(18-r)),zr=(t,r)=>G(t,10**r);import _e from"algosdk";import*as Tn from"bs58";import Ac from"algosdk";import*as be from"bs58";import pn from"algosdk";import ts,{decodeAddress as ns,encodeAddress as os}from"algosdk";var N=[],I=[],Ot=typeof Uint8Array<"u"?Uint8Array:Array,hr=!1;function Qr(){hr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)N[r]=t[r],I[t.charCodeAt(r)]=r;I[45]=62,I[95]=63}function Bt(t){hr||Qr();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new Ot(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=I[t.charCodeAt(r)]<<18|I[t.charCodeAt(r+1)]<<12|I[t.charCodeAt(r+2)]<<6|I[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=I[t.charCodeAt(r)]<<2|I[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=I[t.charCodeAt(r)]<<10|I[t.charCodeAt(r+1)]<<4|I[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Dt(t){return N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[t&63]}function Pt(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Dt(n));return o.join("")}function qr(t){hr||Qr();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(Pt(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=N[r>>2],o+=N[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=N[r>>10],o+=N[r>>4&63],o+=N[r<<2&63],o+="="),a.push(o),a.join("")}function rr(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+m],m+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+m],m+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Zr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,m=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,_=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(i++,p/=2),i+m>=d?(c=0,i=d):i+m>=1?(c=(r*p-1)*Math.pow(2,o),i=i+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=_,i/=256,f-=8);t[e+g-_]|=ar*128}var kt={}.toString,re=Array.isArray||function(t){return kt.call(t)=="[object Array]"};var Ut=50;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var ja=Q();function Q(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(Q()<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 xr(this,t)}return ee(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function ee(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?vt(t,r,e,n):typeof r=="string"?Mt(t,r,e):Ft(t,r)}u.from=function(t,r,e){return ee(null,t,r,e)};u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array);function te(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 Lt(t,r,e,n){return te(r),r<=0?B(t,r):e!==void 0?typeof n=="string"?B(t,r).fill(e,n):B(t,r).fill(e):B(t,r)}u.alloc=function(t,r,e){return Lt(null,t,r,e)};function xr(t,r){if(te(r),t=B(t,r<0?0:br(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return xr(null,t)};u.allocUnsafeSlow=function(t){return xr(null,t)};function Mt(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=ne(r,e)|0;t=B(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function gr(t,r){var e=r.length<0?0:br(r.length)|0;t=B(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function vt(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=gr(t,r),t}function Ft(t,r){if(S(r)){var e=br(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"||on(r.length)?B(t,0):gr(t,r);if(r.type==="Buffer"&&re(r.data))return gr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function br(t){if(t>=Q())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q().toString(16)+" bytes");return t|0}u.isBuffer=an;function S(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<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(!re(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 o=u.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!S(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function ne(t,r){if(S(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return pe(t).length;default:if(n)return Z(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=ne;function Yt(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 Jt(this,r,e);case"utf8":case"utf-8":return ae(this,r,e);case"ascii":return zt(this,r,e);case"latin1":case"binary":return qt(this,r,e);case"base64":return $t(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function M(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)M(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)M(this,e,e+3),M(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)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};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?ae(this,0,r):Yt.apply(this,arguments)};u.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.inspect=function(){var r="",e=Ut;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};u.prototype.compare=function(r,e,n,o,a){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),m=0;m<p;++m)if(f[m]!==d[m]){i=f[m],c=d[m];break}return i<c?-1:c<i?1:0};function oe(t,r,e,n,o){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=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),S(r))return r.length===0?-1:Jr(t,r,e,n,o);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Jr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Jr(t,r,e,n,o){var a=1,i=t.length,c=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;a=2,i/=2,c/=2,e/=2}function p(g,_){return a===1?g[_]:g.readUInt16BE(_*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var m=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){m=!1;break}if(m)return f}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return oe(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return oe(this,r,e,n,!1)};function Gt(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function Kt(t,r,e,n){return nr(Z(r,t.length-e),t,e,n)}function ie(t,r,e,n){return nr(tn(r),t,e,n)}function Wt(t,r,e,n){return ie(t,r,e,n)}function Ht(t,r,e,n){return nr(pe(r),t,e,n)}function Vt(t,r,e,n){return nr(nn(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return Gt(this,r,e,n);case"utf8":case"utf-8":return Kt(this,r,e,n);case"ascii":return ie(this,r,e,n);case"latin1":case"binary":return Wt(this,r,e,n);case"base64":return Ht(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $t(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function ae(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,m;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(m=(a&31)<<6|p&63,m>127&&(i=m));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(m=(a&15)<<12|(p&63)<<6|f&63,m>2047&&(m<55296||m>57343)&&(i=m));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(m=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,m>65535&&m<1114112&&(i=m))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return Xt(n)}var jr=4096;function Xt(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 zt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function qt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function Jt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=en(t[a]);return o}function jt(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}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 o;if(u.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=u.prototype;else{var a=e-r;o=new u(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};u.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};u.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),rr(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),rr(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),rr(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),rr(this,r,!1,52,8)};function T(t,r,e,n,o,a){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)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,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function er(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};function tr(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||T(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||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!1),e+4};function se(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ce(t,r,e,n,o){return o||se(t,r,e,4),Zr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return ce(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return ce(this,r,e,!1,n)};function ue(t,r,e,n,o){return o||se(t,r,e,8),Zr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return ue(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return ue(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};u.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}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 i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=S(r)?r:Z(new u(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var Qt=/[^+\/0-9A-Za-z-_]/g;function Zt(t){if(t=rn(t).replace(Qt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function rn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function en(t){return t<16?"0"+t.toString(16):t.toString(16)}function Z(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function tn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function nn(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function pe(t){return Bt(Zt(t))}function nr(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function on(t){return t!==t}function an(t){return t!=null&&(!!t._isBuffer||le(t)||sn(t))}function le(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function sn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&le(t.slice(0,0))}import{encodeAddress as cn,decodeAddress as ps}from"algosdk";function Y(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}var me={V1_1:"v1_1",V2:"v2"},Rs={[me.V1_1]:{testnet:62368684,mainnet:552635992},[me.V2]:{testnet:148607e3,mainnet:1002541853}};var de=t=>pn.decodeAddress(t.toUpperCase()).publicKey;import*as E from"ethereumjs-util";function mn(t){return E.toUnsigned(new E.BN(String(t)))}function fe(t){let r=mn(t);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(E.setLengthLeft(r,32))}var ge=t=>new Uint8Array(E.setLengthLeft(or(t),32)),or=t=>s.from(dn(t),"hex"),dn=t=>t.startsWith("0x")?t.slice(2):t;var Er=t=>new Uint8Array(E.keccak256(s.from(t)));var Ar=(t,r)=>r===8?de(t):r===1?be.decode(t):ge(t);import Oc from"algosdk";import Fc from"algosdk";import Xc from"algosdk";import nu from"algosdk";import Eu from"algosdk";var _n=(t,r)=>r===8?fe(+t):dr[t]?new Uint8Array(or(String(t))):Ar(String(t),r);var ye=(t,r)=>{let e=Te(t.address,t.chainId,r.address,r.chainId);return s.from(Er(e)).toString("hex")},Te=(t,r,e,n)=>{let o=Ar(t,r),a=_e.encodeUint64(r),i=_e.encodeUint64(n),c=_n(e,n);return Y([o,a,c,i])};var Ap=(t,{userId:r,chainId:e,price:n,side:o,type:a,amount:i,total:c,id:p})=>{let{baseAsset:f,priceAsset:d}=t,m={address:r,chainId:e},h=o===K.Buy?d:f;return{action:"order",actionId:p,account:m,token:h,amount:o===K.Buy?a===j.Market?fr(c,d.decimal):mr(zr(i,f.decimal),fr(n,d.decimal)):i,ts:Date.now()}},Tp=(t,r,e,n="0")=>({hash:ye(t,r),loginAddress:t.address,loginChainId:t.chainId,tokenId:r.address,tokenChainId:r.chainId,amount:e,lockedAmount:n});export{Ap as mapToBalanceInfo,Tp as mapToCodexBalance};
|
|
1
|
+
function _r(){throw new Error("setTimeout has not been defined")}function yr(){throw new Error("clearTimeout has not been defined")}var D=_r,P=yr;typeof globalThis.setTimeout=="function"&&(D=setTimeout);typeof globalThis.clearTimeout=="function"&&(P=clearTimeout);function Ir(t){if(D===setTimeout)return setTimeout(t,0);if((D===_r||!D)&&setTimeout)return D=setTimeout,setTimeout(t,0);try{return D(t,0)}catch{try{return D.call(null,t,0)}catch{return D.call(this,t,0)}}}function Ie(t){if(P===clearTimeout)return clearTimeout(t);if((P===yr||!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 B=[],F=!1,k,H=-1;function Re(){!F||!k||(F=!1,k.length?B=k.concat(B):H=-1,B.length&&Rr())}function Rr(){if(!F){var t=Ir(Re);F=!0;for(var r=B.length;r;){for(k=B,B=[];++H<r;)k&&k[H].run();H=-1,r=B.length}k=null,F=!1,Ie(t)}}function we(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];B.push(new wr(t,r)),B.length===1&&!F&&Ir(Rr)}function wr(t,r){this.fun=t,this.array=r}wr.prototype.run=function(){this.fun.apply(null,this.array)};var Ne="browser",Se="browser",Be=!0,Ce={},Oe=[],De="",Pe={},ke={},Ue={};function U(){}var Le=U,Me=U,ve=U,Fe=U,Ye=U,Ge=U,Ke=U;function We(t){throw new Error("process.binding is not supported")}function He(){return"/"}function Ve(t){throw new Error("process.chdir is not supported")}function $e(){return 0}var v=globalThis.performance||{},Xe=v.now||v.mozNow||v.msNow||v.oNow||v.webkitNow||function(){return new Date().getTime()};function ze(t){var r=Xe.call(v)*.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 qe=new Date;function Je(){var t=new Date,r=t-qe;return r/1e3}var l={nextTick:we,title:Ne,browser:Be,env:Ce,argv:Oe,version:De,versions:Pe,on:Le,addListener:Me,once:ve,off:Fe,removeListener:Ye,removeAllListeners:Ge,emit:Ke,binding:We,cwd:He,chdir:Ve,umask:$e,hrtime:ze,platform:Se,release:ke,config:Ue,uptime:Je},Tr={};Object.keys(Tr).forEach(t=>{let r=t.split("."),e=l;for(let n=0;n<r.length;n++){let o=r[n];n===r.length-1?e[o]=Tr[t]:e=e[o]||(e[o]={})}});var R=[],y=[],je=typeof Uint8Array<"u"?Uint8Array:Array,cr=!1;function Cr(){cr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],y[t.charCodeAt(r)]=r;y[45]=62,y[95]=63}function Qe(t){cr||Cr();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new je(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=y[t.charCodeAt(r)]<<18|y[t.charCodeAt(r+1)]<<12|y[t.charCodeAt(r+2)]<<6|y[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=y[t.charCodeAt(r)]<<2|y[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=y[t.charCodeAt(r)]<<10|y[t.charCodeAt(r+1)]<<4|y[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Ze(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function rt(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Ze(n));return o.join("")}function Nr(t){cr||Cr();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(rt(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=R[r>>2],o+=R[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=R[r>>10],o+=R[r>>4&63],o+=R[r<<2&63],o+="="),a.push(o),a.join("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function V(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function C(t,r){if(V()<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 ur(this,t)}return Or(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Or(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?nt(t,r,e,n):typeof r=="string"?tt(t,r,e):ot(t,r)}s.from=function(t,r,e){return Or(null,t,r,e)};s.kMaxLength=V();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function Dr(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 et(t,r,e,n){return Dr(r),r<=0?C(t,r):e!==void 0?typeof n=="string"?C(t,r).fill(e,n):C(t,r).fill(e):C(t,r)}s.alloc=function(t,r,e){return et(null,t,r,e)};function ur(t,r){if(Dr(r),t=C(t,r<0?0:pr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return ur(null,t)};s.allocUnsafeSlow=function(t){return ur(null,t)};function tt(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=Pr(r,e)|0;t=C(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function sr(t,r){var e=r.length<0?0:pr(r.length)|0;t=C(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function nt(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=sr(t,r),t}function ot(t,r){if(w(r)){var e=pr(r.length)|0;return t=C(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"||yt(r.length)?C(t,0):sr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return sr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function pr(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return t|0}s.isBuffer=It;function w(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!w(r)||!w(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<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(!Array.isArray(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 o=s.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!w(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function Pr(t,r){if(w(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 $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Yr(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=Pr;function it(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 gt(this,r,e);case"utf8":case"utf-8":return Lr(this,r,e);case"ascii":return dt(this,r,e);case"latin1":case"binary":return ft(this,r,e);case"base64":return lt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function L(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)L(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)L(this,e,e+3),L(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)L(this,e,e+7),L(this,e+1,e+6),L(this,e+2,e+5),L(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Lr(this,0,r):it.apply(this,arguments)};s.prototype.equals=function(r){if(!w(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.compare=function(r,e,n,o,a){if(!w(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),m=0;m<p;++m)if(f[m]!==d[m]){i=f[m],c=d[m];break}return i<c?-1:c<i?1:0};function kr(t,r,e,n,o){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=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),w(r))return r.length===0?-1:Sr(t,r,e,n,o);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Sr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Sr(t,r,e,n,o){var a=1,i=t.length,c=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;a=2,i/=2,c/=2,e/=2}function p(g,_){return a===1?g[_]:g.readUInt16BE(_*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var m=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){m=!1;break}if(m)return f}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return kr(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return kr(this,r,e,n,!1)};function at(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function st(t,r,e,n){return q($(r,t.length-e),t,e,n)}function Ur(t,r,e,n){return q(Tt(r),t,e,n)}function ct(t,r,e,n){return Ur(t,r,e,n)}function ut(t,r,e,n){return q(Yr(r),t,e,n)}function pt(t,r,e,n){return q(_t(r,t.length-e),t,e,n)}s.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return at(this,r,e,n);case"utf8":case"utf-8":return st(this,r,e,n);case"ascii":return Ur(this,r,e,n);case"latin1":case"binary":return ct(this,r,e,n);case"base64":return ut(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lt(t,r,e){return r===0&&e===t.length?Nr(t):Nr(t.slice(r,e))}function Lr(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,m;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(m=(a&31)<<6|p&63,m>127&&(i=m));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(m=(a&15)<<12|(p&63)<<6|f&63,m>2047&&(m<55296||m>57343)&&(i=m));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(m=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,m>65535&&m<1114112&&(i=m))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return mt(n)}var Br=4096;function mt(t){var r=t.length;if(r<=Br)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Br));return e}function dt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function ft(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function gt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=At(t[a]);return o}function ht(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}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 o;if(s.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=s.prototype;else{var a=e-r;o=new s(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function x(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||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};s.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};s.prototype.readUInt8=function(r,e){return e||x(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||x(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||x(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUInt32LE=function(r,e){return e||x(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||x(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||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};s.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};s.prototype.readInt8=function(r,e){return e||x(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,e){e||x(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||x(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||x(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||x(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||x(r,4,this.length),J(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||x(r,4,this.length),J(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||x(r,8,this.length),J(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||x(r,8,this.length),J(this,r,!1,52,8)};function A(t,r,e,n,o,a){if(!w(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)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,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};s.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function X(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||A(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||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(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):z(this,r,e,!1),e+4};function Mr(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function vr(t,r,e,n,o){return o||Mr(t,r,e,4,34028234663852886e22,-34028234663852886e22),Kr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return vr(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return vr(this,r,e,!1,n)};function Fr(t,r,e,n,o){return o||Mr(t,r,e,8,17976931348623157e292,-17976931348623157e292),Kr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return Fr(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return Fr(this,r,e,!1,n)};s.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};s.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}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 i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=w(r)?r:$(new s(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var xt=/[^+\/0-9A-Za-z-_]/g;function Et(t){if(t=bt(t).replace(xt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function bt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function At(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function Tt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function _t(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function Yr(t){return Qe(Et(t))}function q(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function yt(t){return t!==t}function It(t){return t!=null&&(!!t._isBuffer||Gr(t)||Rt(t))}function Gr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Rt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Gr(t.slice(0,0))}function J(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+m],m+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+m],m+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Kr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,m=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,_=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(i++,p/=2),i+m>=d?(c=0,i=d):i+m>=1?(c=(r*p-1)*Math.pow(2,o),i=i+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=_,i/=256,f-=8);t[e+g-_]|=ar*128}import lr from"bignumber.js";lr.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});function mr(t,r){return Wr(t,r,"*")}function G(t,r){return Wr(t,r,"/")}function Wr(t,r,e){switch(t=new lr(String(t)),r=new lr(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}}var Hr=(e=>(e[e.Buy=0]="Buy",e[e.Sell=1]="Sell",e))(Hr||{}),K=Hr;var Vr=(o=>(o[o.Limit=0]="Limit",o[o.IOC=1]="IOC",o[o.POST=2]="POST",o[o.Market=3]="Market",o))(Vr||{}),j=Vr;var $r=(o=>(o.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",o.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",o.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",o.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",o))($r||{}),Xr=(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))(Xr||{}),Mo={...$r,...Xr};var dr={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Ji={SMALLESTUNIT:l.env.SMALLEST_UNIT},ji={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var ea=`{"theme1":{"value":"${l.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var aa=["point-system.discordEnabled","point-system.telegramBotName","point-system.telegramBotId","point-system.telegramEnabled","point-system.telegramGroupId","point-system.telegramGroupName","point-system.twitterAccountId","point-system.twitterAccountName","point-system.twitterEnabled","point-system.twitterJobEnabled","point-system.guideLink"];var da=l.env.REACT_APP_API_URL,fa=l.env.REACT_APP_SOCKET_URL,ga=l.env.REACT_APP_ALGO_SERVER,ha=l.env.REACT_APP_ALGO_SERVER_PORT||"",xa=l.env.REACT_APP_ALGOD_TOKEN||"",Ea=l.env.REACT_APP_DISPENSER_LINK,ba=l.env.REACT_APP_FRONTEND_LINK||"",Aa=l.env.REACT_APP_ALGO_EXPLORER_LINK,Ta=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,_a=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",ya=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,Ia=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var Ra=.001*10**6,wa=.002*10**6;var Na=l.env.REACT_APP_MASTER_APP_ID||"406",Sa=l.env.REACT_APP_AGG_APP_ID||"408",Nt=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",Nt);var St=l.env.REACT_APP_ALGO_NETWORK||"";var Ba=St.toLowerCase()==="mainnet"?"mainnet":"testnet";var fr=(t,r)=>G(t,10**(18-r)),zr=(t,r)=>G(t,10**r);import _e from"algosdk";import*as Tn from"bs58";import yc from"algosdk";import*as Ee from"bs58";import pn from"algosdk";import ts,{decodeAddress as ns,encodeAddress as os}from"algosdk";var N=[],I=[],Ct=typeof Uint8Array<"u"?Uint8Array:Array,hr=!1;function Qr(){hr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)N[r]=t[r],I[t.charCodeAt(r)]=r;I[45]=62,I[95]=63}function Ot(t){hr||Qr();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new Ct(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=I[t.charCodeAt(r)]<<18|I[t.charCodeAt(r+1)]<<12|I[t.charCodeAt(r+2)]<<6|I[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=I[t.charCodeAt(r)]<<2|I[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=I[t.charCodeAt(r)]<<10|I[t.charCodeAt(r+1)]<<4|I[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Dt(t){return N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[t&63]}function Pt(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Dt(n));return o.join("")}function qr(t){hr||Qr();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(Pt(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=N[r>>2],o+=N[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=N[r>>10],o+=N[r>>4&63],o+=N[r<<2&63],o+="="),a.push(o),a.join("")}function rr(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+m],m+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+m],m+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Zr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,m=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,_=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(i++,p/=2),i+m>=d?(c=0,i=d):i+m>=1?(c=(r*p-1)*Math.pow(2,o),i=i+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=_,i/=256,f-=8);t[e+g-_]|=ar*128}var kt={}.toString,re=Array.isArray||function(t){return kt.call(t)=="[object Array]"};var Ut=50;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var ja=Q();function Q(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function O(t,r){if(Q()<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 xr(this,t)}return ee(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function ee(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?vt(t,r,e,n):typeof r=="string"?Mt(t,r,e):Ft(t,r)}u.from=function(t,r,e){return ee(null,t,r,e)};u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array);function te(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 Lt(t,r,e,n){return te(r),r<=0?O(t,r):e!==void 0?typeof n=="string"?O(t,r).fill(e,n):O(t,r).fill(e):O(t,r)}u.alloc=function(t,r,e){return Lt(null,t,r,e)};function xr(t,r){if(te(r),t=O(t,r<0?0:Er(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return xr(null,t)};u.allocUnsafeSlow=function(t){return xr(null,t)};function Mt(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=ne(r,e)|0;t=O(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function gr(t,r){var e=r.length<0?0:Er(r.length)|0;t=O(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function vt(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=gr(t,r),t}function Ft(t,r){if(S(r)){var e=Er(r.length)|0;return t=O(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"||on(r.length)?O(t,0):gr(t,r);if(r.type==="Buffer"&&re(r.data))return gr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Er(t){if(t>=Q())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q().toString(16)+" bytes");return t|0}u.isBuffer=an;function S(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<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(!re(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 o=u.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!S(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function ne(t,r){if(S(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return pe(t).length;default:if(n)return Z(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=ne;function Yt(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 Jt(this,r,e);case"utf8":case"utf-8":return ae(this,r,e);case"ascii":return zt(this,r,e);case"latin1":case"binary":return qt(this,r,e);case"base64":return $t(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function M(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)M(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)M(this,e,e+3),M(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)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};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?ae(this,0,r):Yt.apply(this,arguments)};u.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.inspect=function(){var r="",e=Ut;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};u.prototype.compare=function(r,e,n,o,a){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),m=0;m<p;++m)if(f[m]!==d[m]){i=f[m],c=d[m];break}return i<c?-1:c<i?1:0};function oe(t,r,e,n,o){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=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),S(r))return r.length===0?-1:Jr(t,r,e,n,o);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Jr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Jr(t,r,e,n,o){var a=1,i=t.length,c=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;a=2,i/=2,c/=2,e/=2}function p(g,_){return a===1?g[_]:g.readUInt16BE(_*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var m=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){m=!1;break}if(m)return f}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return oe(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return oe(this,r,e,n,!1)};function Gt(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function Kt(t,r,e,n){return nr(Z(r,t.length-e),t,e,n)}function ie(t,r,e,n){return nr(tn(r),t,e,n)}function Wt(t,r,e,n){return ie(t,r,e,n)}function Ht(t,r,e,n){return nr(pe(r),t,e,n)}function Vt(t,r,e,n){return nr(nn(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return Gt(this,r,e,n);case"utf8":case"utf-8":return Kt(this,r,e,n);case"ascii":return ie(this,r,e,n);case"latin1":case"binary":return Wt(this,r,e,n);case"base64":return Ht(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $t(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function ae(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,m;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(m=(a&31)<<6|p&63,m>127&&(i=m));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(m=(a&15)<<12|(p&63)<<6|f&63,m>2047&&(m<55296||m>57343)&&(i=m));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(m=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,m>65535&&m<1114112&&(i=m))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return Xt(n)}var jr=4096;function Xt(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 zt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function qt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function Jt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=en(t[a]);return o}function jt(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}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 o;if(u.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=u.prototype;else{var a=e-r;o=new u(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function E(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||E(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||E(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};u.prototype.readUInt8=function(r,e){return e||E(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||E(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||E(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||E(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||E(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||E(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||E(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};u.prototype.readInt8=function(r,e){return e||E(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||E(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||E(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||E(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||E(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||E(r,4,this.length),rr(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||E(r,4,this.length),rr(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||E(r,8,this.length),rr(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||E(r,8,this.length),rr(this,r,!1,52,8)};function T(t,r,e,n,o,a){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)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,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function er(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};function tr(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||T(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||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(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):tr(this,r,e,!1),e+4};function se(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ce(t,r,e,n,o){return o||se(t,r,e,4),Zr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return ce(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return ce(this,r,e,!1,n)};function ue(t,r,e,n,o){return o||se(t,r,e,8),Zr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return ue(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return ue(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};u.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}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 i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=S(r)?r:Z(new u(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var Qt=/[^+\/0-9A-Za-z-_]/g;function Zt(t){if(t=rn(t).replace(Qt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function rn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function en(t){return t<16?"0"+t.toString(16):t.toString(16)}function Z(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function tn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function nn(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function pe(t){return Ot(Zt(t))}function nr(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function on(t){return t!==t}function an(t){return t!=null&&(!!t._isBuffer||le(t)||sn(t))}function le(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function sn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&le(t.slice(0,0))}import{encodeAddress as cn,decodeAddress as ps}from"algosdk";function Y(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}var me={V1_1:"v1_1",V2:"v2"},Ns={[me.V1_1]:{testnet:62368684,mainnet:552635992},[me.V2]:{testnet:148607e3,mainnet:1002541853}};var de=t=>pn.decodeAddress(t.toUpperCase()).publicKey;import*as b from"ethereumjs-util";function mn(t){return b.toUnsigned(new b.BN(String(t)))}function fe(t){let r=mn(t);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(b.setLengthLeft(r,32))}var ge=t=>new Uint8Array(b.setLengthLeft(or(t),32)),or=t=>s.from(dn(t),"hex"),dn=t=>t.startsWith("0x")?t.slice(2):t;var br=t=>new Uint8Array(b.keccak256(s.from(t)));var Ar=(t,r)=>r===8?de(t):r===1?Ee.decode(t):ge(t);import Pc from"algosdk";import Kc from"algosdk";import Jc from"algosdk";import au from"algosdk";import _u from"algosdk";var _n=(t,r)=>r===8?fe(+t):dr[t]?new Uint8Array(or(String(t))):Ar(String(t),r);var ye=(t,r)=>{let e=Te(t.address,t.chainId,r.address,r.chainId);return s.from(br(e)).toString("hex")},Te=(t,r,e,n)=>{let o=Ar(t,r),a=_e.encodeUint64(r),i=_e.encodeUint64(n),c=_n(e,n);return Y([o,a,c,i])};var yp=(t,{userId:r,chainId:e,price:n,side:o,type:a,amount:i,total:c,id:p})=>{let{baseAsset:f,priceAsset:d}=t,m={address:r,chainId:e},h=o===K.Buy?d:f;return{action:"order",actionId:p,account:m,token:h,amount:o===K.Buy?a===j.Market?fr(c,d.decimal):mr(zr(i,f.decimal),fr(n,d.decimal)):i,ts:Date.now()}},Ip=(t,r,e,n="0")=>({hash:ye(t,r),loginAddress:t.address,loginChainId:t.chainId,tokenId:r.address,tokenChainId:r.chainId,amount:e,lockedAmount:n});export{yp as mapToBalanceInfo,Ip as mapToCodexBalance};
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|