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