UNPKG

@sofaws/dapp-core

Version:

A library to hold the main logic for a dapp on the Elrond Network

130 lines (122 loc) 33 kB
"use strict";var Cr=Object.create;var Y=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var Lr=Object.getOwnPropertyNames;var br=Object.getPrototypeOf,kr=Object.prototype.hasOwnProperty;var Mr=(e,r)=>()=>(e&&(r=e(e=0)),r);var q=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Rr=(e,r)=>{for(var t in r)Y(e,t,{get:r[t],enumerable:!0})},nr=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Lr(r))!kr.call(e,i)&&i!==t&&Y(e,i,{get:()=>r[i],enumerable:!(n=Sr(r,i))||n.enumerable});return e};var W=(e,r,t)=>(t=e!=null?Cr(br(e)):{},nr(r||!e||!e.__esModule?Y(t,"default",{value:e,enumerable:!0}):t,e)),Nr=e=>nr(Y({},"__esModule",{value:!0}),e);var pr=q(X=>{"use strict";y();X.byteLength=zr;X.toByteArray=Yr;X.fromByteArray=Hr;var g=[],d=[],Dr=typeof Uint8Array!="undefined"?Uint8Array:Array,J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(I=0,ir=J.length;I<ir;++I)g[I]=J[I],d[J.charCodeAt(I)]=I;var I,ir;d["-".charCodeAt(0)]=62;d["_".charCodeAt(0)]=63;function or(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function zr(e){var r=or(e),t=r[0],n=r[1];return(t+n)*3/4-n}function Wr(e,r,t){return(r+t)*3/4-t}function Yr(e){var r,t=or(e),n=t[0],i=t[1],o=new Dr(Wr(e,n,i)),p=0,s=i>0?n-4:n,u;for(u=0;u<s;u+=4)r=d[e.charCodeAt(u)]<<18|d[e.charCodeAt(u+1)]<<12|d[e.charCodeAt(u+2)]<<6|d[e.charCodeAt(u+3)],o[p++]=r>>16&255,o[p++]=r>>8&255,o[p++]=r&255;return i===2&&(r=d[e.charCodeAt(u)]<<2|d[e.charCodeAt(u+1)]>>4,o[p++]=r&255),i===1&&(r=d[e.charCodeAt(u)]<<10|d[e.charCodeAt(u+1)]<<4|d[e.charCodeAt(u+2)]>>2,o[p++]=r>>8&255,o[p++]=r&255),o}function qr(e){return g[e>>18&63]+g[e>>12&63]+g[e>>6&63]+g[e&63]}function Xr(e,r,t){for(var n,i=[],o=r;o<t;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(qr(n));return i.join("")}function Hr(e){for(var r,t=e.length,n=t%3,i=[],o=16383,p=0,s=t-n;p<s;p+=o)i.push(Xr(e,p,p+o>s?s:p+o));return n===1?(r=e[t-1],i.push(g[r>>2]+g[r<<4&63]+"==")):n===2&&(r=(e[t-2]<<8)+e[t-1],i.push(g[r>>10]+g[r>>4&63]+g[r<<2&63]+"=")),i.join("")}});var ar=q(Q=>{y();Q.read=function(e,r,t,n,i){var o,p,s=i*8-n-1,u=(1<<s)-1,f=u>>1,h=-7,c=t?i-1:0,E=t?-1:1,x=e[r+c];for(c+=E,o=x&(1<<-h)-1,x>>=-h,h+=s;h>0;o=o*256+e[r+c],c+=E,h-=8);for(p=o&(1<<-h)-1,o>>=-h,h+=n;h>0;p=p*256+e[r+c],c+=E,h-=8);if(o===0)o=1-f;else{if(o===u)return p?NaN:(x?-1:1)*(1/0);p=p+Math.pow(2,n),o=o-f}return(x?-1:1)*p*Math.pow(2,o-n)};Q.write=function(e,r,t,n,i,o){var p,s,u,f=o*8-i-1,h=(1<<f)-1,c=h>>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,M=n?1:-1,Ir=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,p=h):(p=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-p))<1&&(p--,u*=2),p+c>=1?r+=E/u:r+=E*Math.pow(2,1-c),r*u>=2&&(p++,u/=2),p+c>=h?(s=0,p=h):p+c>=1?(s=(r*u-1)*Math.pow(2,i),p=p+c):(s=r*Math.pow(2,c-1)*Math.pow(2,i),p=0));i>=8;e[t+x]=s&255,x+=M,s/=256,i-=8);for(p=p<<i|s,f+=i;f>0;e[t+x]=p&255,x+=M,p/=256,f-=8);e[t+x-M]|=Ir*128}});var Er=q(D=>{"use strict";y();var V=pr(),N=ar(),sr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;D.Buffer=a;D.SlowBuffer=Kr;D.INSPECT_MAX_BYTES=50;var H=2147483647;D.kMaxLength=H;a.TYPED_ARRAY_SUPPORT=Gr();!a.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Gr(){try{var e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch(t){return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(!!a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(!!a.isBuffer(this))return this.byteOffset}});function A(e){if(e>H)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return Object.setPrototypeOf(r,a.prototype),r}function a(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return P(e)}return hr(e,r,t)}a.poolSize=8192;function hr(e,r,t){if(typeof e=="string")return Jr(e,r);if(ArrayBuffer.isView(e))return Qr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return Z(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return a.from(n,r,t);var i=Vr(e);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,r,t){return hr(e,r,t)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function fr(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Or(e,r,t){return fr(e),e<=0?A(e):r!==void 0?typeof t=="string"?A(e).fill(r,t):A(e).fill(r):A(e)}a.alloc=function(e,r,t){return Or(e,r,t)};function P(e){return fr(e),A(e<0?0:j(e)|0)}a.allocUnsafe=function(e){return P(e)};a.allocUnsafeSlow=function(e){return P(e)};function Jr(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var t=lr(e,r)|0,n=A(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function K(e){for(var r=e.length<0?0:j(e.length)|0,t=A(r),n=0;n<r;n+=1)t[n]=e[n]&255;return t}function Qr(e){if(F(e,Uint8Array)){var r=new Uint8Array(e);return Z(r.buffer,r.byteOffset,r.byteLength)}return K(e)}function Z(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');var n;return r===void 0&&t===void 0?n=new Uint8Array(e):t===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,t),Object.setPrototypeOf(n,a.prototype),n}function Vr(e){if(a.isBuffer(e)){var r=j(e.length)|0,t=A(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||rr(e.length)?A(0):K(e);if(e.type==="Buffer"&&Array.isArray(e.data))return K(e.data)}function j(e){if(e>=H)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H.toString(16)+" bytes");return e|0}function Kr(e){return+e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==a.prototype};a.compare=function(r,t){if(F(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(r)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;for(var n=r.length,i=t.length,o=0,p=Math.min(n,i);o<p;++o)if(r[o]!==t[o]){n=r[o],i=t[o];break}return n<i?-1:i<n?1:0};a.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;var i=a.allocUnsafe(t),o=0;for(n=0;n<r.length;++n){var p=r[n];if(F(p,Uint8Array))o+p.length>i.length?a.from(p).copy(i,o):Uint8Array.prototype.set.call(i,p,o);else if(a.isBuffer(p))p.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=p.length}return i};function lr(e,r){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return dr(e).length;default:if(i)return n?-1:$(e).length;r=(""+r).toLowerCase(),i=!0}}a.byteLength=lr;function Zr(e,r,t){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return pt(this,r,t);case"utf8":case"utf-8":return _r(this,r,t);case"ascii":return it(this,r,t);case"latin1":case"binary":return ot(this,r,t);case"base64":return et(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}a.prototype._isBuffer=!0;function L(e,r,t){var n=e[r];e[r]=e[t],e[t]=n}a.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<r;t+=2)L(this,t,t+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 t=0;t<r;t+=4)L(this,t,t+3),L(this,t+1,t+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 t=0;t<r;t+=8)L(this,t,t+7),L(this,t+1,t+6),L(this,t+2,t+5),L(this,t+3,t+4);return this};a.prototype.toString=function(){var r=this.length;return r===0?"":arguments.length===0?_r(this,0,r):Zr.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(r){if(!a.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0};a.prototype.inspect=function(){var r="",t=D.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"};sr&&(a.prototype[sr]=a.prototype.inspect);a.prototype.compare=function(r,t,n,i,o){if(F(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var p=o-i,s=n-t,u=Math.min(p,s),f=this.slice(i,o),h=r.slice(t,n),c=0;c<u;++c)if(f[c]!==h[c]){p=f[c],s=h[c];break}return p<s?-1:s<p?1:0};function mr(e,r,t,n,i){if(e.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,rr(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return-1;t=e.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof r=="string"&&(r=a.from(r,n)),a.isBuffer(r))return r.length===0?-1:ur(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):ur(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function ur(e,r,t,n,i){var o=1,p=e.length,s=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,p/=2,s/=2,t/=2}function u(x,M){return o===1?x[M]:x.readUInt16BE(M*o)}var f;if(i){var h=-1;for(f=t;f<p;f++)if(u(e,f)===u(r,h===-1?0:f-h)){if(h===-1&&(h=f),f-h+1===s)return h*o}else h!==-1&&(f-=f-h),h=-1}else for(t+s>p&&(t=p-s),f=t;f>=0;f--){for(var c=!0,E=0;E<s;E++)if(u(e,f+E)!==u(r,E)){c=!1;break}if(c)return f}return-1}a.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1};a.prototype.indexOf=function(r,t,n){return mr(this,r,t,n,!0)};a.prototype.lastIndexOf=function(r,t,n){return mr(this,r,t,n,!1)};function $r(e,r,t,n){t=Number(t)||0;var i=e.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;var o=r.length;n>o/2&&(n=o/2);for(var p=0;p<n;++p){var s=parseInt(r.substr(p*2,2),16);if(rr(s))return p;e[t+p]=s}return p}function Pr(e,r,t,n){return G($(r,e.length-t),e,t,n)}function jr(e,r,t,n){return G(ct(r),e,t,n)}function rt(e,r,t,n){return G(dr(r),e,t,n)}function tt(e,r,t,n){return G(ht(r,e.length-t),e,t,n)}a.prototype.write=function(r,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>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-t;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var p=!1;;)switch(i){case"hex":return $r(this,r,t,n);case"utf8":case"utf-8":return Pr(this,r,t,n);case"ascii":case"latin1":case"binary":return jr(this,r,t,n);case"base64":return rt(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tt(this,r,t,n);default:if(p)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),p=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function et(e,r,t){return r===0&&t===e.length?V.fromByteArray(e):V.fromByteArray(e.slice(r,t))}function _r(e,r,t){t=Math.min(e.length,t);for(var n=[],i=r;i<t;){var o=e[i],p=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=t){var u,f,h,c;switch(s){case 1:o<128&&(p=o);break;case 2:u=e[i+1],(u&192)===128&&(c=(o&31)<<6|u&63,c>127&&(p=c));break;case 3:u=e[i+1],f=e[i+2],(u&192)===128&&(f&192)===128&&(c=(o&15)<<12|(u&63)<<6|f&63,c>2047&&(c<55296||c>57343)&&(p=c));break;case 4:u=e[i+1],f=e[i+2],h=e[i+3],(u&192)===128&&(f&192)===128&&(h&192)===128&&(c=(o&15)<<18|(u&63)<<12|(f&63)<<6|h&63,c>65535&&c<1114112&&(p=c))}}p===null?(p=65533,s=1):p>65535&&(p-=65536,n.push(p>>>10&1023|55296),p=56320|p&1023),n.push(p),i+=s}return nt(n)}var cr=4096;function nt(e){var r=e.length;if(r<=cr)return String.fromCharCode.apply(String,e);for(var t="",n=0;n<r;)t+=String.fromCharCode.apply(String,e.slice(n,n+=cr));return t}function it(e,r,t){var n="";t=Math.min(e.length,t);for(var i=r;i<t;++i)n+=String.fromCharCode(e[i]&127);return n}function ot(e,r,t){var n="";t=Math.min(e.length,t);for(var i=r;i<t;++i)n+=String.fromCharCode(e[i]);return n}function pt(e,r,t){var n=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);for(var i="",o=r;o<t;++o)i+=ft[e[o]];return i}function at(e,r,t){for(var n=e.slice(r,t),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}a.prototype.slice=function(r,t){var n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);var i=this.subarray(r,t);return Object.setPrototypeOf(i,a.prototype),i};function _(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||_(r,t,this.length);for(var i=this[r],o=1,p=0;++p<t&&(o*=256);)i+=this[r+p]*o;return i};a.prototype.readUintBE=a.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||_(r,t,this.length);for(var i=this[r+--t],o=1;t>0&&(o*=256);)i+=this[r+--t]*o;return i};a.prototype.readUint8=a.prototype.readUInt8=function(r,t){return r=r>>>0,t||_(r,1,this.length),this[r]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||_(r,2,this.length),this[r]|this[r+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||_(r,2,this.length),this[r]<<8|this[r+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||_(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||_(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};a.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||_(r,t,this.length);for(var i=this[r],o=1,p=0;++p<t&&(o*=256);)i+=this[r+p]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};a.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||_(r,t,this.length);for(var i=t,o=1,p=this[r+--i];i>0&&(o*=256);)p+=this[r+--i]*o;return o*=128,p>=o&&(p-=Math.pow(2,8*t)),p};a.prototype.readInt8=function(r,t){return r=r>>>0,t||_(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};a.prototype.readInt16LE=function(r,t){r=r>>>0,t||_(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function(r,t){r=r>>>0,t||_(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function(r,t){return r=r>>>0,t||_(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};a.prototype.readInt32BE=function(r,t){return r=r>>>0,t||_(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};a.prototype.readFloatLE=function(r,t){return r=r>>>0,t||_(r,4,this.length),N.read(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,t){return r=r>>>0,t||_(r,4,this.length),N.read(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||_(r,8,this.length),N.read(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||_(r,8,this.length),N.read(this,r,!1,52,8)};function w(e,r,t,n,i,o){if(!a.isBuffer(e))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(t+n>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,r,t,n,o,0)}var p=1,s=0;for(this[t]=r&255;++s<n&&(p*=256);)this[t+s]=r/p&255;return t+n};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,r,t,n,o,0)}var p=n-1,s=1;for(this[t+p]=r&255;--p>=0&&(s*=256);)this[t+p]=r/s&255;return t+n};a.prototype.writeUint8=a.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,1,255,0),this[t]=r&255,t+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};a.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){var o=Math.pow(2,8*n-1);w(this,r,t,n,o-1,-o)}var p=0,s=1,u=0;for(this[t]=r&255;++p<n&&(s*=256);)r<0&&u===0&&this[t+p-1]!==0&&(u=1),this[t+p]=(r/s>>0)-u&255;return t+n};a.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){var o=Math.pow(2,8*n-1);w(this,r,t,n,o-1,-o)}var p=n-1,s=1,u=0;for(this[t+p]=r&255;--p>=0&&(s*=256);)r<0&&u===0&&this[t+p+1]!==0&&(u=1),this[t+p]=(r/s>>0)-u&255;return t+n};a.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};a.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};a.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};a.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};a.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||w(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function yr(e,r,t,n,i,o){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function wr(e,r,t,n,i){return r=+r,t=t>>>0,i||yr(e,r,t,4,34028234663852886e22,-34028234663852886e22),N.write(e,r,t,n,23,4),t+4}a.prototype.writeFloatLE=function(r,t,n){return wr(this,r,t,!0,n)};a.prototype.writeFloatBE=function(r,t,n){return wr(this,r,t,!1,n)};function xr(e,r,t,n,i){return r=+r,t=t>>>0,i||yr(e,r,t,8,17976931348623157e292,-17976931348623157e292),N.write(e,r,t,n,52,8),t+8}a.prototype.writeDoubleLE=function(r,t,n){return xr(this,r,t,!0,n)};a.prototype.writeDoubleBE=function(r,t,n){return xr(this,r,t,!1,n)};a.prototype.copy=function(r,t,n,i){if(!a.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t<i-n&&(i=r.length-t+n);var o=i-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(r,this.subarray(n,i),t),o};a.prototype.fill=function(r,t,n,i){if(typeof r=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){var o=r.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(r=o)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var p;if(typeof r=="number")for(p=t;p<n;++p)this[p]=r;else{var s=a.isBuffer(r)?r:a.from(r,i),u=s.length;if(u===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(p=0;p<n-t;++p)this[p+t]=s[p%u]}return this};var st=/[^+/0-9A-Za-z-_]/g;function ut(e){if(e=e.split("=")[0],e=e.trim().replace(st,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function $(e,r){r=r||1/0;for(var t,n=e.length,i=null,o=[],p=0;p<n;++p){if(t=e.charCodeAt(p),t>55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(p+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function ct(e){for(var r=[],t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function ht(e,r){for(var t,n,i,o=[],p=0;p<e.length&&!((r-=2)<0);++p)t=e.charCodeAt(p),n=t>>8,i=t%256,o.push(i),o.push(n);return o}function dr(e){return V.toByteArray(ut(e))}function G(e,r,t,n){for(var i=0;i<n&&!(i+t>=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function F(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function rr(e){return e!==e}var ft=function(){for(var e="0123456789abcdef",r=new Array(256),t=0;t<16;++t)for(var n=t*16,i=0;i<16;++i)r[n+i]=e[t]+e[i];return r}()});var Ar=q((Ft,Br)=>{y();var l=Br.exports={},v,B;function tr(){throw new Error("setTimeout has not been defined")}function er(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?v=setTimeout:v=tr}catch(e){v=tr}try{typeof clearTimeout=="function"?B=clearTimeout:B=er}catch(e){B=er}})();function gr(e){if(v===setTimeout)return setTimeout(e,0);if((v===tr||!v)&&setTimeout)return v=setTimeout,setTimeout(e,0);try{return v(e,0)}catch(r){try{return v.call(null,e,0)}catch(t){return v.call(this,e,0)}}}function lt(e){if(B===clearTimeout)return clearTimeout(e);if((B===er||!B)&&clearTimeout)return B=clearTimeout,clearTimeout(e);try{return B(e)}catch(r){try{return B.call(null,e)}catch(t){return B.call(this,e)}}}var T=[],z=!1,b,O=-1;function mt(){!z||!b||(z=!1,b.length?T=b.concat(T):O=-1,T.length&&Fr())}function Fr(){if(!z){var e=gr(mt);z=!0;for(var r=T.length;r;){for(b=T,T=[];++O<r;)b&&b[O].run();O=-1,r=T.length}b=null,z=!1,lt(e)}}l.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];T.push(new vr(e,r)),T.length===1&&!z&&gr(Fr)};function vr(e,r){this.fun=e,this.array=r}vr.prototype.run=function(){this.fun.apply(null,this.array)};l.title="browser";l.browser=!0;l.env={};l.argv=[];l.version="";l.versions={};function U(){}l.on=U;l.addListener=U;l.once=U;l.off=U;l.removeListener=U;l.removeAllListeners=U;l.emit=U;l.prependListener=U;l.prependOnceListener=U;l.listeners=function(e){return[]};l.binding=function(e){throw new Error("process.binding is not supported")};l.cwd=function(){return"/"};l.chdir=function(e){throw new Error("process.chdir is not supported")};l.umask=function(){return 0}});var C,S,vt,y=Mr(()=>{C=W(Er()),S=W(Ar()),vt=function(e){function r(){var n=this||self;return delete e.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return r();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:r});var t=__magic__;return t}(Object)});var wt={};Rr(wt,{Trim:()=>yt});module.exports=Nr(wt);y();y();var m=W(require("react")),Tr=W(require("classnames")),Ur=W(require("lodash.debounce"));y();var _t=`.dapp-core-component__trim-styles__trim { display: flex; max-width: 100%; overflow: hidden; position: relative; white-space: nowrap; /* IE fix */ /* SAFARI fix */ } .dapp-core-component__trim-styles__trim.dapp-core-component__trim-styles__overflow .dapp-core-component__trim-styles__ellipsis { display: block; } .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__left { flex-shrink: 1; font-size: 1px; overflow: hidden; text-overflow: ellipsis; text-align: left; } .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__right { flex-shrink: 1; font-size: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: right; } .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__left span, .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__right span { font-size: 0.875rem; pointer-events: none; user-select: none; } .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__ellipsis { flex-shrink: 0; display: none; pointer-events: none; user-select: none; } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__right { text-overflow: clip; } } @supports (-webkit-hyphens: none) { .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__right, .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__left { letter-spacing: -0.001em; } .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__right { text-overflow: clip; } } .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__hidden-text-ref { position: absolute; display: block; color: transparent; } @media (max-width: 1199.98px) { .dapp-core-component__trim-styles__trim { max-width: 26rem; } } @media (max-width: 991.98px) { .dapp-core-component__trim-styles__trim { max-width: 12rem; } } @media (max-width: 768px) { .dapp-core-component__trim-styles__trim { max-width: 8rem; } } .dapp-core-component__trim-styles__trim-wrapper { display: flex; max-width: 100%; overflow: hidden; } a:hover > .dapp-core-component__trim-styles__trim span { color: #0056b3 !important; } a:hover > .dapp-core-component__trim-styles__trim span.dapp-core-component__trim-styles__hidden-text-ref { color: transparent !important; } a > .dapp-core-component__trim-styles__trim span, .dapp-core-component__trim-styles__text-primary > .dapp-core-component__trim-styles__trim span { color: #1b46c2 !important; } a > .dapp-core-component__trim-styles__trim span.dapp-core-component__trim-styles__hidden-text-ref, .dapp-core-component__trim-styles__text-primary > .dapp-core-component__trim-styles__trim span.dapp-core-component__trim-styles__hidden-text-ref { color: transparent !important; } .dapp-core-component__trim-styles__table .dapp-core-component__trim-styles__trim { max-width: 10rem; } .dapp-core-component__trim-styles__table .dapp-core-component__trim-styles__trim-only-sm .dapp-core-component__trim-styles__trim { max-width: none; } @media (max-width: 768px) { .dapp-core-component__trim-styles__table .dapp-core-component__trim-styles__trim-only-sm .dapp-core-component__trim-styles__trim { max-width: 13rem; } } .dapp-core-component__trim-styles__trim-fs-sm .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__left span, .dapp-core-component__trim-styles__trim-fs-sm .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__right span, .dapp-core-component__trim-styles__trim-fs-sm .dapp-core-component__trim-styles__trim .dapp-core-component__trim-styles__ellipsis { font-size: 0.875rem; } @media (max-width: 768px) { .dapp-core-component__trim-styles__table .dapp-core-component__trim-styles__trim-size-xl .dapp-core-component__trim-styles__trim { max-width: 13rem; } }`;document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(_t));var k={trim:"dapp-core-component__trim-styles__trim",overflow:"dapp-core-component__trim-styles__overflow",ellipsis:"dapp-core-component__trim-styles__ellipsis",left:"dapp-core-component__trim-styles__left",right:"dapp-core-component__trim-styles__right","hidden-text-ref":"dapp-core-component__trim-styles__hidden-text-ref",hiddenTextRef:"dapp-core-component__trim-styles__hidden-text-ref","trim-wrapper":"dapp-core-component__trim-styles__trim-wrapper",trimWrapper:"dapp-core-component__trim-styles__trim-wrapper","text-primary":"dapp-core-component__trim-styles__text-primary",textPrimary:"dapp-core-component__trim-styles__text-primary",table:"dapp-core-component__trim-styles__table","trim-only-sm":"dapp-core-component__trim-styles__trim-only-sm",trimOnlySm:"dapp-core-component__trim-styles__trim-only-sm","trim-fs-sm":"dapp-core-component__trim-styles__trim-fs-sm",trimFsSm:"dapp-core-component__trim-styles__trim-fs-sm","trim-size-xl":"dapp-core-component__trim-styles__trim-size-xl",trimSizeXl:"dapp-core-component__trim-styles__trim-size-xl"};var yt=({text:e,className:r="dapp-trim",dataTestId:t="trim-text-component",color:n})=>{let[i,o]=(0,m.useState)(!1),p=(0,m.useRef)(document==null?void 0:document.createElement("span")),s=(0,m.useRef)(document==null?void 0:document.createElement("span")),u=(0,m.useCallback)((0,Ur.default)(()=>{if(p.current&&s.current){let h=s.current.offsetWidth-p.current.offsetWidth;o(h>1)}},300),[]);return(0,m.useEffect)(()=>(window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)})),(0,m.useEffect)(()=>{u()},[]),m.default.createElement("span",{ref:p,className:(0,Tr.default)(k.trim,n!=null?n:"",{[k.overflow]:i},r),"data-testid":t},m.default.createElement("span",{ref:s,className:k.hiddenTextRef},e),i?m.default.createElement(m.default.Fragment,null,m.default.createElement("span",{className:k.left},m.default.createElement("span",null,String(e).substring(0,Math.floor(e.length/2)))),m.default.createElement("span",{className:k.ellipsis},"..."),m.default.createElement("span",{className:k.right},m.default.createElement("span",null,String(e).substring(Math.ceil(e.length/2))))):m.default.createElement("span",null,e))};0&&(module.exports={Trim}); /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ //# sourceMappingURL=index.js.map