@ultrade/shared 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/common/auth.helper.js +1 -1
- package/dist/browser/common/index.js +1 -1
- package/dist/browser/constants/index.js +1 -1
- package/dist/browser/helpers/Encoding.js +1 -1
- package/dist/browser/helpers/algo.helper.js +1 -1
- package/dist/browser/helpers/balance.helper.js +1 -1
- package/dist/browser/helpers/codex/common.helper.js +2 -2
- package/dist/browser/helpers/codex/index.js +2 -2
- package/dist/browser/helpers/codex/mbr.helper.js +1 -1
- package/dist/browser/helpers/codex/mna.helper.js +1 -1
- package/dist/browser/helpers/codex/order.helper.js +1 -1
- package/dist/browser/helpers/codex/setGlobal.helper.js +1 -1
- package/dist/browser/helpers/codex/transfer.helper.js +2 -2
- package/dist/browser/helpers/codex/txn.helper.js +1 -1
- package/dist/browser/helpers/codex.helper.js +6 -6
- package/dist/browser/helpers/eth.helper.js +2 -2
- package/dist/browser/helpers/index.js +1 -1
- package/dist/browser/helpers/pointSystem.helper.js +1 -1
- package/dist/browser/helpers/withdraw.helper.js +2 -2
- package/dist/browser/interfaces/index.js +1 -1
- package/dist/browser/types/index.js +1 -1
- package/dist/node/common/index.js +1 -1
- package/dist/node/helpers/Encoding.js +1 -1
- package/dist/node/helpers/algo.helper.js +1 -1
- package/dist/node/helpers/assert.helper.js +1 -1
- package/dist/node/helpers/balance.helper.js +1 -1
- package/dist/node/helpers/codex/common.helper.js +2 -2
- package/dist/node/helpers/codex/index.js +2 -2
- package/dist/node/helpers/codex/mbr.helper.js +1 -1
- package/dist/node/helpers/codex/mna.helper.js +1 -1
- package/dist/node/helpers/codex/order.helper.js +1 -1
- package/dist/node/helpers/codex/setGlobal.helper.js +1 -1
- package/dist/node/helpers/codex/transfer.helper.js +2 -2
- package/dist/node/helpers/codex/txn.helper.js +1 -1
- package/dist/node/helpers/codex.helper.js +5 -5
- package/dist/node/helpers/eth.helper.js +2 -2
- package/dist/node/helpers/pointSystem.helper.js +1 -1
- package/dist/node/helpers/withdraw.helper.js +1 -1
- package/dist/node/types/index.js +1 -1
- package/dist/src/helpers/Encoding.d.ts +1 -0
- package/dist/src/interfaces/order.interface.d.ts +9 -1
- package/dist/src/interfaces/services/balances.interface.d.ts +1 -1
- package/dist/src/types/balance-result.types.d.ts +86 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/settings.type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function W(){throw new Error("setTimeout has not been defined")}function H(){throw new Error("clearTimeout has not been defined")}var x=W,I=H;typeof globalThis.setTimeout=="function"&&(x=setTimeout);typeof globalThis.clearTimeout=="function"&&(I=clearTimeout);function V(t){if(x===setTimeout)return setTimeout(t,0);if((x===W||!x)&&setTimeout)return x=setTimeout,setTimeout(t,0);try{return x(t,0)}catch{try{return x.call(null,t,0)}catch{return x.call(this,t,0)}}}function sr(t){if(I===clearTimeout)return clearTimeout(t);if((I===H||!I)&&clearTimeout)return I=clearTimeout,clearTimeout(t);try{return I(t)}catch{try{return I.call(null,t)}catch{return I.call(this,t)}}}var m=[],D=!1,w,P=-1;function fr(){!D||!w||(D=!1,w.length?m=w.concat(m):P=-1,m.length&&X())}function X(){if(!D){var t=V(fr);D=!0;for(var r=m.length;r;){for(w=m,m=[];++P<r;)w&&w[P].run();P=-1,r=m.length}w=null,D=!1,sr(t)}}function pr(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];m.push(new Q(t,r)),m.length===1&&!D&&V(X)}function Q(t,r){this.fun=t,this.array=r}Q.prototype.run=function(){this.fun.apply(null,this.array)};var _r="browser",hr="browser",Tr=!0,dr={},Ar=[],gr="",br={},mr={},Rr={};function S(){}var xr=S,Ir=S,wr=S,Sr=S,Nr=S,yr=S,Or=S;function Dr(t){throw new Error("process.binding is not supported")}function Pr(){return"/"}function Cr(t){throw new Error("process.chdir is not supported")}function Lr(){return 0}var O=globalThis.performance||{},vr=O.now||O.mozNow||O.msNow||O.oNow||O.webkitNow||function(){return new Date().getTime()};function Mr(t){var r=vr.call(O)*.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 Ur=new Date;function kr(){var t=new Date,r=t-Ur;return r/1e3}var p={nextTick:pr,title:_r,browser:Tr,env:dr,argv:Ar,version:gr,versions:br,on:xr,addListener:Ir,once:wr,off:Sr,removeListener:Nr,removeAllListeners:yr,emit:Or,binding:Dr,cwd:Pr,chdir:Cr,umask:Lr,hrtime:Mr,platform:hr,release:mr,config:Rr,uptime:kr},K={};Object.keys(K).forEach(t=>{let r=t.split("."),e=p;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=K[t]:e=e[i]||(e[i]={})}});var g=[],d=[],Br=typeof Uint8Array<"u"?Uint8Array:Array,Y=!1;function Z(){Y=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)g[r]=t[r],d[t.charCodeAt(r)]=r;d[45]=62,d[95]=63}function Yr(t){Y||Z();var r,e,n,i,o,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new Br(c*3/4-o),n=o>0?c-4:c;var E=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)],a[E++]=i>>16&255,a[E++]=i>>8&255,a[E++]=i&255;return o===2?(i=d[t.charCodeAt(r)]<<2|d[t.charCodeAt(r+1)]>>4,a[E++]=i&255):o===1&&(i=d[t.charCodeAt(r)]<<10|d[t.charCodeAt(r+1)]<<4|d[t.charCodeAt(r+2)]>>2,a[E++]=i>>8&255,a[E++]=i&255),a}function Fr(t){return g[t>>18&63]+g[t>>12&63]+g[t>>6&63]+g[t&63]}function Gr(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(Fr(n));return i.join("")}function q(t){Y||Z();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,c=0,E=e-n;c<E;c+=a)o.push(Gr(t,c,c+a>E?E:c+a));return n===1?(r=t[e-1],i+=g[r>>2],i+=g[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=g[r>>10],i+=g[r>>4&63],i+=g[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 C(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function R(t,r){if(C()<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 F(this,t)}return z(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function z(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?Hr(t,r,e,n):typeof r=="string"?Wr(t,r,e):Vr(t,r)}u.from=function(t,r,e){return z(null,t,r,e)};u.kMaxLength=C();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function j(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 Kr(t,r,e,n){return j(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)}u.alloc=function(t,r,e){return Kr(null,t,r,e)};function F(t,r){if(j(r),t=R(t,r<0?0:G(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return F(null,t)};u.allocUnsafeSlow=function(t){return F(null,t)};function Wr(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=R(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function B(t,r){var e=r.length<0?0:G(r.length)|0;t=R(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Hr(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=B(t,r),t}function Vr(t,r){if(b(r)){var e=G(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"||le(r.length)?R(t,0):B(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return B(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function G(t){if(t>=C())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+C().toString(16)+" bytes");return t|0}u.isBuffer=se;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 L(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 L(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=rr;function Xr(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 te(this,r,e);case"utf8":case"utf-8":return nr(this,r,e);case"ascii":return re(this,r,e);case"latin1":case"binary":return ee(this,r,e);case"base64":return zr(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ne(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function N(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)N(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)N(this,e,e+3),N(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)N(this,e,e+7),N(this,e+1,e+6),N(this,e+2,e+5),N(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?nr(this,0,r):Xr.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,c=n-e,E=Math.min(a,c),s=this.slice(i,o),f=r.slice(e,n),l=0;l<E;++l)if(s[l]!==f[l]){a=s[l],c=f[l];break}return a<c?-1:c<a?1:0};function er(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:J(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):J(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function J(t,r,e,n,i){var o=1,a=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,c/=2,e/=2}function E(T,y){return o===1?T[y]:T.readUInt16BE(y*o)}var s;if(i){var f=-1;for(s=e;s<a;s++)if(E(t,s)===E(r,f===-1?0:s-f)){if(f===-1&&(f=s),s-f+1===c)return f*o}else f!==-1&&(s-=s-f),f=-1}else for(e+c>a&&(e=a-c),s=e;s>=0;s--){for(var l=!0,A=0;A<c;A++)if(E(t,s+A)!==E(r,A)){l=!1;break}if(l)return s}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return er(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return er(this,r,e,n,!1)};function Qr(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 c=parseInt(r.substr(a*2,2),16);if(isNaN(c))return a;t[e+a]=c}return a}function qr(t,r,e,n){return U(L(r,t.length-e),t,e,n)}function tr(t,r,e,n){return U(ce(r),t,e,n)}function Jr(t,r,e,n){return tr(t,r,e,n)}function $r(t,r,e,n){return U(ur(r),t,e,n)}function Zr(t,r,e,n){return U(Ee(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 Qr(this,r,e,n);case"utf8":case"utf-8":return qr(this,r,e,n);case"ascii":return tr(this,r,e,n);case"latin1":case"binary":return Jr(this,r,e,n);case"base64":return $r(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Zr(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 zr(t,r,e){return r===0&&e===t.length?q(t):q(t.slice(r,e))}function nr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=e){var E,s,f,l;switch(c){case 1:o<128&&(a=o);break;case 2:E=t[i+1],(E&192)===128&&(l=(o&31)<<6|E&63,l>127&&(a=l));break;case 3:E=t[i+1],s=t[i+2],(E&192)===128&&(s&192)===128&&(l=(o&15)<<12|(E&63)<<6|s&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:E=t[i+1],s=t[i+2],f=t[i+3],(E&192)===128&&(s&192)===128&&(f&192)===128&&(l=(o&15)<<18|(E&63)<<12|(s&63)<<6|f&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return jr(n)}var $=4096;function jr(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 re(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 ee(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 te(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+=ue(t[o]);return i}function ne(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 _(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||_(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||_(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||_(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||_(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||_(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||_(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||_(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||_(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||_(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||_(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||_(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||_(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||_(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||_(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||_(r,4,this.length),k(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||_(r,4,this.length),k(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||_(r,8,this.length),k(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||_(r,8,this.length),k(this,r,!1,52,8)};function h(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;h(this,r,e,n,o,0)}var a=1,c=0;for(this[e]=r&255;++c<n&&(a*=256);)this[e+c]=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;h(this,r,e,n,o,0)}var a=n-1,c=1;for(this[e+a]=r&255;--a>=0&&(c*=256);)this[e+a]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,1,255,0),u.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}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):v(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):v(this,r,e,!1),e+2};function M(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||h(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):M(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||h(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):M(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);h(this,r,e,n,o-1,-o)}var a=0,c=1,E=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&E===0&&this[e+a-1]!==0&&(E=1),this[e+a]=(r/c>>0)-E&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);h(this,r,e,n,o-1,-o)}var a=n-1,c=1,E=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&E===0&&this[e+a+1]!==0&&(E=1),this[e+a]=(r/c>>0)-E&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||h(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||h(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):v(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):v(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||h(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):M(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||h(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):M(this,r,e,!1),e+4};function ir(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function or(t,r,e,n,i){return i||ir(t,r,e,4,34028234663852886e22,-34028234663852886e22),Er(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return or(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return or(this,r,e,!1,n)};function ar(t,r,e,n,i){return i||ir(t,r,e,8,17976931348623157e292,-17976931348623157e292),Er(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return ar(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return ar(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 c=b(r)?r:L(new u(r,i).toString()),E=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%E]}return this};var ie=/[^+\/0-9A-Za-z-_]/g;function oe(t){if(t=ae(t).replace(ie,""),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 ue(t){return t<16?"0"+t.toString(16):t.toString(16)}function L(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 ce(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Ee(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 Yr(oe(t))}function U(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 le(t){return t!==t}function se(t){return t!=null&&(!!t._isBuffer||cr(t)||fe(t))}function cr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function fe(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&cr(t.slice(0,0))}function k(t,r,e,n,i){var o,a,c=i*8-n-1,E=(1<<c)-1,s=E>>1,f=-7,l=e?i-1:0,A=e?-1:1,T=t[r+l];for(l+=A,o=T&(1<<-f)-1,T>>=-f,f+=c;f>0;o=o*256+t[r+l],l+=A,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+t[r+l],l+=A,f-=8);if(o===0)o=1-s;else{if(o===E)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-s}return(T?-1:1)*a*Math.pow(2,o-n)}function Er(t,r,e,n,i,o){var a,c,E,s=o*8-i-1,f=(1<<s)-1,l=f>>1,A=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=n?0:o-1,y=n?1:-1,lr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(E=Math.pow(2,-a))<1&&(a--,E*=2),a+l>=1?r+=A/E:r+=A*Math.pow(2,1-l),r*E>=2&&(a++,E/=2),a+l>=f?(c=0,a=f):a+l>=1?(c=(r*E-1)*Math.pow(2,i),a=a+l):(c=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+T]=c&255,T+=y,c/=256,i-=8);for(a=a<<i|c,s+=i;s>0;t[e+T]=a&255,T+=y,a/=256,s-=8);t[e+T-y]|=lr*128}var xe=864e5,Ie=30;var ye=18,Oe=1e5,De=1e3,Pe=9e4,Ce=30,Le=60,ve=328,Me=1,Ue=18,ke=36,Be=248;var Ke={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Xe={SUCCESS:200,CREATED:201,ACCEPTED:202,NOCONTENT:204,BADREQUEST:400,FORBIDDEN:403,NOTFOUND:404,TIMEOUT:408,TOOMANYREQ:429,INTERNALSERVER:500,BADGATEWAYS:502,SERVICEUNAVILABLE:503,GATEWAYTIMEOUT:504},Qe={INSERT:"Data has been saved successfully.",ERROR:"Some error has been occured. Please try again.",SUCCESS:"Your request is executed successfully!",REQUIRED:"coin_type or price param is required",CAPTCHATEXTNOTFOUND:"Captcha text not found.",CAPTCHA_VERIFICATION_FAILED:"Captcha is not verified.",NOTEMPTY:"coin_type or price should not be empty",PAIR_LIST:"Pair list",PAIR_STATUS:"Pair status has been changed",ACTIVE_USERS:"Active Users",SETTINGS_NOT_FOUND:"No settings found in DB.",TRADE_IS_HALT:"Trading is disabled.",KYC_REQUIRED:"KYC is required for this action.",EMAIL_NOT_VERIFIED:"Your email is not verified.Please verify first.",NOT_BETA_USER:"Trade only works for beta user.",WRONG_PAIR_KEY:"Pair key not found.",PAIRDISABLED:"Temporarily order placement has been disabled for this pair. Please try again later.",BALANCE_NOT_SUFFICIENT:"You have insufficient balance.",MIN_TRADE_NOT_MATCHED:"Minimum trade limit does not matched.",ORDER_PLACED_SUCCESSFULLY:"Order has been placed successfully.",ORDER_NOT_FOUND:"Sorry this order id does not found.",ORDER_ALREADY_MATCHED:"Order already matched.",ORDER_ALREADY_CANCELED:"Order already cancelled.",ORDER_CANCELED_SUCCESSFULLY:"order successfully cancelled",ORDER_LIST:"Order list fetched successfully.",ORDER_EXIT:"Successfully exited from the position.",PAIRERR:"please provide pair param",ORDERSIDE:"side param is required",ORDERTYPE:"type param is required",ORDERIDREQ:"order_id param is required",ORDERDETAIL:"order detail",COMMODITYORICE:"commodity price",COMMODITYSPOT:"commodity spot updated",TOKEN_INSERTED:"ERC token has been added",PARAMREQ:"Parameter missing",EXIST:"Token Already Exist",BREACHEDTOKENS:"List of breached tokens",API_EXPOSE:{TOKEN_NOT_FOUND:"Token not found, Please get token and set to header.",ERROR:"Something went wrong, Please try again later"},LIMITED_UNITS:"ONLY {{units}} units are available. You can place your order with this amount",UNITS_UNAVAIL:"Amount unavailable",ORDER:{ERROR:"An error has been occured",UNITS_UNAVAIL:"Amount unavailable",LIMITED_UNITS:"ONLY {{units}} units are available. You can place your order with this amount",PLACED:"Order has been placed",NOPARAMS:"empty body params",ORDER_NOT_FOUND:"Sorry this order id not found.",ORDER_ALREADY_MATCHED:"Order already matched.",ORDER_ALREADY_CANCELED:"Order already cancelled.",ORDER_CANCELED_SUCCESSFULLY:"Order cancelled successfully"},DOMAIN_NOT_FOUND:"domain not found"},qe={SMALLESTUNIT:p.env.SMALLEST_UNIT},Je={SMALLEST_UNITS:p.env.SMALLEST_UNIT},$e={AVAILABLE_ASSETS_PER_USER:1,AVAILABLE_ASSETS_PER_IP:3};var rt=`{"theme1":{"value":"${p.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${p.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${p.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var at=["point-system.discordEnabled","point-system.telegramBotName","point-system.telegramBotId","point-system.telegramEnabled","point-system.telegramGroupId","point-system.telegramGroupName","point-system.twitterAccountId","point-system.twitterAccountName","point-system.twitterEnabled","point-system.twitterJobEnabled","point-system.guideLink"],ut=["obdex","kycTradeRequirementEnabled","newTab","reportButtons"],ct=["geoblock","pinnedPairs","customMenuItems","chartInt"];var ft=t=>`By signing this message, you confirm that the wallet is a trusted one ${t}; Data: `;var Tt=p.env.REACT_APP_API_URL,dt=p.env.REACT_APP_SOCKET_URL,At=p.env.REACT_APP_ALGO_SERVER,gt=p.env.REACT_APP_ALGO_SERVER_PORT||"",bt=p.env.REACT_APP_ALGOD_TOKEN||"",mt=p.env.REACT_APP_DISPENSER_LINK,pe=p.env.REACT_APP_FRONTEND_LINK||"",Rt=p.env.REACT_APP_ALGO_EXPLORER_LINK,xt=p.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,It=(p.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",wt=p.env.REACT_APP_USERBACK_ACCESS_TOKEN,St=(p.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true",Nt=4,yt=100,Ot=50,Dt=50,Pt=.001*10**6,Ct=.002*10**6,Lt="Ultrade",vt=["theme1","theme2","theme3"],Mt=p.env.REACT_APP_MASTER_APP_ID||"406",Ut=p.env.REACT_APP_AGG_APP_ID||"408",_e=Number(p.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",_e);var kt=3e3,he=p.env.REACT_APP_ALGO_NETWORK||"",Bt=.3,Yt=1,Ft=pe==="https://dev.ultradedev.net",Gt="00:00",Kt=1e6,Te=he.toLowerCase()==="mainnet"?"mainnet":"testnet",Wt=/[^\p{L}\p{N} .,!?:@$%()_-]/gui,Ht=Te==="mainnet"?416001:416002;export{Ut as AGG_APP_ID,bt as ALGOD_TOKEN,xt as ALGO_EXPLORER_ASSETS_URL,Rt as ALGO_EXPLORER_LINK,he as ALGO_NETWORK,At as ALGO_SERVER,gt as ALGO_SERVER_PORT,Tt as API_HOST,Ct as APP_CLOSEOUT_FEE,qe as BIGNUMBER,ut as BOOLEAN_SETTINGS,Je as CALCULATIONS,Ke as CCTP_UNIFIED_ASSETS,_e as CODEX_APP_ID,xe as DAY_MILLISECONDS,Bt as DEFAULT_AGG_FEE,Pe as DEFAULT_FEE_SHARE,Ce as DEFAULT_ORDER_EXPIRATION_DAYS,mt as DISPENSER_LINK,Lt as EXCHANGE_NAME,Ie as EXPIRE_DAYS,St as EXT_ORDER_TYPES,ye as FACTOR_PRICE_DECIMAL,Oe as FEE_SCALE,De as FRONTEND_FEE_SCALE,pe as FRONTEND_LINK,Kt as GASLIMIT,Nt as GLOWL_DECIMAL,Ft as IS_DEV,ct as JSON_ARRAY_SETTINGS,Dt as MARKET_TRADES_SIZE,Mt as MASTER_APP_ID,Ue as MAX_TOKEN_DECIMAL,Le as MIN_ORDER_EXPIRATION_MINS,Te as NETWORK,Ot as ORDER_BOOK_BUFFER,yt as ORDER_BOOK_SIZE,ve as ORDER_DATA_BYTES_LENGTH,Me as ORDER_MSG_VERSION,kt as PLATFORM_FEE,Ht as PeraChainId,at as PointSystemSettingsIds,It as REACT_APP_REQUIRE_ACCESS_CODE,Xe as RESPONSES,Qe as RES_MSG,$e as SERVER,ke as SHARE_DATA_LENGTH,dt as SOCKET_URL,vt as THEMES,Yt as ULTRADE_ID,wt as USERBACK_ACCESS_TOKEN,Be as WITHDRAW_DATA_BYTES_LENGTH,Pt as WITHDRAW_FEE,Gt as ZERO_TIMER,ft as messageForSigning,Wt as sanitizeRegex};
|
|
1
|
+
function W(){throw new Error("setTimeout has not been defined")}function H(){throw new Error("clearTimeout has not been defined")}var x=W,I=H;typeof globalThis.setTimeout=="function"&&(x=setTimeout);typeof globalThis.clearTimeout=="function"&&(I=clearTimeout);function V(t){if(x===setTimeout)return setTimeout(t,0);if((x===W||!x)&&setTimeout)return x=setTimeout,setTimeout(t,0);try{return x(t,0)}catch{try{return x.call(null,t,0)}catch{return x.call(this,t,0)}}}function sr(t){if(I===clearTimeout)return clearTimeout(t);if((I===H||!I)&&clearTimeout)return I=clearTimeout,clearTimeout(t);try{return I(t)}catch{try{return I.call(null,t)}catch{return I.call(this,t)}}}var m=[],D=!1,w,P=-1;function fr(){!D||!w||(D=!1,w.length?m=w.concat(m):P=-1,m.length&&X())}function X(){if(!D){var t=V(fr);D=!0;for(var r=m.length;r;){for(w=m,m=[];++P<r;)w&&w[P].run();P=-1,r=m.length}w=null,D=!1,sr(t)}}function pr(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];m.push(new Q(t,r)),m.length===1&&!D&&V(X)}function Q(t,r){this.fun=t,this.array=r}Q.prototype.run=function(){this.fun.apply(null,this.array)};var _r="browser",hr="browser",Tr=!0,Ar={},dr=[],gr="",br={},mr={},Rr={};function S(){}var xr=S,Ir=S,wr=S,Sr=S,Nr=S,yr=S,Or=S;function Dr(t){throw new Error("process.binding is not supported")}function Pr(){return"/"}function Cr(t){throw new Error("process.chdir is not supported")}function Lr(){return 0}var O=globalThis.performance||{},vr=O.now||O.mozNow||O.msNow||O.oNow||O.webkitNow||function(){return new Date().getTime()};function Mr(t){var r=vr.call(O)*.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 Ur=new Date;function kr(){var t=new Date,r=t-Ur;return r/1e3}var p={nextTick:pr,title:_r,browser:Tr,env:Ar,argv:dr,version:gr,versions:br,on:xr,addListener:Ir,once:wr,off:Sr,removeListener:Nr,removeAllListeners:yr,emit:Or,binding:Dr,cwd:Pr,chdir:Cr,umask:Lr,hrtime:Mr,platform:hr,release:mr,config:Rr,uptime:kr},K={};Object.keys(K).forEach(t=>{let r=t.split("."),e=p;for(let n=0;n<r.length;n++){let i=r[n];n===r.length-1?e[i]=K[t]:e=e[i]||(e[i]={})}});var g=[],A=[],Br=typeof Uint8Array<"u"?Uint8Array:Array,Y=!1;function Z(){Y=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)g[r]=t[r],A[t.charCodeAt(r)]=r;A[45]=62,A[95]=63}function Yr(t){Y||Z();var r,e,n,i,o,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new Br(c*3/4-o),n=o>0?c-4:c;var E=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[E++]=i>>16&255,a[E++]=i>>8&255,a[E++]=i&255;return o===2?(i=A[t.charCodeAt(r)]<<2|A[t.charCodeAt(r+1)]>>4,a[E++]=i&255):o===1&&(i=A[t.charCodeAt(r)]<<10|A[t.charCodeAt(r+1)]<<4|A[t.charCodeAt(r+2)]>>2,a[E++]=i>>8&255,a[E++]=i&255),a}function Fr(t){return g[t>>18&63]+g[t>>12&63]+g[t>>6&63]+g[t&63]}function Gr(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(Fr(n));return i.join("")}function q(t){Y||Z();for(var r,e=t.length,n=e%3,i="",o=[],a=16383,c=0,E=e-n;c<E;c+=a)o.push(Gr(t,c,c+a>E?E:c+a));return n===1?(r=t[e-1],i+=g[r>>2],i+=g[r<<4&63],i+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],i+=g[r>>10],i+=g[r>>4&63],i+=g[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 C(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function R(t,r){if(C()<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 F(this,t)}return z(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function z(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?Hr(t,r,e,n):typeof r=="string"?Wr(t,r,e):Vr(t,r)}u.from=function(t,r,e){return z(null,t,r,e)};u.kMaxLength=C();u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]);function j(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 Kr(t,r,e,n){return j(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)}u.alloc=function(t,r,e){return Kr(null,t,r,e)};function F(t,r){if(j(r),t=R(t,r<0?0:G(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return F(null,t)};u.allocUnsafeSlow=function(t){return F(null,t)};function Wr(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=R(t,n);var i=t.write(r,e);return i!==n&&(t=t.slice(0,i)),t}function B(t,r){var e=r.length<0?0:G(r.length)|0;t=R(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Hr(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=B(t,r),t}function Vr(t,r){if(b(r)){var e=G(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"||le(r.length)?R(t,0):B(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return B(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function G(t){if(t>=C())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+C().toString(16)+" bytes");return t|0}u.isBuffer=se;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 L(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 L(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=rr;function Xr(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 te(this,r,e);case"utf8":case"utf-8":return nr(this,r,e);case"ascii":return re(this,r,e);case"latin1":case"binary":return ee(this,r,e);case"base64":return zr(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ne(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function N(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)N(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)N(this,e,e+3),N(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)N(this,e,e+7),N(this,e+1,e+6),N(this,e+2,e+5),N(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?nr(this,0,r):Xr.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,c=n-e,E=Math.min(a,c),s=this.slice(i,o),f=r.slice(e,n),l=0;l<E;++l)if(s[l]!==f[l]){a=s[l],c=f[l];break}return a<c?-1:c<a?1:0};function er(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:J(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):J(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function J(t,r,e,n,i){var o=1,a=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;o=2,a/=2,c/=2,e/=2}function E(T,y){return o===1?T[y]:T.readUInt16BE(y*o)}var s;if(i){var f=-1;for(s=e;s<a;s++)if(E(t,s)===E(r,f===-1?0:s-f)){if(f===-1&&(f=s),s-f+1===c)return f*o}else f!==-1&&(s-=s-f),f=-1}else for(e+c>a&&(e=a-c),s=e;s>=0;s--){for(var l=!0,d=0;d<c;d++)if(E(t,s+d)!==E(r,d)){l=!1;break}if(l)return s}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return er(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return er(this,r,e,n,!1)};function Qr(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 c=parseInt(r.substr(a*2,2),16);if(isNaN(c))return a;t[e+a]=c}return a}function qr(t,r,e,n){return U(L(r,t.length-e),t,e,n)}function tr(t,r,e,n){return U(ce(r),t,e,n)}function Jr(t,r,e,n){return tr(t,r,e,n)}function $r(t,r,e,n){return U(ur(r),t,e,n)}function Zr(t,r,e,n){return U(Ee(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 Qr(this,r,e,n);case"utf8":case"utf-8":return qr(this,r,e,n);case"ascii":return tr(this,r,e,n);case"latin1":case"binary":return Jr(this,r,e,n);case"base64":return $r(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Zr(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 zr(t,r,e){return r===0&&e===t.length?q(t):q(t.slice(r,e))}function nr(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o=t[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=e){var E,s,f,l;switch(c){case 1:o<128&&(a=o);break;case 2:E=t[i+1],(E&192)===128&&(l=(o&31)<<6|E&63,l>127&&(a=l));break;case 3:E=t[i+1],s=t[i+2],(E&192)===128&&(s&192)===128&&(l=(o&15)<<12|(E&63)<<6|s&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:E=t[i+1],s=t[i+2],f=t[i+3],(E&192)===128&&(s&192)===128&&(f&192)===128&&(l=(o&15)<<18|(E&63)<<12|(s&63)<<6|f&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return jr(n)}var $=4096;function jr(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 re(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 ee(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 te(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+=ue(t[o]);return i}function ne(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 _(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||_(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||_(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||_(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||_(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||_(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||_(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||_(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||_(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||_(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||_(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||_(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||_(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||_(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||_(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||_(r,4,this.length),k(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||_(r,4,this.length),k(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||_(r,8,this.length),k(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||_(r,8,this.length),k(this,r,!1,52,8)};function h(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;h(this,r,e,n,o,0)}var a=1,c=0;for(this[e]=r&255;++c<n&&(a*=256);)this[e+c]=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;h(this,r,e,n,o,0)}var a=n-1,c=1;for(this[e+a]=r&255;--a>=0&&(c*=256);)this[e+a]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,1,255,0),u.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}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):v(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):v(this,r,e,!1),e+2};function M(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||h(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):M(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||h(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):M(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);h(this,r,e,n,o-1,-o)}var a=0,c=1,E=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&E===0&&this[e+a-1]!==0&&(E=1),this[e+a]=(r/c>>0)-E&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);h(this,r,e,n,o-1,-o)}var a=n-1,c=1,E=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&E===0&&this[e+a+1]!==0&&(E=1),this[e+a]=(r/c>>0)-E&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||h(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||h(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):v(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||h(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):v(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||h(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):M(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||h(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):M(this,r,e,!1),e+4};function ir(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function or(t,r,e,n,i){return i||ir(t,r,e,4,34028234663852886e22,-34028234663852886e22),Er(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return or(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return or(this,r,e,!1,n)};function ar(t,r,e,n,i){return i||ir(t,r,e,8,17976931348623157e292,-17976931348623157e292),Er(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return ar(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return ar(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 c=b(r)?r:L(new u(r,i).toString()),E=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%E]}return this};var ie=/[^+\/0-9A-Za-z-_]/g;function oe(t){if(t=ae(t).replace(ie,""),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 ue(t){return t<16?"0"+t.toString(16):t.toString(16)}function L(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 ce(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Ee(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 Yr(oe(t))}function U(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 le(t){return t!==t}function se(t){return t!=null&&(!!t._isBuffer||cr(t)||fe(t))}function cr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function fe(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&cr(t.slice(0,0))}function k(t,r,e,n,i){var o,a,c=i*8-n-1,E=(1<<c)-1,s=E>>1,f=-7,l=e?i-1:0,d=e?-1:1,T=t[r+l];for(l+=d,o=T&(1<<-f)-1,T>>=-f,f+=c;f>0;o=o*256+t[r+l],l+=d,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+t[r+l],l+=d,f-=8);if(o===0)o=1-s;else{if(o===E)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-s}return(T?-1:1)*a*Math.pow(2,o-n)}function Er(t,r,e,n,i,o){var a,c,E,s=o*8-i-1,f=(1<<s)-1,l=f>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=n?0:o-1,y=n?1:-1,lr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(E=Math.pow(2,-a))<1&&(a--,E*=2),a+l>=1?r+=d/E:r+=d*Math.pow(2,1-l),r*E>=2&&(a++,E/=2),a+l>=f?(c=0,a=f):a+l>=1?(c=(r*E-1)*Math.pow(2,i),a=a+l):(c=r*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[e+T]=c&255,T+=y,c/=256,i-=8);for(a=a<<i|c,s+=i;s>0;t[e+T]=a&255,T+=y,a/=256,s-=8);t[e+T-y]|=lr*128}var xe=864e5,Ie=30;var ye=18,Oe=1e5,De=1e3,Pe=9e4,Ce=30,Le=60,ve=328,Me=1,Ue=18,ke=36,Be=248;var Ke={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Xe={SUCCESS:200,CREATED:201,ACCEPTED:202,NOCONTENT:204,BADREQUEST:400,FORBIDDEN:403,NOTFOUND:404,TIMEOUT:408,TOOMANYREQ:429,INTERNALSERVER:500,BADGATEWAYS:502,SERVICEUNAVILABLE:503,GATEWAYTIMEOUT:504},Qe={INSERT:"Data has been saved successfully.",ERROR:"Some error has been occured. Please try again.",SUCCESS:"Your request is executed successfully!",REQUIRED:"coin_type or price param is required",CAPTCHATEXTNOTFOUND:"Captcha text not found.",CAPTCHA_VERIFICATION_FAILED:"Captcha is not verified.",NOTEMPTY:"coin_type or price should not be empty",PAIR_LIST:"Pair list",PAIR_STATUS:"Pair status has been changed",ACTIVE_USERS:"Active Users",SETTINGS_NOT_FOUND:"No settings found in DB.",TRADE_IS_HALT:"Trading is disabled.",KYC_REQUIRED:"KYC is required for this action.",EMAIL_NOT_VERIFIED:"Your email is not verified.Please verify first.",NOT_BETA_USER:"Trade only works for beta user.",WRONG_PAIR_KEY:"Pair key not found.",PAIRDISABLED:"Temporarily order placement has been disabled for this pair. Please try again later.",BALANCE_NOT_SUFFICIENT:"You have insufficient balance.",MIN_TRADE_NOT_MATCHED:"Minimum trade limit does not matched.",ORDER_PLACED_SUCCESSFULLY:"Order has been placed successfully.",ORDER_NOT_FOUND:"Sorry this order id does not found.",ORDER_ALREADY_MATCHED:"Order already matched.",ORDER_ALREADY_CANCELED:"Order already cancelled.",ORDER_CANCELED_SUCCESSFULLY:"order successfully cancelled",ORDER_LIST:"Order list fetched successfully.",ORDER_EXIT:"Successfully exited from the position.",PAIRERR:"please provide pair param",ORDERSIDE:"side param is required",ORDERTYPE:"type param is required",ORDERIDREQ:"order_id param is required",ORDERDETAIL:"order detail",COMMODITYORICE:"commodity price",COMMODITYSPOT:"commodity spot updated",TOKEN_INSERTED:"ERC token has been added",PARAMREQ:"Parameter missing",EXIST:"Token Already Exist",BREACHEDTOKENS:"List of breached tokens",API_EXPOSE:{TOKEN_NOT_FOUND:"Token not found, Please get token and set to header.",ERROR:"Something went wrong, Please try again later"},LIMITED_UNITS:"ONLY {{units}} units are available. You can place your order with this amount",UNITS_UNAVAIL:"Amount unavailable",ORDER:{ERROR:"An error has been occured",UNITS_UNAVAIL:"Amount unavailable",LIMITED_UNITS:"ONLY {{units}} units are available. You can place your order with this amount",PLACED:"Order has been placed",NOPARAMS:"empty body params",ORDER_NOT_FOUND:"Sorry this order id not found.",ORDER_ALREADY_MATCHED:"Order already matched.",ORDER_ALREADY_CANCELED:"Order already cancelled.",ORDER_CANCELED_SUCCESSFULLY:"Order cancelled successfully"},DOMAIN_NOT_FOUND:"domain not found"},qe={SMALLESTUNIT:p.env.SMALLEST_UNIT},Je={SMALLEST_UNITS:p.env.SMALLEST_UNIT},$e={AVAILABLE_ASSETS_PER_USER:1,AVAILABLE_ASSETS_PER_IP:3};var rt=`{"theme1":{"value":"${p.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${p.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${p.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var at=["point-system.discordEnabled","point-system.telegramBotName","point-system.telegramBotId","point-system.telegramEnabled","point-system.telegramGroupId","point-system.telegramGroupName","point-system.twitterAccountId","point-system.twitterAccountName","point-system.twitterEnabled","point-system.twitterJobEnabled","point-system.guideLink"],ut=["obdex","kycTradeRequirementEnabled","newTab","reportButtons"],ct=["geoblock","pinnedPairs","customMenuItems","chartInt"];var ft=t=>`By signing this message, you confirm that the wallet is a trusted one ${t}; Data: `;var Tt=p.env.REACT_APP_API_URL,At=p.env.REACT_APP_SOCKET_URL,dt=p.env.REACT_APP_ALGO_SERVER,gt=p.env.REACT_APP_ALGO_SERVER_PORT||"",bt=p.env.REACT_APP_ALGOD_TOKEN||"",mt=p.env.REACT_APP_DISPENSER_LINK,pe=p.env.REACT_APP_FRONTEND_LINK||"",Rt=p.env.REACT_APP_ALGO_EXPLORER_LINK,xt=p.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,It=(p.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",wt=p.env.REACT_APP_USERBACK_ACCESS_TOKEN,St=(p.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true",Nt=4,yt=100,Ot=50,Dt=50,Pt=.001*10**6,Ct=.002*10**6,Lt="Ultrade",vt=["theme1","theme2","theme3"],Mt=p.env.REACT_APP_MASTER_APP_ID||"406",Ut=p.env.REACT_APP_AGG_APP_ID||"408",_e=Number(p.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",_e);var kt=3e3,he=p.env.REACT_APP_ALGO_NETWORK||"",Bt=.3,Yt=1,Ft=pe==="https://dev.ultradedev.net",Gt="00:00",Kt=1e6,Te=he.toLowerCase()==="mainnet"?"mainnet":"testnet",Wt=/[^\p{L}\p{N} .,!?:@$%()_-]/gui,Ht=Te==="mainnet"?416001:416002;export{Ut as AGG_APP_ID,bt as ALGOD_TOKEN,xt as ALGO_EXPLORER_ASSETS_URL,Rt as ALGO_EXPLORER_LINK,he as ALGO_NETWORK,dt as ALGO_SERVER,gt as ALGO_SERVER_PORT,Tt as API_HOST,Ct as APP_CLOSEOUT_FEE,qe as BIGNUMBER,ut as BOOLEAN_SETTINGS,Je as CALCULATIONS,Ke as CCTP_UNIFIED_ASSETS,_e as CODEX_APP_ID,xe as DAY_MILLISECONDS,Bt as DEFAULT_AGG_FEE,Pe as DEFAULT_FEE_SHARE,Ce as DEFAULT_ORDER_EXPIRATION_DAYS,mt as DISPENSER_LINK,Lt as EXCHANGE_NAME,Ie as EXPIRE_DAYS,St as EXT_ORDER_TYPES,ye as FACTOR_PRICE_DECIMAL,Oe as FEE_SCALE,De as FRONTEND_FEE_SCALE,pe as FRONTEND_LINK,Kt as GASLIMIT,Nt as GLOWL_DECIMAL,Ft as IS_DEV,ct as JSON_ARRAY_SETTINGS,Dt as MARKET_TRADES_SIZE,Mt as MASTER_APP_ID,Ue as MAX_TOKEN_DECIMAL,Le as MIN_ORDER_EXPIRATION_MINS,Te as NETWORK,Ot as ORDER_BOOK_BUFFER,yt as ORDER_BOOK_SIZE,ve as ORDER_DATA_BYTES_LENGTH,Me as ORDER_MSG_VERSION,kt as PLATFORM_FEE,Ht as PeraChainId,at as PointSystemSettingsIds,It as REACT_APP_REQUIRE_ACCESS_CODE,Xe as RESPONSES,Qe as RES_MSG,$e as SERVER,ke as SHARE_DATA_LENGTH,At as SOCKET_URL,vt as THEMES,Yt as ULTRADE_ID,wt as USERBACK_ACCESS_TOKEN,Be as WITHDRAW_DATA_BYTES_LENGTH,Pt as WITHDRAW_FEE,Gt as ZERO_TIMER,ft as messageForSigning,Wt as sanitizeRegex};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function hr(){throw new Error("setTimeout has not been defined")}function ar(){throw new Error("clearTimeout has not been defined")}var P=hr,D=ar;typeof globalThis.setTimeout=="function"&&(P=setTimeout);typeof globalThis.clearTimeout=="function"&&(D=clearTimeout);function cr(i){if(P===setTimeout)return setTimeout(i,0);if((P===hr||!P)&&setTimeout)return P=setTimeout,setTimeout(i,0);try{return P(i,0)}catch{try{return P.call(null,i,0)}catch{return P.call(this,i,0)}}}function Zr(i){if(D===clearTimeout)return clearTimeout(i);if((D===ar||!D)&&clearTimeout)return D=clearTimeout,clearTimeout(i);try{return D(i)}catch{try{return D.call(null,i)}catch{return D.call(this,i)}}}var B=[],N=!1,S,L=-1;function qr(){!N||!S||(N=!1,S.length?B=S.concat(B):L=-1,B.length&&sr())}function sr(){if(!N){var i=cr(qr);N=!0;for(var r=B.length;r;){for(S=B,B=[];++L<r;)S&&S[L].run();L=-1,r=B.length}S=null,N=!1,Zr(i)}}function jr(i){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];B.push(new pr(i,r)),B.length===1&&!N&&cr(sr)}function pr(i,r){this.fun=i,this.array=r}pr.prototype.run=function(){this.fun.apply(null,this.array)};var rn="browser",nn="browser",en=!0,tn={},un=[],on="",fn={},hn={},an={};function Y(){}var cn=Y,sn=Y,pn=Y,ln=Y,xn=Y,wn=Y,En=Y;function yn(i){throw new Error("process.binding is not supported")}function An(){return"/"}function gn(i){throw new Error("process.chdir is not supported")}function mn(){return 0}var M=globalThis.performance||{},Un=M.now||M.mozNow||M.msNow||M.oNow||M.webkitNow||function(){return new Date().getTime()};function In(i){var r=Un.call(M)*.001,n=Math.floor(r),e=Math.floor(r%1*1e9);return i&&(n=n-i[0],e=e-i[1],e<0&&(n--,e+=1e9)),[n,e]}var Rn=new Date;function Tn(){var i=new Date,r=i-Rn;return r/1e3}var $={nextTick:jr,title:rn,browser:en,env:tn,argv:un,version:on,versions:fn,on:cn,addListener:sn,once:pn,off:ln,removeListener:xn,removeAllListeners:wn,emit:En,binding:yn,cwd:An,chdir:gn,umask:mn,hrtime:In,platform:nn,release:hn,config:an,uptime:Tn},fr={};Object.keys(fr).forEach(i=>{let r=i.split("."),n=$;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=fr[i]:n=n[t]||(n[t]={})}});var R=[],U=[],_n=typeof Uint8Array<"u"?Uint8Array:Array,rr=!1;function Er(){rr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)R[r]=i[r],U[i.charCodeAt(r)]=r;U[45]=62,U[95]=63}function dn(i){rr||Er();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new _n(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=U[i.charCodeAt(r)]<<18|U[i.charCodeAt(r+1)]<<12|U[i.charCodeAt(r+2)]<<6|U[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=U[i.charCodeAt(r)]<<2|U[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=U[i.charCodeAt(r)]<<10|U[i.charCodeAt(r+1)]<<4|U[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function Bn(i){return R[i>>18&63]+R[i>>12&63]+R[i>>6&63]+R[i&63]}function Fn(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(Bn(e));return t.join("")}function lr(i){rr||Er();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(Fn(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=R[r>>2],t+=R[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=R[r>>10],t+=R[r>>4&63],t+=R[r<<2&63],t+="="),u.push(t),u.join("")}a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function W(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function F(i,r){if(W()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=a.prototype):(i===null&&(i=new a(r)),i.length=r),i}function a(i,r,n){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return nr(this,i)}return yr(this,i,r,n)}a.poolSize=8192;a._augment=function(i){return i.__proto__=a.prototype,i};function yr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Dn(i,r,n,e):typeof r=="string"?Pn(i,r,n):Sn(i,r)}a.from=function(i,r,n){return yr(null,i,r,n)};a.kMaxLength=W();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&a[Symbol.species]);function Ar(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function vn(i,r,n,e){return Ar(r),r<=0?F(i,r):n!==void 0?typeof e=="string"?F(i,r).fill(n,e):F(i,r).fill(n):F(i,r)}a.alloc=function(i,r,n){return vn(null,i,r,n)};function nr(i,r){if(Ar(r),i=F(i,r<0?0:ir(r)|0),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}a.allocUnsafe=function(i){return nr(null,i)};a.allocUnsafeSlow=function(i){return nr(null,i)};function Pn(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=gr(r,n)|0;i=F(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function j(i,r){var n=r.length<0?0:ir(r.length)|0;i=F(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function Dn(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),a.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=a.prototype):i=j(i,r),i}function Sn(i,r){if(T(r)){var n=ir(r.length)|0;return i=F(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Zn(r.length)?F(i,0):j(i,r);if(r.type==="Buffer"&&Array.isArray(r.data))return j(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ir(i){if(i>=W())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W().toString(16)+" bytes");return i|0}a.isBuffer=qn;function T(i){return!!(i!=null&&i._isBuffer)}a.compare=function(r,n){if(!T(r)||!T(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};a.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=a.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!T(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function gr(i,r){if(T(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return dr(i).length;default:if(e)return z(i).length;r=(""+r).toLowerCase(),e=!0}}a.byteLength=gr;function Yn(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return Vn(this,r,n);case"utf8":case"utf-8":return Ir(this,r,n);case"ascii":return zn(this,r,n);case"latin1":case"binary":return bn(this,r,n);case"base64":return $n(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hn(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}a.prototype._isBuffer=!0;function k(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}a.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)k(this,n,n+1);return this};a.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)k(this,n,n+3),k(this,n+1,n+2);return this};a.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)k(this,n,n+7),k(this,n+1,n+6),k(this,n+2,n+5),k(this,n+3,n+4);return this};a.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ir(this,0,r):Yn.apply(this,arguments)};a.prototype.equals=function(r){if(!T(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0};a.prototype.compare=function(r,n,e,t,u){if(!T(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function mr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,e)),T(r))return r.length===0?-1:xr(i,r,n,e,t);if(typeof r=="number")return r=r&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):xr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function xr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}a.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};a.prototype.indexOf=function(r,n,e){return mr(this,r,n,e,!0)};a.prototype.lastIndexOf=function(r,n,e){return mr(this,r,n,e,!1)};function kn(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function Cn(i,r,n,e){return H(z(r,i.length-n),i,n,e)}function Ur(i,r,n,e){return H(Kn(r),i,n,e)}function Mn(i,r,n,e){return Ur(i,r,n,e)}function Nn(i,r,n,e){return H(dr(r),i,n,e)}function Ln(i,r,n,e){return H(Qn(r,i.length-n),i,n,e)}a.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return kn(this,r,n,e);case"utf8":case"utf-8":return Cn(this,r,n,e);case"ascii":return Ur(this,r,n,e);case"latin1":case"binary":return Mn(this,r,n,e);case"base64":return Nn(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ln(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $n(i,r,n){return r===0&&n===i.length?lr(i):lr(i.slice(r,n))}function Ir(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return Wn(e)}var wr=4096;function Wn(i){var r=i.length;if(r<=wr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=wr));return n}function zn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function bn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function Vn(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=Xn(i[u]);return t}function Hn(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}a.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(a.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=a.prototype;else{var u=n-r;t=new a(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function E(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};a.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};a.prototype.readUInt8=function(r,n){return n||E(r,1,this.length),this[r]};a.prototype.readUInt16LE=function(r,n){return n||E(r,2,this.length),this[r]|this[r+1]<<8};a.prototype.readUInt16BE=function(r,n){return n||E(r,2,this.length),this[r]<<8|this[r+1]};a.prototype.readUInt32LE=function(r,n){return n||E(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};a.prototype.readUInt32BE=function(r,n){return n||E(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};a.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};a.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};a.prototype.readInt8=function(r,n){return n||E(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};a.prototype.readInt16LE=function(r,n){n||E(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};a.prototype.readInt16BE=function(r,n){n||E(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};a.prototype.readInt32LE=function(r,n){return n||E(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};a.prototype.readInt32BE=function(r,n){return n||E(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};a.prototype.readFloatLE=function(r,n){return n||E(r,4,this.length),O(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,n){return n||E(r,4,this.length),O(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,n){return n||E(r,8,this.length),O(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,n){return n||E(r,8,this.length),O(this,r,!1,52,8)};function A(i,r,n,e,t,u){if(!T(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};a.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};a.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,255,0),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function b(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}a.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};function V(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}a.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):V(this,r,n,!0),n+4};a.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};a.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,127,-128),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};a.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};a.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):V(this,r,n,!0),n+4};a.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};function Rr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Tr(i,r,n,e,t){return t||Rr(i,r,n,4,34028234663852886e22,-34028234663852886e22),Fr(i,r,n,e,23,4),n+4}a.prototype.writeFloatLE=function(r,n,e){return Tr(this,r,n,!0,e)};a.prototype.writeFloatBE=function(r,n,e){return Tr(this,r,n,!1,e)};function _r(i,r,n,e,t){return t||Rr(i,r,n,8,17976931348623157e292,-17976931348623157e292),Fr(i,r,n,e,52,8),n+8}a.prototype.writeDoubleLE=function(r,n,e){return _r(this,r,n,!0,e)};a.prototype.writeDoubleBE=function(r,n,e){return _r(this,r,n,!1,e)};a.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};a.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=T(r)?r:z(new a(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var On=/[^+\/0-9A-Za-z-_]/g;function Gn(i){if(i=Jn(i).replace(On,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Jn(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Xn(i){return i<16?"0"+i.toString(16):i.toString(16)}function z(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function Kn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Qn(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function dr(i){return dn(Gn(i))}function H(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Zn(i){return i!==i}function qn(i){return i!=null&&(!!i._isBuffer||Br(i)||jn(i))}function Br(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function jn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Br(i.slice(0,0))}function O(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Fr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}import Di,{decodeAddress as Si,encodeAddress as Yi}from"algosdk";var _=[],I=[],ri=typeof Uint8Array<"u"?Uint8Array:Array,tr=!1;function Sr(){tr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)_[r]=i[r],I[i.charCodeAt(r)]=r;I[45]=62,I[95]=63}function ni(i){tr||Sr();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new ri(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=I[i.charCodeAt(r)]<<18|I[i.charCodeAt(r+1)]<<12|I[i.charCodeAt(r+2)]<<6|I[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=I[i.charCodeAt(r)]<<2|I[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=I[i.charCodeAt(r)]<<10|I[i.charCodeAt(r+1)]<<4|I[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function ii(i){return _[i>>18&63]+_[i>>12&63]+_[i>>6&63]+_[i&63]}function ei(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(ii(e));return t.join("")}function vr(i){tr||Sr();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(ei(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=_[r>>2],t+=_[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=_[r>>10],t+=_[r>>4&63],t+=_[r<<2&63],t+="="),u.push(t),u.join("")}function X(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Yr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}var ti={}.toString,kr=Array.isArray||function(i){return ti.call(i)=="[object Array]"};var ui=50;h.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var bi=G();function G(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(i,r){if(G()<r)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=h.prototype):(i===null&&(i=new h(r)),i.length=r),i}function h(i,r,n){if(!h.TYPED_ARRAY_SUPPORT&&!(this instanceof h))return new h(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ur(this,i)}return Cr(this,i,r,n)}h.poolSize=8192;h._augment=function(i){return i.__proto__=h.prototype,i};function Cr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?hi(i,r,n,e):typeof r=="string"?fi(i,r,n):ai(i,r)}h.from=function(i,r,n){return Cr(null,i,r,n)};h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function Mr(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function oi(i,r,n,e){return Mr(r),r<=0?v(i,r):n!==void 0?typeof e=="string"?v(i,r).fill(n,e):v(i,r).fill(n):v(i,r)}h.alloc=function(i,r,n){return oi(null,i,r,n)};function ur(i,r){if(Mr(r),i=v(i,r<0?0:or(r)|0),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}h.allocUnsafe=function(i){return ur(null,i)};h.allocUnsafeSlow=function(i){return ur(null,i)};function fi(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!h.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=Nr(r,n)|0;i=v(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function er(i,r){var n=r.length<0?0:or(r.length)|0;i=v(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function hi(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),h.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=h.prototype):i=er(i,r),i}function ai(i,r){if(d(r)){var n=or(r.length)|0;return i=v(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Fi(r.length)?v(i,0):er(i,r);if(r.type==="Buffer"&&kr(r.data))return er(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function or(i){if(i>=G())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G().toString(16)+" bytes");return i|0}h.isBuffer=vi;function d(i){return!!(i!=null&&i._isBuffer)}h.compare=function(r,n){if(!d(r)||!d(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};h.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};h.concat=function(r,n){if(!kr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return h.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=h.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!d(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function Nr(i,r){if(d(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Hr(i).length;default:if(e)return J(i).length;r=(""+r).toLowerCase(),e=!0}}h.byteLength=Nr;function ci(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return mi(this,r,n);case"utf8":case"utf-8":return Wr(this,r,n);case"ascii":return Ai(this,r,n);case"latin1":case"binary":return gi(this,r,n);case"base64":return Ei(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ui(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}h.prototype._isBuffer=!0;function C(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}h.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)C(this,n,n+1);return this};h.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)C(this,n,n+3),C(this,n+1,n+2);return this};h.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)C(this,n,n+7),C(this,n+1,n+6),C(this,n+2,n+5),C(this,n+3,n+4);return this};h.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Wr(this,0,r):ci.apply(this,arguments)};h.prototype.equals=function(r){if(!d(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:h.compare(this,r)===0};h.prototype.inspect=function(){var r="",n=ui;return this.length>0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),"<Buffer "+r+">"};h.prototype.compare=function(r,n,e,t,u){if(!d(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function Lr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=h.from(r,e)),d(r))return r.length===0?-1:Pr(i,r,n,e,t);if(typeof r=="number")return r=r&255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):Pr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Pr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}h.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};h.prototype.indexOf=function(r,n,e){return Lr(this,r,n,e,!0)};h.prototype.lastIndexOf=function(r,n,e){return Lr(this,r,n,e,!1)};function si(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function pi(i,r,n,e){return Z(J(r,i.length-n),i,n,e)}function $r(i,r,n,e){return Z(di(r),i,n,e)}function li(i,r,n,e){return $r(i,r,n,e)}function xi(i,r,n,e){return Z(Hr(r),i,n,e)}function wi(i,r,n,e){return Z(Bi(r,i.length-n),i,n,e)}h.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return si(this,r,n,e);case"utf8":case"utf-8":return pi(this,r,n,e);case"ascii":return $r(this,r,n,e);case"latin1":case"binary":return li(this,r,n,e);case"base64":return xi(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wi(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ei(i,r,n){return r===0&&n===i.length?vr(i):vr(i.slice(r,n))}function Wr(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return yi(e)}var Dr=4096;function yi(i){var r=i.length;if(r<=Dr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=Dr));return n}function Ai(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function gi(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function mi(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=_i(i[u]);return t}function Ui(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}h.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(h.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=h.prototype;else{var u=n-r;t=new h(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function y(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};h.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};h.prototype.readUInt8=function(r,n){return n||y(r,1,this.length),this[r]};h.prototype.readUInt16LE=function(r,n){return n||y(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUInt16BE=function(r,n){return n||y(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUInt32LE=function(r,n){return n||y(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};h.prototype.readUInt32BE=function(r,n){return n||y(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};h.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};h.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};h.prototype.readInt8=function(r,n){return n||y(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,n){n||y(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};h.prototype.readInt16BE=function(r,n){n||y(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};h.prototype.readInt32LE=function(r,n){return n||y(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};h.prototype.readInt32BE=function(r,n){return n||y(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};h.prototype.readFloatLE=function(r,n){return n||y(r,4,this.length),X(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,n){return n||y(r,4,this.length),X(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,n){return n||y(r,8,this.length),X(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,n){return n||y(r,8,this.length),X(this,r,!1,52,8)};function g(i,r,n,e,t,u){if(!d(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};h.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};h.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,255,0),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function K(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}h.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};function Q(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}h.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):Q(this,r,n,!0),n+4};h.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};h.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,127,-128),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};h.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};h.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):Q(this,r,n,!0),n+4};h.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};function zr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function br(i,r,n,e,t){return t||zr(i,r,n,4),Yr(i,r,n,e,23,4),n+4}h.prototype.writeFloatLE=function(r,n,e){return br(this,r,n,!0,e)};h.prototype.writeFloatBE=function(r,n,e){return br(this,r,n,!1,e)};function Vr(i,r,n,e,t){return t||zr(i,r,n,8),Yr(i,r,n,e,52,8),n+8}h.prototype.writeDoubleLE=function(r,n,e){return Vr(this,r,n,!0,e)};h.prototype.writeDoubleBE=function(r,n,e){return Vr(this,r,n,!1,e)};h.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!h.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};h.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!h.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=d(r)?r:J(new h(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var Ii=/[^+\/0-9A-Za-z-_]/g;function Ri(i){if(i=Ti(i).replace(Ii,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Ti(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function _i(i){return i<16?"0"+i.toString(16):i.toString(16)}function J(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function di(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Bi(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function Hr(i){return ni(Ri(i))}function Z(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Fi(i){return i!==i}function vi(i){return i!=null&&(!!i._isBuffer||Or(i)||Pi(i))}function Or(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Pi(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Or(i.slice(0,0))}import{encodeAddress as he,decodeAddress as ae}from"algosdk";function Jr(i){return i.reduce((r,n)=>Uint8Array.from([...r,...n]))}function Xi(i,r){let n=[];for(let[e,t]of Object.entries(r)){let u=i[e];if(u===void 0)throw new Error(`Key ${e} missing from value`);switch(t.type){case"address":if(u instanceof Uint8Array&&u.length==32){n.push(u);break}else if(typeof u=="string")n.push(Si(u).publicKey);else throw new Error(`${e}: Expected address, got ${u}`);break;case"bytes":if(u instanceof Uint8Array)if(u.length==t.size){n.push(u);break}else throw new Error(`${e}: Bytes length is wrong, expected ${t.size}, got ${u.length}`);else throw new Error(`${e}: Expected bytes[${t.size}], got ${u}`);case"double":if(typeof u=="number"){let o=new ArrayBuffer(8);h.from(o).writeDoubleLE(u,0),n.push(new Uint8Array(o));break}else throw new Error(`${e}: Expected double, got ${u}`);case"number":case"uint":if(typeof u=="bigint"||typeof u=="number"){n.push(Kr(u));break}else throw new Error(`${e}: Expected uint or number, got ${u}`);case"string":if(typeof u=="string"){let o=Xr(u);if(o.length==t.size){n.push(o);break}else throw new Error(`${e}: Expected string length ${t.size}, got string length ${o.length}`)}else throw new Error(`${e}: Expected string length ${t.size}, got ${u}`)}}return Jr(n)}function Ki(i,r){let n=new Map,e=0;for(let[t,u]of Object.entries(r)){if(e>=i.length)throw new Error("Array index out of bounds");let o;switch(u.type){case"address":o=Yi(i.slice(e,e+32)),e+=32;break;case"bytes":o=i.slice(e,e+u.size),e+=u.size;break;case"double":o=h.from(i.slice(e,e+8)).readDoubleLE(0),e+=8;break;case"number":o=Number(Gr(i.slice(e,e+8))),e+=8;break;case"uint":o=Gr(i.slice(e,e+8)),e+=8;break;case"string":o=ki(i.slice(e,e+u.size)),e+=u.size;break}n.set(t,o)}return Object.fromEntries(n)}function Qi(i){return i.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Xr(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),Kr(r)))}function Xr(i){return new Uint8Array(h.from(i))}function ki(i){return h.from(i).toString("utf-8")}function Zi(i){let r=Di.encodeUint64(i);return Jr([new Uint8Array(32-r.length),r])}function Kr(i){let r=h.alloc(8);for(let n=0;n<8;n++)r[7-n]=Number(BigInt(i)>>BigInt(n*8)&BigInt(255));return new Uint8Array(r)}function Gr(i){let r=BigInt(0);for(let n=0;n<8&&i?.length;n++)r=r<<BigInt(8)|BigInt(i[n]);return r}function qi(i){return h.from(i).toString("base64")}function Ci(i){return h.from(i,"base64")}function ji(i,r){return i.length===r.length&&i.reduce((n,e,t)=>n&&e===r[t],!0)}function Qr(i,r){let n=i["global-state-delta"].find(e=>e.key===r);if(n!==void 0)return n.value}function re(i,r){let n=Qr(i,r);if(n!==void 0)return BigInt(n.uint)}function ne(i,r){let n=Qr(i,r);if(n!==void 0)return Ci(n.bytes)}function ie(i){return Math.floor(i.getTime()/1e3)}function ee(i){return new Date(i*1e3)}export{ji as compareArrays,Jr as concatArrays,ae as decodeAddress,Ci as decodeBase64,ki as decodeString,Gr as decodeUint64,Zi as encode32Bytes,he as encodeAddress,Qi as encodeArgArray,qi as encodeBase64,Xr as encodeString,Kr as encodeUint64,ee as fromUnix,ne as getDeltaBytes,re as getDeltaUint,Xi as packData,ie as toUnix,Ki as unpackData};
|
|
1
|
+
function hr(){throw new Error("setTimeout has not been defined")}function ar(){throw new Error("clearTimeout has not been defined")}var P=hr,D=ar;typeof globalThis.setTimeout=="function"&&(P=setTimeout);typeof globalThis.clearTimeout=="function"&&(D=clearTimeout);function cr(i){if(P===setTimeout)return setTimeout(i,0);if((P===hr||!P)&&setTimeout)return P=setTimeout,setTimeout(i,0);try{return P(i,0)}catch{try{return P.call(null,i,0)}catch{return P.call(this,i,0)}}}function Zr(i){if(D===clearTimeout)return clearTimeout(i);if((D===ar||!D)&&clearTimeout)return D=clearTimeout,clearTimeout(i);try{return D(i)}catch{try{return D.call(null,i)}catch{return D.call(this,i)}}}var B=[],N=!1,Y,L=-1;function qr(){!N||!Y||(N=!1,Y.length?B=Y.concat(B):L=-1,B.length&&sr())}function sr(){if(!N){var i=cr(qr);N=!0;for(var r=B.length;r;){for(Y=B,B=[];++L<r;)Y&&Y[L].run();L=-1,r=B.length}Y=null,N=!1,Zr(i)}}function jr(i){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];B.push(new pr(i,r)),B.length===1&&!N&&cr(sr)}function pr(i,r){this.fun=i,this.array=r}pr.prototype.run=function(){this.fun.apply(null,this.array)};var rn="browser",nn="browser",en=!0,tn={},un=[],on="",fn={},hn={},an={};function S(){}var cn=S,sn=S,pn=S,ln=S,xn=S,wn=S,En=S;function yn(i){throw new Error("process.binding is not supported")}function An(){return"/"}function gn(i){throw new Error("process.chdir is not supported")}function mn(){return 0}var M=globalThis.performance||{},Un=M.now||M.mozNow||M.msNow||M.oNow||M.webkitNow||function(){return new Date().getTime()};function In(i){var r=Un.call(M)*.001,n=Math.floor(r),e=Math.floor(r%1*1e9);return i&&(n=n-i[0],e=e-i[1],e<0&&(n--,e+=1e9)),[n,e]}var Rn=new Date;function Tn(){var i=new Date,r=i-Rn;return r/1e3}var $={nextTick:jr,title:rn,browser:en,env:tn,argv:un,version:on,versions:fn,on:cn,addListener:sn,once:pn,off:ln,removeListener:xn,removeAllListeners:wn,emit:En,binding:yn,cwd:An,chdir:gn,umask:mn,hrtime:In,platform:nn,release:hn,config:an,uptime:Tn},fr={};Object.keys(fr).forEach(i=>{let r=i.split("."),n=$;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=fr[i]:n=n[t]||(n[t]={})}});var R=[],U=[],_n=typeof Uint8Array<"u"?Uint8Array:Array,rr=!1;function Er(){rr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)R[r]=i[r],U[i.charCodeAt(r)]=r;U[45]=62,U[95]=63}function dn(i){rr||Er();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new _n(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=U[i.charCodeAt(r)]<<18|U[i.charCodeAt(r+1)]<<12|U[i.charCodeAt(r+2)]<<6|U[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=U[i.charCodeAt(r)]<<2|U[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=U[i.charCodeAt(r)]<<10|U[i.charCodeAt(r+1)]<<4|U[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function Bn(i){return R[i>>18&63]+R[i>>12&63]+R[i>>6&63]+R[i&63]}function Fn(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(Bn(e));return t.join("")}function lr(i){rr||Er();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(Fn(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=R[r>>2],t+=R[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=R[r>>10],t+=R[r>>4&63],t+=R[r<<2&63],t+="="),u.push(t),u.join("")}a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function W(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function F(i,r){if(W()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=a.prototype):(i===null&&(i=new a(r)),i.length=r),i}function a(i,r,n){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return nr(this,i)}return yr(this,i,r,n)}a.poolSize=8192;a._augment=function(i){return i.__proto__=a.prototype,i};function yr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Dn(i,r,n,e):typeof r=="string"?Pn(i,r,n):Yn(i,r)}a.from=function(i,r,n){return yr(null,i,r,n)};a.kMaxLength=W();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&a[Symbol.species]);function Ar(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function vn(i,r,n,e){return Ar(r),r<=0?F(i,r):n!==void 0?typeof e=="string"?F(i,r).fill(n,e):F(i,r).fill(n):F(i,r)}a.alloc=function(i,r,n){return vn(null,i,r,n)};function nr(i,r){if(Ar(r),i=F(i,r<0?0:ir(r)|0),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}a.allocUnsafe=function(i){return nr(null,i)};a.allocUnsafeSlow=function(i){return nr(null,i)};function Pn(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=gr(r,n)|0;i=F(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function j(i,r){var n=r.length<0?0:ir(r.length)|0;i=F(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function Dn(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),a.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=a.prototype):i=j(i,r),i}function Yn(i,r){if(T(r)){var n=ir(r.length)|0;return i=F(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Zn(r.length)?F(i,0):j(i,r);if(r.type==="Buffer"&&Array.isArray(r.data))return j(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ir(i){if(i>=W())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W().toString(16)+" bytes");return i|0}a.isBuffer=qn;function T(i){return!!(i!=null&&i._isBuffer)}a.compare=function(r,n){if(!T(r)||!T(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};a.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=a.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!T(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function gr(i,r){if(T(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return dr(i).length;default:if(e)return z(i).length;r=(""+r).toLowerCase(),e=!0}}a.byteLength=gr;function Sn(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return Vn(this,r,n);case"utf8":case"utf-8":return Ir(this,r,n);case"ascii":return zn(this,r,n);case"latin1":case"binary":return bn(this,r,n);case"base64":return $n(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hn(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}a.prototype._isBuffer=!0;function k(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}a.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)k(this,n,n+1);return this};a.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)k(this,n,n+3),k(this,n+1,n+2);return this};a.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)k(this,n,n+7),k(this,n+1,n+6),k(this,n+2,n+5),k(this,n+3,n+4);return this};a.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ir(this,0,r):Sn.apply(this,arguments)};a.prototype.equals=function(r){if(!T(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0};a.prototype.compare=function(r,n,e,t,u){if(!T(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function mr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=a.from(r,e)),T(r))return r.length===0?-1:xr(i,r,n,e,t);if(typeof r=="number")return r=r&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):xr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function xr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}a.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};a.prototype.indexOf=function(r,n,e){return mr(this,r,n,e,!0)};a.prototype.lastIndexOf=function(r,n,e){return mr(this,r,n,e,!1)};function kn(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function Cn(i,r,n,e){return H(z(r,i.length-n),i,n,e)}function Ur(i,r,n,e){return H(Kn(r),i,n,e)}function Mn(i,r,n,e){return Ur(i,r,n,e)}function Nn(i,r,n,e){return H(dr(r),i,n,e)}function Ln(i,r,n,e){return H(Qn(r,i.length-n),i,n,e)}a.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return kn(this,r,n,e);case"utf8":case"utf-8":return Cn(this,r,n,e);case"ascii":return Ur(this,r,n,e);case"latin1":case"binary":return Mn(this,r,n,e);case"base64":return Nn(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ln(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $n(i,r,n){return r===0&&n===i.length?lr(i):lr(i.slice(r,n))}function Ir(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return Wn(e)}var wr=4096;function Wn(i){var r=i.length;if(r<=wr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=wr));return n}function zn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function bn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function Vn(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=Xn(i[u]);return t}function Hn(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}a.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(a.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=a.prototype;else{var u=n-r;t=new a(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function E(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};a.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};a.prototype.readUInt8=function(r,n){return n||E(r,1,this.length),this[r]};a.prototype.readUInt16LE=function(r,n){return n||E(r,2,this.length),this[r]|this[r+1]<<8};a.prototype.readUInt16BE=function(r,n){return n||E(r,2,this.length),this[r]<<8|this[r+1]};a.prototype.readUInt32LE=function(r,n){return n||E(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};a.prototype.readUInt32BE=function(r,n){return n||E(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};a.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};a.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||E(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};a.prototype.readInt8=function(r,n){return n||E(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};a.prototype.readInt16LE=function(r,n){n||E(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};a.prototype.readInt16BE=function(r,n){n||E(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};a.prototype.readInt32LE=function(r,n){return n||E(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};a.prototype.readInt32BE=function(r,n){return n||E(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};a.prototype.readFloatLE=function(r,n){return n||E(r,4,this.length),O(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,n){return n||E(r,4,this.length),O(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,n){return n||E(r,8,this.length),O(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,n){return n||E(r,8,this.length),O(this,r,!1,52,8)};function A(i,r,n,e,t,u){if(!T(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};a.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;A(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};a.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,255,0),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function b(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}a.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};function V(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}a.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):V(this,r,n,!0),n+4};a.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};a.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);A(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};a.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,1,127,-128),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};a.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):b(this,r,n,!0),n+2};a.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):b(this,r,n,!1),n+2};a.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):V(this,r,n,!0),n+4};a.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||A(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),a.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):V(this,r,n,!1),n+4};function Rr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Tr(i,r,n,e,t){return t||Rr(i,r,n,4,34028234663852886e22,-34028234663852886e22),Fr(i,r,n,e,23,4),n+4}a.prototype.writeFloatLE=function(r,n,e){return Tr(this,r,n,!0,e)};a.prototype.writeFloatBE=function(r,n,e){return Tr(this,r,n,!1,e)};function _r(i,r,n,e,t){return t||Rr(i,r,n,8,17976931348623157e292,-17976931348623157e292),Fr(i,r,n,e,52,8),n+8}a.prototype.writeDoubleLE=function(r,n,e){return _r(this,r,n,!0,e)};a.prototype.writeDoubleBE=function(r,n,e){return _r(this,r,n,!1,e)};a.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};a.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=T(r)?r:z(new a(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var On=/[^+\/0-9A-Za-z-_]/g;function Gn(i){if(i=Jn(i).replace(On,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Jn(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function Xn(i){return i<16?"0"+i.toString(16):i.toString(16)}function z(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function Kn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Qn(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function dr(i){return dn(Gn(i))}function H(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Zn(i){return i!==i}function qn(i){return i!=null&&(!!i._isBuffer||Br(i)||jn(i))}function Br(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function jn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Br(i.slice(0,0))}function O(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Fr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}import Di,{decodeAddress as Yi,encodeAddress as Si}from"algosdk";var _=[],I=[],ri=typeof Uint8Array<"u"?Uint8Array:Array,tr=!1;function Yr(){tr=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)_[r]=i[r],I[i.charCodeAt(r)]=r;I[45]=62,I[95]=63}function ni(i){tr||Yr();var r,n,e,t,u,o,f=i.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u=i[f-2]==="="?2:i[f-1]==="="?1:0,o=new ri(f*3/4-u),e=u>0?f-4:f;var c=0;for(r=0,n=0;r<e;r+=4,n+=3)t=I[i.charCodeAt(r)]<<18|I[i.charCodeAt(r+1)]<<12|I[i.charCodeAt(r+2)]<<6|I[i.charCodeAt(r+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return u===2?(t=I[i.charCodeAt(r)]<<2|I[i.charCodeAt(r+1)]>>4,o[c++]=t&255):u===1&&(t=I[i.charCodeAt(r)]<<10|I[i.charCodeAt(r+1)]<<4|I[i.charCodeAt(r+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function ii(i){return _[i>>18&63]+_[i>>12&63]+_[i>>6&63]+_[i&63]}function ei(i,r,n){for(var e,t=[],u=r;u<n;u+=3)e=(i[u]<<16)+(i[u+1]<<8)+i[u+2],t.push(ii(e));return t.join("")}function vr(i){tr||Yr();for(var r,n=i.length,e=n%3,t="",u=[],o=16383,f=0,c=n-e;f<c;f+=o)u.push(ei(i,f,f+o>c?c:f+o));return e===1?(r=i[n-1],t+=_[r>>2],t+=_[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=_[r>>10],t+=_[r>>4&63],t+=_[r<<2&63],t+="="),u.push(t),u.join("")}function X(i,r,n,e,t){var u,o,f=t*8-e-1,c=(1<<f)-1,p=c>>1,l=-7,s=n?t-1:0,w=n?-1:1,x=i[r+s];for(s+=w,u=x&(1<<-l)-1,x>>=-l,l+=f;l>0;u=u*256+i[r+s],s+=w,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=e;l>0;o=o*256+i[r+s],s+=w,l-=8);if(u===0)u=1-p;else{if(u===c)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,e),u=u-p}return(x?-1:1)*o*Math.pow(2,u-e)}function Sr(i,r,n,e,t,u){var o,f,c,p=u*8-t-1,l=(1<<p)-1,s=l>>1,w=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:u-1,m=e?1:-1,q=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,o=l):(o=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?r+=w/c:r+=w*Math.pow(2,1-s),r*c>=2&&(o++,c/=2),o+s>=l?(f=0,o=l):o+s>=1?(f=(r*c-1)*Math.pow(2,t),o=o+s):(f=r*Math.pow(2,s-1)*Math.pow(2,t),o=0));t>=8;i[n+x]=f&255,x+=m,f/=256,t-=8);for(o=o<<t|f,p+=t;p>0;i[n+x]=o&255,x+=m,o/=256,p-=8);i[n+x-m]|=q*128}var ti={}.toString,kr=Array.isArray||function(i){return ti.call(i)=="[object Array]"};var ui=50;h.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var bi=G();function G(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(i,r){if(G()<r)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=h.prototype):(i===null&&(i=new h(r)),i.length=r),i}function h(i,r,n){if(!h.TYPED_ARRAY_SUPPORT&&!(this instanceof h))return new h(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ur(this,i)}return Cr(this,i,r,n)}h.poolSize=8192;h._augment=function(i){return i.__proto__=h.prototype,i};function Cr(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?hi(i,r,n,e):typeof r=="string"?fi(i,r,n):ai(i,r)}h.from=function(i,r,n){return Cr(null,i,r,n)};h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function Mr(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function oi(i,r,n,e){return Mr(r),r<=0?v(i,r):n!==void 0?typeof e=="string"?v(i,r).fill(n,e):v(i,r).fill(n):v(i,r)}h.alloc=function(i,r,n){return oi(null,i,r,n)};function ur(i,r){if(Mr(r),i=v(i,r<0?0:or(r)|0),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}h.allocUnsafe=function(i){return ur(null,i)};h.allocUnsafeSlow=function(i){return ur(null,i)};function fi(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!h.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=Nr(r,n)|0;i=v(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function er(i,r){var n=r.length<0?0:or(r.length)|0;i=v(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function hi(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),h.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=h.prototype):i=er(i,r),i}function ai(i,r){if(d(r)){var n=or(r.length)|0;return i=v(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Fi(r.length)?v(i,0):er(i,r);if(r.type==="Buffer"&&kr(r.data))return er(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function or(i){if(i>=G())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G().toString(16)+" bytes");return i|0}h.isBuffer=vi;function d(i){return!!(i!=null&&i._isBuffer)}h.compare=function(r,n){if(!d(r)||!d(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,u=0,o=Math.min(e,t);u<o;++u)if(r[u]!==n[u]){e=r[u],t=n[u];break}return e<t?-1:t<e?1:0};h.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};h.concat=function(r,n){if(!kr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return h.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=h.allocUnsafe(n),u=0;for(e=0;e<r.length;++e){var o=r[e];if(!d(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(t,u),u+=o.length}return t};function Nr(i,r){if(d(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Hr(i).length;default:if(e)return J(i).length;r=(""+r).toLowerCase(),e=!0}}h.byteLength=Nr;function ci(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return mi(this,r,n);case"utf8":case"utf-8":return Wr(this,r,n);case"ascii":return Ai(this,r,n);case"latin1":case"binary":return gi(this,r,n);case"base64":return Ei(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ui(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}h.prototype._isBuffer=!0;function C(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}h.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<r;n+=2)C(this,n,n+1);return this};h.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<r;n+=4)C(this,n,n+3),C(this,n+1,n+2);return this};h.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<r;n+=8)C(this,n,n+7),C(this,n+1,n+6),C(this,n+2,n+5),C(this,n+3,n+4);return this};h.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Wr(this,0,r):ci.apply(this,arguments)};h.prototype.equals=function(r){if(!d(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:h.compare(this,r)===0};h.prototype.inspect=function(){var r="",n=ui;return this.length>0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),"<Buffer "+r+">"};h.prototype.compare=function(r,n,e,t,u){if(!d(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),u===void 0&&(u=this.length),n<0||e>r.length||t<0||u>this.length)throw new RangeError("out of range index");if(t>=u&&n>=e)return 0;if(t>=u)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,u>>>=0,this===r)return 0;for(var o=u-t,f=e-n,c=Math.min(o,f),p=this.slice(t,u),l=r.slice(n,e),s=0;s<c;++s)if(p[s]!==l[s]){o=p[s],f=l[s];break}return o<f?-1:f<o?1:0};function Lr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=h.from(r,e)),d(r))return r.length===0?-1:Pr(i,r,n,e,t);if(typeof r=="number")return r=r&255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):Pr(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Pr(i,r,n,e,t){var u=1,o=i.length,f=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;u=2,o/=2,f/=2,n/=2}function c(x,m){return u===1?x[m]:x.readUInt16BE(m*u)}var p;if(t){var l=-1;for(p=n;p<o;p++)if(c(i,p)===c(r,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===f)return l*u}else l!==-1&&(p-=p-l),l=-1}else for(n+f>o&&(n=o-f),p=n;p>=0;p--){for(var s=!0,w=0;w<f;w++)if(c(i,p+w)!==c(r,w)){s=!1;break}if(s)return p}return-1}h.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};h.prototype.indexOf=function(r,n,e){return Lr(this,r,n,e,!0)};h.prototype.lastIndexOf=function(r,n,e){return Lr(this,r,n,e,!1)};function si(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var u=r.length;if(u%2!==0)throw new TypeError("Invalid hex string");e>u/2&&(e=u/2);for(var o=0;o<e;++o){var f=parseInt(r.substr(o*2,2),16);if(isNaN(f))return o;i[n+o]=f}return o}function pi(i,r,n,e){return Z(J(r,i.length-n),i,n,e)}function $r(i,r,n,e){return Z(di(r),i,n,e)}function li(i,r,n,e){return $r(i,r,n,e)}function xi(i,r,n,e){return Z(Hr(r),i,n,e)}function wi(i,r,n,e){return Z(Bi(r,i.length-n),i,n,e)}h.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((e===void 0||e>u)&&(e=u),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var o=!1;;)switch(t){case"hex":return si(this,r,n,e);case"utf8":case"utf-8":return pi(this,r,n,e);case"ascii":return $r(this,r,n,e);case"latin1":case"binary":return li(this,r,n,e);case"base64":return xi(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wi(this,r,n,e);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),o=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ei(i,r,n){return r===0&&n===i.length?vr(i):vr(i.slice(r,n))}function Wr(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var u=i[t],o=null,f=u>239?4:u>223?3:u>191?2:1;if(t+f<=n){var c,p,l,s;switch(f){case 1:u<128&&(o=u);break;case 2:c=i[t+1],(c&192)===128&&(s=(u&31)<<6|c&63,s>127&&(o=s));break;case 3:c=i[t+1],p=i[t+2],(c&192)===128&&(p&192)===128&&(s=(u&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=i[t+1],p=i[t+2],l=i[t+3],(c&192)===128&&(p&192)===128&&(l&192)===128&&(s=(u&15)<<18|(c&63)<<12|(p&63)<<6|l&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,e.push(o>>>10&1023|55296),o=56320|o&1023),e.push(o),t+=f}return yi(e)}var Dr=4096;function yi(i){var r=i.length;if(r<=Dr)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=Dr));return n}function Ai(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function gi(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function mi(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",u=r;u<n;++u)t+=_i(i[u]);return t}function Ui(i,r,n){for(var e=i.slice(r,n),t="",u=0;u<e.length;u+=2)t+=String.fromCharCode(e[u]+e[u+1]*256);return t}h.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(h.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=h.prototype;else{var u=n-r;t=new h(u,void 0);for(var o=0;o<u;++o)t[o]=this[o+r]}return t};function y(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return t};h.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r+--n],u=1;n>0&&(u*=256);)t+=this[r+--n]*u;return t};h.prototype.readUInt8=function(r,n){return n||y(r,1,this.length),this[r]};h.prototype.readUInt16LE=function(r,n){return n||y(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUInt16BE=function(r,n){return n||y(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUInt32LE=function(r,n){return n||y(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};h.prototype.readUInt32BE=function(r,n){return n||y(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};h.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=this[r],u=1,o=0;++o<n&&(u*=256);)t+=this[r+o]*u;return u*=128,t>=u&&(t-=Math.pow(2,8*n)),t};h.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||y(r,n,this.length);for(var t=n,u=1,o=this[r+--t];t>0&&(u*=256);)o+=this[r+--t]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*n)),o};h.prototype.readInt8=function(r,n){return n||y(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,n){n||y(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};h.prototype.readInt16BE=function(r,n){n||y(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};h.prototype.readInt32LE=function(r,n){return n||y(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};h.prototype.readInt32BE=function(r,n){return n||y(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};h.prototype.readFloatLE=function(r,n){return n||y(r,4,this.length),X(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,n){return n||y(r,4,this.length),X(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,n){return n||y(r,8,this.length),X(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,n){return n||y(r,8,this.length),X(this,r,!1,52,8)};function g(i,r,n,e,t,u){if(!d(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=1,f=0;for(this[n]=r&255;++f<e&&(o*=256);)this[n+f]=r/o&255;return n+e};h.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var u=Math.pow(2,8*e)-1;g(this,r,n,e,u,0)}var o=e-1,f=1;for(this[n+o]=r&255;--o>=0&&(f*=256);)this[n+o]=r/f&255;return n+e};h.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,255,0),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function K(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,u=Math.min(i.length-n,2);t<u;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}h.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};function Q(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,u=Math.min(i.length-n,4);t<u;++t)i[n+t]=r>>>(e?t:3-t)*8&255}h.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):Q(this,r,n,!0),n+4};h.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};h.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=0,f=1,c=0;for(this[n]=r&255;++o<e&&(f*=256);)r<0&&c===0&&this[n+o-1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var u=Math.pow(2,8*e-1);g(this,r,n,e,u-1,-u)}var o=e-1,f=1,c=0;for(this[n+o]=r&255;--o>=0&&(f*=256);)r<0&&c===0&&this[n+o+1]!==0&&(c=1),this[n+o]=(r/f>>0)-c&255;return n+e};h.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,1,127,-128),h.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};h.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):K(this,r,n,!0),n+2};h.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):K(this,r,n,!1),n+2};h.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):Q(this,r,n,!0),n+4};h.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||g(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),h.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):Q(this,r,n,!1),n+4};function zr(i,r,n,e,t,u){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function br(i,r,n,e,t){return t||zr(i,r,n,4),Sr(i,r,n,e,23,4),n+4}h.prototype.writeFloatLE=function(r,n,e){return br(this,r,n,!0,e)};h.prototype.writeFloatBE=function(r,n,e){return br(this,r,n,!1,e)};function Vr(i,r,n,e,t){return t||zr(i,r,n,8),Sr(i,r,n,e,52,8),n+8}h.prototype.writeDoubleLE=function(r,n,e){return Vr(this,r,n,!0,e)};h.prototype.writeDoubleBE=function(r,n,e){return Vr(this,r,n,!1,e)};h.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var u=t-e,o;if(this===r&&e<n&&n<t)for(o=u-1;o>=0;--o)r[o+n]=this[o+e];else if(u<1e3||!h.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)r[o+n]=this[o+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+u),n);return u};h.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var u=r.charCodeAt(0);u<256&&(r=u)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!h.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var o;if(typeof r=="number")for(o=n;o<e;++o)this[o]=r;else{var f=d(r)?r:J(new h(r,t).toString()),c=f.length;for(o=0;o<e-n;++o)this[o+n]=f[o%c]}return this};var Ii=/[^+\/0-9A-Za-z-_]/g;function Ri(i){if(i=Ti(i).replace(Ii,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function Ti(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function _i(i){return i<16?"0"+i.toString(16):i.toString(16)}function J(i,r){r=r||1/0;for(var n,e=i.length,t=null,u=[],o=0;o<e;++o){if(n=i.charCodeAt(o),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(o+1===e){(r-=3)>-1&&u.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&u.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&u.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;u.push(n)}else if(n<2048){if((r-=2)<0)break;u.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;u.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;u.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return u}function di(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function Bi(i,r){for(var n,e,t,u=[],o=0;o<i.length&&!((r-=2)<0);++o)n=i.charCodeAt(o),e=n>>8,t=n%256,u.push(t),u.push(e);return u}function Hr(i){return ni(Ri(i))}function Z(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function Fi(i){return i!==i}function vi(i){return i!=null&&(!!i._isBuffer||Or(i)||Pi(i))}function Or(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Pi(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Or(i.slice(0,0))}import{encodeAddress as ae,decodeAddress as ce}from"algosdk";function Jr(i){return i.reduce((r,n)=>Uint8Array.from([...r,...n]))}function Xi(i,r){let n=[];for(let[e,t]of Object.entries(r)){let u=i[e];if(u===void 0)throw new Error(`Key ${e} missing from value`);switch(t.type){case"address":if(u instanceof Uint8Array&&u.length==32){n.push(u);break}else if(typeof u=="string")n.push(Yi(u).publicKey);else throw new Error(`${e}: Expected address, got ${u}`);break;case"bytes":if(u instanceof Uint8Array)if(u.length==t.size){n.push(u);break}else throw new Error(`${e}: Bytes length is wrong, expected ${t.size}, got ${u.length}`);else throw new Error(`${e}: Expected bytes[${t.size}], got ${u}`);case"double":if(typeof u=="number"){let o=new ArrayBuffer(8);h.from(o).writeDoubleLE(u,0),n.push(new Uint8Array(o));break}else throw new Error(`${e}: Expected double, got ${u}`);case"number":case"uint":if(typeof u=="bigint"||typeof u=="number"){n.push(Kr(u));break}else throw new Error(`${e}: Expected uint or number, got ${u}`);case"string":if(typeof u=="string"){let o=Xr(u);if(o.length==t.size){n.push(o);break}else throw new Error(`${e}: Expected string length ${t.size}, got string length ${o.length}`)}else throw new Error(`${e}: Expected string length ${t.size}, got ${u}`)}}return Jr(n)}function Ki(i,r){let n=new Map,e=0;for(let[t,u]of Object.entries(r)){if(e>=i.length)throw new Error("Array index out of bounds");let o;switch(u.type){case"address":o=Si(i.slice(e,e+32)),e+=32;break;case"bytes":o=i.slice(e,e+u.size),e+=u.size;break;case"double":o=h.from(i.slice(e,e+8)).readDoubleLE(0),e+=8;break;case"number":o=Number(Gr(i.slice(e,e+8))),e+=8;break;case"uint":o=Gr(i.slice(e,e+8)),e+=8;break;case"string":o=ki(i.slice(e,e+u.size)),e+=u.size;break}n.set(t,o)}return Object.fromEntries(n)}function Qi(i){return i.map(r=>r instanceof Uint8Array?new Uint8Array(r):typeof r=="string"?Xr(r):(typeof r=="boolean"&&(r=BigInt(r?1:0)),typeof r=="number"&&(r=BigInt(r)),Kr(r)))}function Xr(i){return new Uint8Array(h.from(i))}function ki(i){return h.from(i).toString("utf-8")}function Zi(i){let r=Di.encodeUint64(i);return Jr([new Uint8Array(32-r.length),r])}function Kr(i){let r=h.alloc(8);for(let n=0;n<8;n++)r[7-n]=Number(BigInt(i)>>BigInt(n*8)&BigInt(255));return new Uint8Array(r)}function Gr(i){let r=BigInt(0);for(let n=0;n<8&&i?.length;n++)r=r<<BigInt(8)|BigInt(i[n]);return r}function qi(i){return h.from(i).toString("base64")}function Ci(i){return h.from(i,"base64")}var ji=i=>{let r=i.startsWith("0x")?i.slice(2):i;if(r.length%2!==0)throw new Error("Invalid hex string");let n=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)n[e/2]=parseInt(r.substring(e,e+2),16);return n};function re(i,r){return i.length===r.length&&i.reduce((n,e,t)=>n&&e===r[t],!0)}function Qr(i,r){let n=i["global-state-delta"].find(e=>e.key===r);if(n!==void 0)return n.value}function ne(i,r){let n=Qr(i,r);if(n!==void 0)return BigInt(n.uint)}function ie(i,r){let n=Qr(i,r);if(n!==void 0)return Ci(n.bytes)}function ee(i){return Math.floor(i.getTime()/1e3)}function te(i){return new Date(i*1e3)}export{re as compareArrays,Jr as concatArrays,ce as decodeAddress,Ci as decodeBase64,ki as decodeString,Gr as decodeUint64,Zi as encode32Bytes,ae as encodeAddress,Qi as encodeArgArray,qi as encodeBase64,Xr as encodeString,Kr as encodeUint64,te as fromUnix,ie as getDeltaBytes,ne as getDeltaUint,ji as hexToUint8Array,Xi as packData,ee as toUnix,Ki as unpackData};
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|