@waves/bignumber
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,2 +0,2 @@ | ||
import { default as BigNum } from 'bignumber.js'; | ||
import BigNum from 'bignumber.js'; | ||
import { Config, IFormat } from './Config'; | ||
@@ -33,3 +33,3 @@ declare type TLong = string | number | BigNumber; | ||
isInt(): boolean; | ||
getDecimalsCount(): number; | ||
getDecimalsCount(): number | null; | ||
isEven(): boolean; | ||
@@ -41,3 +41,3 @@ isOdd(): boolean; | ||
toFixed(decimals?: number, roundMode?: BigNumber.ROUND_MODE): string; | ||
toString(): string; | ||
toString(base?: number): string; | ||
toNumber(): number; | ||
@@ -44,0 +44,0 @@ toJSON(): string; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BigNumber = void 0; | ||
var bignumber_js_1 = __importDefault(require("bignumber.js")); | ||
@@ -109,4 +110,4 @@ var Config_1 = require("./Config"); | ||
}; | ||
BigNumber.prototype.toString = function () { | ||
return this.toFixed(); | ||
BigNumber.prototype.toString = function (base) { | ||
return base ? this.bn.toString(base) : this.toFixed(); | ||
}; | ||
@@ -113,0 +114,0 @@ BigNumber.prototype.toNumber = function () { |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).BigNumber={})}(this,function(e){"use strict";var t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,r=Math.floor,i="[BigNumber Error] ",o=i+"Number primitive has more than 15 significant digits: ",u=1e14,s=14,f=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],l=1e7,a=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,n,r=1,i=e.length,o=e[0]+"";r<i;){for(t=e[r++]+"",n=s-t.length;n--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function g(e,t){var n,r,i=e.c,o=t.c,u=e.s,s=t.s,f=e.e,c=t.e;if(!u||!s)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-s:u;if(u!=s)return u;if(n=u<0,r=f==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return f>c^n?1:-1;for(s=(f=i.length)<(c=o.length)?f:c,u=0;u<s;u++)if(i[u]!=o[u])return i[u]>o[u]^n?1:-1;return f==c?0:f>c^n?1:-1}function m(e,t,n,o){if(e<t||e>n||e!==r(e))throw Error(i+(o||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function N(e){var t=e.c.length-1;return h(e.e/s)==t&&e.c[t]%2!=0}function b(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var d=function e(d){var y,O,v,E,A,_,U,R,D,L=H.prototype={constructor:H,toString:null,valueOf:null},B=new H(1),S=20,F=4,I=-7,M=21,x=-1e7,P=1e7,T=!1,C=1,G=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz";function H(e,n){var i,u,c,l,a,h,p,g,N=this;if(!(N instanceof H))return new H(e,n);if(null==n){if(e&&!0===e._isBigNumber)return N.s=e.s,void(!e.c||e.e>P?N.c=N.e=null:e.e<x?N.c=[N.e=0]:(N.e=e.e,N.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(N.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,a=e;a>=10;a/=10,l++);return void(l>P?N.c=N.e=null:(N.e=l,N.c=[e]))}g=String(e)}else{if(!t.test(g=String(e)))return v(N,g,h);N.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(a=g.search(/e/i))>0?(l<0&&(l=a),l+=+g.slice(a+1),g=g.substring(0,a)):l<0&&(l=g.length)}else{if(m(n,2,q.length,"Base"),10==n)return z(N=new H(e),S+N.e+1,F);if(g=String(e),h="number"==typeof e){if(0*e!=0)return v(N,g,h,n);if(N.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else N.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=q.slice(0,n),l=a=0,p=g.length;a<p;a++)if(i.indexOf(u=g.charAt(a))<0){if("."==u){if(a>l){l=p;continue}}else if(!c&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){c=!0,a=-1,l=0;continue}return v(N,String(e),h,n)}h=!1,(l=(g=O(g,n,10,N.s)).indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(a=0;48===g.charCodeAt(a);a++);for(p=g.length;48===g.charCodeAt(--p););if(g=g.slice(a,++p)){if(p-=a,h&&H.DEBUG&&p>15&&(e>f||e!==r(e)))throw Error(o+N.s*e);if((l=l-a-1)>P)N.c=N.e=null;else if(l<x)N.c=[N.e=0];else{if(N.e=l,N.c=[],a=(l+1)%s,l<0&&(a+=s),a<p){for(a&&N.c.push(+g.slice(0,a)),p-=s;a<p;)N.c.push(+g.slice(a,a+=s));a=s-(g=g.slice(a)).length}else a-=p;for(;a--;g+="0");N.c.push(+g)}}else N.c=[N.e=0]}function V(e,t,n,r){var i,o,u,s,f;if(null==n?n=F:m(n,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==t)f=p(e.c),f=1==r||2==r&&(u<=I||u>=M)?b(f,u):w(f,u,"0");else if(o=(e=z(new H(e),t,n)).e,s=(f=p(e.c)).length,1==r||2==r&&(t<=o||o<=I)){for(;s<t;f+="0",s++);f=b(f,o)}else if(t-=u,f=w(f,o,"0"),o+1>s){if(--t>0)for(f+=".";t--;f+="0");}else if((t+=o-s)>0)for(o+1==s&&(f+=".");t--;f+="0");return e.s<0&&i?"-"+f:f}function J(e,t){for(var n,r=1,i=new H(e[0]);r<e.length;r++){if(!(n=new H(e[r])).s){i=n;break}t.call(i,n)&&(i=n)}return i}function k(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*s-1)>P?e.c=e.e=null:n<x?e.c=[e.e=0]:(e.e=n,e.c=t),e}function z(e,t,i,o){var f,l,a,h,p,g,m,N=e.c,b=c;if(N){e:{for(f=1,h=N[0];h>=10;h/=10,f++);if((l=t-f)<0)l+=s,a=t,m=(p=N[g=0])/b[f-a-1]%10|0;else if((g=n((l+1)/s))>=N.length){if(!o)break e;for(;N.length<=g;N.push(0));p=m=0,f=1,a=(l%=s)-s+1}else{for(p=h=N[g],f=1;h>=10;h/=10,f++);m=(a=(l%=s)-s+f)<0?0:p/b[f-a-1]%10|0}if(o=o||t<0||null!=N[g+1]||(a<0?p:p%b[f-a-1]),o=i<4?(m||o)&&(0==i||i==(e.s<0?3:2)):m>5||5==m&&(4==i||o||6==i&&(l>0?a>0?p/b[f-a]:0:N[g-1])%10&1||i==(e.s<0?8:7)),t<1||!N[0])return N.length=0,o?(t-=e.e+1,N[0]=b[(s-t%s)%s],e.e=-t||0):N[0]=e.e=0,e;if(0==l?(N.length=g,h=1,g--):(N.length=g+1,h=b[s-l],N[g]=a>0?r(p/b[f-a]%b[a])*h:0),o)for(;;){if(0==g){for(l=1,a=N[0];a>=10;a/=10,l++);for(a=N[0]+=h,h=1;a>=10;a/=10,h++);l!=h&&(e.e++,N[0]==u&&(N[0]=1));break}if(N[g]+=h,N[g]!=u)break;N[g--]=0,h=1}for(l=N.length;0===N[--l];N.pop());}e.e>P?e.c=e.e=null:e.e<x&&(e.c=[e.e=0])}return e}function $(e){var t,n=e.e;return null===n?e.toString():(t=p(e.c),t=n<=I||n>=M?b(t,n):w(t,n,"0"),e.s<0?"-"+t:t)}return H.clone=e,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(i+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(m(n=e[t],0,a,t),S=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(m(n=e[t],0,8,t),F=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(m(n[0],-a,0,t),m(n[1],0,a,t),I=n[0],M=n[1]):(m(n,-a,a,t),I=-(M=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)m(n[0],-a,-1,t),m(n[1],1,a,t),x=n[0],P=n[1];else{if(m(n,-a,a,t),!n)throw Error(i+t+" cannot be zero: "+n);x=-(P=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(i+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw T=!n,Error(i+"crypto unavailable");T=n}else T=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(m(n=e[t],0,9,t),C=n),e.hasOwnProperty(t="POW_PRECISION")&&(m(n=e[t],0,a,t),G=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(i+t+" not an object: "+n);j=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(i+t+" invalid: "+n);q=n}}return{DECIMAL_PLACES:S,ROUNDING_MODE:F,EXPONENTIAL_AT:[I,M],RANGE:[x,P],CRYPTO:T,MODULO_MODE:C,POW_PRECISION:G,FORMAT:j,ALPHABET:q}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,n,o=e.c,f=e.e,c=e.s;e:if("[object Array]"=={}.toString.call(o)){if((1===c||-1===c)&&f>=-a&&f<=a&&f===r(f)){if(0===o[0]){if(0===f&&1===o.length)return!0;break e}if((t=(f+1)%s)<1&&(t+=s),String(o[0]).length==t){for(t=0;t<o.length;t++)if((n=o[t])<0||n>=u||n!==r(n))break e;if(0!==n)return!0}}}else if(null===o&&null===f&&(null===c||1===c||-1===c))return!0;throw Error(i+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return J(arguments,L.lt)},H.minimum=H.min=function(){return J(arguments,L.gt)},H.random=(E=9007199254740992*Math.random()&2097151?function(){return r(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,o,u,f,l,h=0,p=[],g=new H(B);if(null==e?e=S:m(e,0,a),f=n(e/s),T)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(f*=2));h<f;)(l=131072*t[h]+(t[h+1]>>>11))>=9e15?(o=crypto.getRandomValues(new Uint32Array(2)),t[h]=o[0],t[h+1]=o[1]):(p.push(l%1e14),h+=2);h=f/2}else{if(!crypto.randomBytes)throw T=!1,Error(i+"crypto unavailable");for(t=crypto.randomBytes(f*=7);h<f;)(l=281474976710656*(31&t[h])+1099511627776*t[h+1]+4294967296*t[h+2]+16777216*t[h+3]+(t[h+4]<<16)+(t[h+5]<<8)+t[h+6])>=9e15?crypto.randomBytes(7).copy(t,h):(p.push(l%1e14),h+=7);h=f/7}if(!T)for(;h<f;)(l=E())<9e15&&(p[h++]=l%1e14);for(f=p[--h],e%=s,f&&e&&(l=c[s-e],p[h]=r(f/l)*l);0===p[h];p.pop(),h--);if(h<0)p=[u=0];else{for(u=-1;0===p[0];p.splice(0,1),u-=s);for(h=1,l=p[0];l>=10;l/=10,h++);h<s&&(u-=s-h)}return g.e=u,g.c=p,g}),H.sum=function(){for(var e=1,t=arguments,n=new H(t[0]);e<t.length;)n=n.plus(t[e++]);return n},O=function(){function e(e,t,n,r){for(var i,o,u=[0],s=0,f=e.length;s<f;){for(o=u.length;o--;u[o]*=t);for(u[0]+=r.indexOf(e.charAt(s++)),i=0;i<u.length;i++)u[i]>n-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/n|0,u[i]%=n)}return u.reverse()}return function(t,n,r,i,o){var u,s,f,c,l,a,h,g,m=t.indexOf("."),N=S,b=F;for(m>=0&&(c=G,G=0,t=t.replace(".",""),a=(g=new H(n)).pow(t.length-m),G=c,g.c=e(w(p(a.c),a.e,"0"),10,r,"0123456789"),g.e=g.c.length),f=c=(h=e(t,n,r,o?(u=q,"0123456789"):(u="0123456789",q))).length;0==h[--c];h.pop());if(!h[0])return u.charAt(0);if(m<0?--f:(a.c=h,a.e=f,a.s=i,h=(a=y(a,g,N,b,r)).c,l=a.r,f=a.e),m=h[s=f+N+1],c=r/2,l=l||s<0||null!=h[s+1],l=b<4?(null!=m||l)&&(0==b||b==(a.s<0?3:2)):m>c||m==c&&(4==b||l||6==b&&1&h[s-1]||b==(a.s<0?8:7)),s<1||!h[0])t=l?w(u.charAt(1),-N,u.charAt(0)):u.charAt(0);else{if(h.length=s,l)for(--r;++h[--s]>r;)h[s]=0,s||(++f,h=[1].concat(h));for(c=h.length;!h[--c];);for(m=0,t="";m<=c;t+=u.charAt(h[m++]));t=w(t,f,u.charAt(0))}return t}}(),y=function(){function e(e,t,n){var r,i,o,u,s=0,f=e.length,c=t%l,a=t/l|0;for(e=e.slice();f--;)s=((i=c*(o=e[f]%l)+(r=a*o+(u=e[f]/l|0)*c)%l*l+s)/n|0)+(r/l|0)+a*u,e[f]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,o,f,c,l){var a,p,g,m,N,b,w,d,y,O,v,E,A,_,U,R,D,L=i.s==o.s?1:-1,B=i.c,S=o.c;if(!(B&&B[0]&&S&&S[0]))return new H(i.s&&o.s&&(B?!S||B[0]!=S[0]:S)?B&&0==B[0]||!S?0*L:L/0:NaN);for(y=(d=new H(L)).c=[],L=f+(p=i.e-o.e)+1,l||(l=u,p=h(i.e/s)-h(o.e/s),L=L/s|0),g=0;S[g]==(B[g]||0);g++);if(S[g]>(B[g]||0)&&p--,L<0)y.push(1),m=!0;else{for(_=B.length,R=S.length,g=0,L+=2,(N=r(l/(S[0]+1)))>1&&(S=e(S,N,l),B=e(B,N,l),R=S.length,_=B.length),A=R,v=(O=B.slice(0,R)).length;v<R;O[v++]=0);D=S.slice(),D=[0].concat(D),U=S[0],S[1]>=l/2&&U++;do{if(N=0,(a=t(S,O,R,v))<0){if(E=O[0],R!=v&&(E=E*l+(O[1]||0)),(N=r(E/U))>1)for(N>=l&&(N=l-1),w=(b=e(S,N,l)).length,v=O.length;1==t(b,O,w,v);)N--,n(b,R<w?D:S,w,l),w=b.length,a=1;else 0==N&&(a=N=1),w=(b=S.slice()).length;if(w<v&&(b=[0].concat(b)),n(O,b,v,l),v=O.length,-1==a)for(;t(S,O,R,v)<1;)N++,n(O,R<v?D:S,v,l),v=O.length}else 0===a&&(N++,O=[0]);y[g++]=N,O[0]?O[v++]=B[A]||0:(O=[B[A]],v=1)}while((A++<_||null!=O[0])&&L--);m=null!=O[0],y[0]||y.splice(0,1)}if(l==u){for(g=1,L=y[0];L>=10;L/=10,g++);z(d,f+(d.e=g+p*s-1)+1,c,m)}else d.e=p,d.r=+m;return d}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,_=/^([^.]+)\.$/,U=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,D=/^\s*\+(?=[\w.])|^\s+|\s+$/g,v=function(e,t,n,r){var o,u=n?t:t.replace(D,"");if(R.test(u))e.s=isNaN(u)?null:u<0?-1:1;else{if(!n&&(u=u.replace(A,function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t}),r&&(o=r,u=u.replace(_,"$1").replace(U,"0.$1")),t!=u))return new H(u,o);if(H.DEBUG)throw Error(i+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},L.absoluteValue=L.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},L.comparedTo=function(e,t){return g(this,new H(e,t))},L.decimalPlaces=L.dp=function(e,t){var n,r,i,o=this;if(null!=e)return m(e,0,a),null==t?t=F:m(t,0,8),z(new H(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-h(this.e/s))*s,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},L.dividedBy=L.div=function(e,t){return y(this,new H(e,t),S,F)},L.dividedToIntegerBy=L.idiv=function(e,t){return y(this,new H(e,t),0,1)},L.exponentiatedBy=L.pow=function(e,t){var o,u,f,c,l,a,h,p,g=this;if((e=new H(e)).c&&!e.isInteger())throw Error(i+"Exponent not an integer: "+$(e));if(null!=t&&(t=new H(t)),l=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return p=new H(Math.pow(+$(g),l?2-N(e):+$(e))),t?p.mod(t):p;if(a=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);(u=!a&&g.isInteger()&&t.isInteger())&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||l&&g.c[1]>=24e7:g.c[0]<8e13||l&&g.c[0]<=9999975e7)))return c=g.s<0&&N(e)?-0:0,g.e>-1&&(c=1/c),new H(a?1/c:c);G&&(c=n(G/s+2))}for(l?(o=new H(.5),a&&(e.s=1),h=N(e)):h=(f=Math.abs(+$(e)))%2,p=new H(B);;){if(h){if(!(p=p.times(g)).c)break;c?p.c.length>c&&(p.c.length=c):u&&(p=p.mod(t))}if(f){if(0===(f=r(f/2)))break;h=f%2}else if(z(e=e.times(o),e.e+1,1),e.e>14)h=N(e);else{if(0==(f=+$(e)))break;h=f%2}g=g.times(g),c?g.c&&g.c.length>c&&(g.c.length=c):u&&(g=g.mod(t))}return u?p:(a&&(p=B.div(p)),t?p.mod(t):c?z(p,G,F,void 0):p)},L.integerValue=function(e){var t=new H(this);return null==e?e=F:m(e,0,8),z(t,t.e+1,e)},L.isEqualTo=L.eq=function(e,t){return 0===g(this,new H(e,t))},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(e,t){return g(this,new H(e,t))>0},L.isGreaterThanOrEqualTo=L.gte=function(e,t){return 1===(t=g(this,new H(e,t)))||0===t},L.isInteger=function(){return!!this.c&&h(this.e/s)>this.c.length-2},L.isLessThan=L.lt=function(e,t){return g(this,new H(e,t))<0},L.isLessThanOrEqualTo=L.lte=function(e,t){return-1===(t=g(this,new H(e,t)))||0===t},L.isNaN=function(){return!this.s},L.isNegative=function(){return this.s<0},L.isPositive=function(){return this.s>0},L.isZero=function(){return!!this.c&&0==this.c[0]},L.minus=function(e,t){var n,r,i,o,f=this,c=f.s;if(t=(e=new H(e,t)).s,!c||!t)return new H(NaN);if(c!=t)return e.s=-t,f.plus(e);var l=f.e/s,a=e.e/s,p=f.c,g=e.c;if(!l||!a){if(!p||!g)return p?(e.s=-t,e):new H(g?f:NaN);if(!p[0]||!g[0])return g[0]?(e.s=-t,e):new H(p[0]?f:3==F?-0:0)}if(l=h(l),a=h(a),p=p.slice(),c=l-a){for((o=c<0)?(c=-c,i=p):(a=l,i=g),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(o=(c=p.length)<(t=g.length))?c:t,c=t=0;t<r;t++)if(p[t]!=g[t]){o=p[t]<g[t];break}if(o&&(i=p,p=g,g=i,e.s=-e.s),(t=(r=g.length)-(n=p.length))>0)for(;t--;p[n++]=0);for(t=u-1;r>c;){if(p[--r]<g[r]){for(n=r;n&&!p[--n];p[n]=t);--p[n],p[r]+=u}p[r]-=g[r]}for(;0==p[0];p.splice(0,1),--a);return p[0]?k(e,p,a):(e.s=3==F?-1:1,e.c=[e.e=0],e)},L.modulo=L.mod=function(e,t){var n,r,i=this;return e=new H(e,t),!i.c||!e.s||e.c&&!e.c[0]?new H(NaN):!e.c||i.c&&!i.c[0]?new H(i):(9==C?(r=e.s,e.s=1,n=y(i,e,0,3),e.s=r,n.s*=r):n=y(i,e,0,C),(e=i.minus(n.times(e))).c[0]||1!=C||(e.s=i.s),e)},L.multipliedBy=L.times=function(e,t){var n,r,i,o,f,c,a,p,g,m,N,b,w,d,y,O=this,v=O.c,E=(e=new H(e,t)).c;if(!(v&&E&&v[0]&&E[0]))return!O.s||!e.s||v&&!v[0]&&!E||E&&!E[0]&&!v?e.c=e.e=e.s=null:(e.s*=O.s,v&&E?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=h(O.e/s)+h(e.e/s),e.s*=O.s,(a=v.length)<(m=E.length)&&(w=v,v=E,E=w,i=a,a=m,m=i),i=a+m,w=[];i--;w.push(0));for(d=u,y=l,i=m;--i>=0;){for(n=0,N=E[i]%y,b=E[i]/y|0,o=i+(f=a);o>i;)n=((p=N*(p=v[--f]%y)+(c=b*p+(g=v[f]/y|0)*N)%y*y+w[o]+n)/d|0)+(c/y|0)+b*g,w[o--]=p%d;w[o]=n}return n?++r:w.splice(0,1),k(e,w,r)},L.negated=function(){var e=new H(this);return e.s=-e.s||null,e},L.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new H(e,t)).s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/s,f=e.e/s,c=r.c,l=e.c;if(!o||!f){if(!c||!l)return new H(i/0);if(!c[0]||!l[0])return l[0]?e:new H(c[0]?r:0*i)}if(o=h(o),f=h(f),c=c.slice(),i=o-f){for(i>0?(f=o,n=l):(i=-i,n=c),n.reverse();i--;n.push(0));n.reverse()}for((i=c.length)-(t=l.length)<0&&(n=l,l=c,c=n,t=i),i=0;t;)i=(c[--t]=c[t]+l[t]+i)/u|0,c[t]=u===c[t]?0:c[t]%u;return i&&(c=[i].concat(c),++f),k(e,c,f)},L.precision=L.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return m(e,1,a),null==t?t=F:m(t,0,8),z(new H(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*s+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},L.shiftedBy=function(e){return m(e,-f,f),this.times("1e"+e)},L.squareRoot=L.sqrt=function(){var e,t,n,r,i,o=this,u=o.c,s=o.s,f=o.e,c=S+4,l=new H("0.5");if(1!==s||!u||!u[0])return new H(!s||s<0&&(!u||u[0])?NaN:u?o:1/0);if(0==(s=Math.sqrt(+$(o)))||s==1/0?(((t=p(u)).length+f)%2==0&&(t+="0"),s=Math.sqrt(+t),f=h((f+1)/2)-(f<0||f%2),n=new H(t=s==1/0?"5e"+f:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+f)):n=new H(s+""),n.c[0])for((s=(f=n.e)+c)<3&&(s=0);;)if(i=n,n=l.times(i.plus(y(o,i,c,1))),p(i.c).slice(0,s)===(t=p(n.c)).slice(0,s)){if(n.e<f&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(r||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(z(n,n.e+S+2,1),e=!n.times(n).eq(o));break}if(!r&&(z(i,i.e+S+2,0),i.times(i).eq(o))){n=i;break}c+=4,s+=4,r=1}return z(n,n.e+S+1,F,e)},L.toExponential=function(e,t){return null!=e&&(m(e,0,a),e++),V(this,e,t,1)},L.toFixed=function(e,t){return null!=e&&(m(e,0,a),e=e+this.e+1),V(this,e,t)},L.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=j;else if("object"!=typeof n)throw Error(i+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var u,s=r.split("."),f=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||"",a=s[0],h=s[1],p=o.s<0,g=p?a.slice(1):a,m=g.length;if(c&&(u=f,f=c,c=u,m-=u),f>0&&m>0){for(u=m%f||f,a=g.substr(0,u);u<m;u+=f)a+=l+g.substr(u,f);c>0&&(a+=l+g.slice(u)),p&&(a="-"+a)}r=h?a+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):a}return(n.prefix||"")+r+(n.suffix||"")},L.toFraction=function(e){var t,n,r,o,u,f,l,a,h,g,m,N,b=this,w=b.c;if(null!=e&&(!(l=new H(e)).isInteger()&&(l.c||1!==l.s)||l.lt(B)))throw Error(i+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+$(l));if(!w)return new H(b);for(t=new H(B),h=n=new H(B),r=a=new H(B),N=p(w),u=t.e=N.length-b.e-1,t.c[0]=c[(f=u%s)<0?s+f:f],e=!e||l.comparedTo(t)>0?u>0?t:h:l,f=P,P=1/0,l=new H(N),a.c[0]=0;g=y(l,t,0,1),1!=(o=n.plus(g.times(r))).comparedTo(e);)n=r,r=o,h=a.plus(g.times(o=h)),a=o,t=l.minus(g.times(o=t)),l=o;return o=y(e.minus(n),r,0,1),a=a.plus(o.times(h)),n=n.plus(o.times(r)),a.s=h.s=b.s,m=y(h,r,u*=2,F).minus(b).abs().comparedTo(y(a,n,u,F).minus(b).abs())<1?[h,r]:[a,n],P=f,m},L.toNumber=function(){return+$(this)},L.toPrecision=function(e,t){return null!=e&&m(e,1,a),V(this,e,t,2)},L.toString=function(e){var t,n=this,r=n.s,i=n.e;return null===i?r?(t="Infinity",r<0&&(t="-"+t)):t="NaN":(null==e?t=i<=I||i>=M?b(p(n.c),i):w(p(n.c),i,"0"):10===e?t=w(p((n=z(new H(n),S+i+1,F)).c),n.e,"0"):(m(e,2,q.length,"Base"),t=O(w(p(n.c),i,"0"),10,e,r,!0)),r<0&&n.c[0]&&(t="-"+t)),t},L.valueOf=L.toJSON=function(){return $(this)},L._isBigNumber=!0,L[Symbol.toStringTag]="BigNumber",L[Symbol.for("nodejs.util.inspect.custom")]=L.valueOf,null!=d&&H.set(d),H}(),y=function(){return(y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},O=function(){function e(){this.format=e.DEFAULT_FORMAT,d.config({FORMAT:this.format})}return e.prototype.set=function(e){"FORMAT"in e&&(this.format=y({},this.format,e.FORMAT),e.FORMAT=this.format),d.config(e)},e.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},e}();e.BigNumber=function(){function e(t){"object"==typeof t&&e.isBigNumber(t)?this.bn=t.bn.plus(0):this.bn=e.toBigNumberJs(t)}return e.prototype.clone=function(){return new e(this)},e.prototype.add=function(t){return new e(this.bn.plus(e.toBigNumberJs(t)))},e.prototype.sub=function(t){return new e(this.bn.minus(e.toBigNumberJs(t)))},e.prototype.mul=function(t){return new e(this.bn.times(e.toBigNumberJs(t)))},e.prototype.div=function(t){return new e(this.bn.div(e.toBigNumberJs(t)))},e.prototype.pow=function(t){return new e(this.bn.pow(e.toBigNumberJs(t)))},e.prototype.sqrt=function(){return new e(this.bn.sqrt())},e.prototype.abs=function(){return new e(this.bn.abs())},e.prototype.mod=function(t){return new e(this.bn.mod(e.toBigNumberJs(t)))},e.prototype.roundTo=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=4),new e(this.bn.dp(t||0,n))},e.prototype.eq=function(t){return this.bn.eq(e.toBigNumberJs(t))},e.prototype.lt=function(t){return this.bn.lt(e.toBigNumberJs(t))},e.prototype.gt=function(t){return this.bn.gt(e.toBigNumberJs(t))},e.prototype.lte=function(t){return this.bn.lte(e.toBigNumberJs(t))},e.prototype.gte=function(t){return this.bn.gte(e.toBigNumberJs(t))},e.prototype.isNaN=function(){return this.bn.isNaN()},e.prototype.isFinite=function(){return this.bn.isFinite()},e.prototype.isZero=function(){return this.eq(0)},e.prototype.isPositive=function(){return this.gt(0)},e.prototype.isNegative=function(){return this.lt(0)},e.prototype.isInt=function(){return this.bn.isInteger()},e.prototype.getDecimalsCount=function(){return this.bn.dp()},e.prototype.isEven=function(){return this.mod(2).eq(0)},e.prototype.isOdd=function(){return!this.isEven()},e.prototype.isInSignedRange=function(){return this.gte(e.MIN_VALUE)&&this.lte(e.MAX_VALUE)},e.prototype.isInUnsignedRange=function(){return this.gte(e.MIN_UNSIGNED_VALUE)&&this.lte(e.MAX_UNSIGNED_VALUE)},e.prototype.toFormat=function(e,t,n){return this.bn.toFormat(e,t,n)},e.prototype.toFixed=function(e,t){return null==e?this.bn.toFixed():this.bn.toFixed(e,t)},e.prototype.toString=function(){return this.toFixed()},e.prototype.toNumber=function(){return this.bn.toNumber()},e.prototype.toJSON=function(){return this.bn.toFixed()},e.prototype.valueOf=function(){return this.bn.valueOf()},e.prototype.toBytes=function(t){var n=void 0===t?{}:t,r=n.isSigned,i=void 0===r||r,o=n.isLong,u=void 0===o||o;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!i&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(u&&i&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(u&&!i&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var s=i&&this.isNegative(),f=s?"1":"0",c=this.bn.plus(f).toString(2).replace("-",""),l=u?64:8*Math.ceil(c.length/8),a=e._toLength(l,c).split(""),h=[];do{h.push(parseInt(a.splice(0,8).join(""),2))}while(a.length);return s?Uint8Array.from(h.map(function(e){return 255-e})):Uint8Array.from(h)},e.fromBytes=function(t,n){var r=void 0===n?{}:n,i=r.isSigned,o=void 0===i||i,u=r.isLong,s=void 0===u||u;if(s&&8!==t.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");t=!s&&t.length>0||s?t:[0];var f=!!o&&t[0]>127,c=Array.from(t).map(function(e){return f?255-e:e}).map(function(t){return e._toLength(8,t.toString(2))}).join(""),l=new e(new d(c,2));return f?l.mul(-1).sub(1):l},e.max=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.toBigNumber(t).reduce(function(e,t){return e.gte(t)?e:t})},e.min=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.toBigNumber(t).reduce(function(e,t){return e.lte(t)?e:t})},e.sum=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.toBigNumber(t).reduce(function(e,t){return e.add(t)})},e.isBigNumber=function(t){return t&&"object"==typeof t&&(t instanceof e||Object.entries(e.prototype).filter(function(e){return"_"!==e[0].charAt(0)}).every(function(e){var n=e[0],r=e[1];return n in t&&typeof r==typeof t[n]}))},e.toBigNumber=function(t){return Array.isArray(t)?t.map(function(t){return new e(t)}):new e(t)},e.toBigNumberJs=function(t){return d.isBigNumber(t)?t:t instanceof e?t.bn:new d(t)},e._toLength=function(e,t){return new Array(e).fill("0",0,e).concat(t.split("")).slice(-e).join("")},e.MIN_VALUE=new e("-9223372036854775808"),e.MAX_VALUE=new e("9223372036854775807"),e.MIN_UNSIGNED_VALUE=new e("0"),e.MAX_UNSIGNED_VALUE=new e("18446744073709551615"),e.config=new O,e}(),function(e){!function(e){e[e.ROUND_UP=0]="ROUND_UP",e[e.ROUND_DOWN=1]="ROUND_DOWN",e[e.ROUND_CEIL=2]="ROUND_CEIL",e[e.ROUND_FLOOR=3]="ROUND_FLOOR",e[e.ROUND_HALF_UP=4]="ROUND_HALF_UP",e[e.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",e[e.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",e[e.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",e[e.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(e.ROUND_MODE||(e.ROUND_MODE={}))}(e.BigNumber||(e.BigNumber={}));var v=e.BigNumber;e.default=v,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).BigNumber={})}(this,function(e){"use strict";var t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,r=Math.floor,i="[BigNumber Error] ",o=i+"Number primitive has more than 15 significant digits: ",u=1e14,s=14,f=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],l=1e7,a=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,n,r=1,i=e.length,o=e[0]+"";r<i;){for(t=e[r++]+"",n=s-t.length;n--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function g(e,t){var n,r,i=e.c,o=t.c,u=e.s,s=t.s,f=e.e,c=t.e;if(!u||!s)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-s:u;if(u!=s)return u;if(n=u<0,r=f==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return f>c^n?1:-1;for(s=(f=i.length)<(c=o.length)?f:c,u=0;u<s;u++)if(i[u]!=o[u])return i[u]>o[u]^n?1:-1;return f==c?0:f>c^n?1:-1}function m(e,t,n,o){if(e<t||e>n||e!==r(e))throw Error(i+(o||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function N(e){var t=e.c.length-1;return h(e.e/s)==t&&e.c[t]%2!=0}function b(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var d=function e(d){var y,O,v,E,A,_,U,R,D,L=V.prototype={constructor:V,toString:null,valueOf:null},B=new V(1),S=20,F=4,I=-7,M=21,x=-1e7,P=1e7,T=!1,C=1,G=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function V(e,n){var i,u,c,l,a,h,p,g,N=this;if(!(N instanceof V))return new V(e,n);if(null==n){if(e&&!0===e._isBigNumber)return N.s=e.s,void(!e.c||e.e>P?N.c=N.e=null:e.e<x?N.c=[N.e=0]:(N.e=e.e,N.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(N.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,a=e;a>=10;a/=10,l++);return void(l>P?N.c=N.e=null:(N.e=l,N.c=[e]))}g=String(e)}else{if(!t.test(g=String(e)))return v(N,g,h);N.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(a=g.search(/e/i))>0?(l<0&&(l=a),l+=+g.slice(a+1),g=g.substring(0,a)):l<0&&(l=g.length)}else{if(m(n,2,q.length,"Base"),10==n&&H)return $(N=new V(e),S+N.e+1,F);if(g=String(e),h="number"==typeof e){if(0*e!=0)return v(N,g,h,n);if(N.s=1/e<0?(g=g.slice(1),-1):1,V.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else N.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=q.slice(0,n),l=a=0,p=g.length;a<p;a++)if(i.indexOf(u=g.charAt(a))<0){if("."==u){if(a>l){l=p;continue}}else if(!c&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){c=!0,a=-1,l=0;continue}return v(N,String(e),h,n)}h=!1,(l=(g=O(g,n,10,N.s)).indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(a=0;48===g.charCodeAt(a);a++);for(p=g.length;48===g.charCodeAt(--p););if(g=g.slice(a,++p)){if(p-=a,h&&V.DEBUG&&p>15&&(e>f||e!==r(e)))throw Error(o+N.s*e);if((l=l-a-1)>P)N.c=N.e=null;else if(l<x)N.c=[N.e=0];else{if(N.e=l,N.c=[],a=(l+1)%s,l<0&&(a+=s),a<p){for(a&&N.c.push(+g.slice(0,a)),p-=s;a<p;)N.c.push(+g.slice(a,a+=s));a=s-(g=g.slice(a)).length}else a-=p;for(;a--;g+="0");N.c.push(+g)}}else N.c=[N.e=0]}function J(e,t,n,r){var i,o,u,s,f;if(null==n?n=F:m(n,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==t)f=p(e.c),f=1==r||2==r&&(u<=I||u>=M)?b(f,u):w(f,u,"0");else if(o=(e=$(new V(e),t,n)).e,s=(f=p(e.c)).length,1==r||2==r&&(t<=o||o<=I)){for(;s<t;f+="0",s++);f=b(f,o)}else if(t-=u,f=w(f,o,"0"),o+1>s){if(--t>0)for(f+=".";t--;f+="0");}else if((t+=o-s)>0)for(o+1==s&&(f+=".");t--;f+="0");return e.s<0&&i?"-"+f:f}function k(e,t){for(var n,r,i=1,o=new V(e[0]);i<e.length;i++)(!(r=new V(e[i])).s||(n=g(o,r))===t||0===n&&o.s===t)&&(o=r);return o}function z(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*s-1)>P?e.c=e.e=null:n<x?e.c=[e.e=0]:(e.e=n,e.c=t),e}function $(e,t,i,o){var f,l,a,h,p,g,m,N=e.c,b=c;if(N){e:{for(f=1,h=N[0];h>=10;h/=10,f++);if((l=t-f)<0)l+=s,a=t,p=N[g=0],m=r(p/b[f-a-1]%10);else if((g=n((l+1)/s))>=N.length){if(!o)break e;for(;N.length<=g;N.push(0));p=m=0,f=1,a=(l%=s)-s+1}else{for(p=h=N[g],f=1;h>=10;h/=10,f++);m=(a=(l%=s)-s+f)<0?0:r(p/b[f-a-1]%10)}if(o=o||t<0||null!=N[g+1]||(a<0?p:p%b[f-a-1]),o=i<4?(m||o)&&(0==i||i==(e.s<0?3:2)):m>5||5==m&&(4==i||o||6==i&&(l>0?a>0?p/b[f-a]:0:N[g-1])%10&1||i==(e.s<0?8:7)),t<1||!N[0])return N.length=0,o?(t-=e.e+1,N[0]=b[(s-t%s)%s],e.e=-t||0):N[0]=e.e=0,e;if(0==l?(N.length=g,h=1,g--):(N.length=g+1,h=b[s-l],N[g]=a>0?r(p/b[f-a]%b[a])*h:0),o)for(;;){if(0==g){for(l=1,a=N[0];a>=10;a/=10,l++);for(a=N[0]+=h,h=1;a>=10;a/=10,h++);l!=h&&(e.e++,N[0]==u&&(N[0]=1));break}if(N[g]+=h,N[g]!=u)break;N[g--]=0,h=1}for(l=N.length;0===N[--l];N.pop());}e.e>P?e.c=e.e=null:e.e<x&&(e.c=[e.e=0])}return e}function W(e){var t,n=e.e;return null===n?e.toString():(t=p(e.c),t=n<=I||n>=M?b(t,n):w(t,n,"0"),e.s<0?"-"+t:t)}return V.clone=e,V.ROUND_UP=0,V.ROUND_DOWN=1,V.ROUND_CEIL=2,V.ROUND_FLOOR=3,V.ROUND_HALF_UP=4,V.ROUND_HALF_DOWN=5,V.ROUND_HALF_EVEN=6,V.ROUND_HALF_CEIL=7,V.ROUND_HALF_FLOOR=8,V.EUCLID=9,V.config=V.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(i+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(m(n=e[t],0,a,t),S=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(m(n=e[t],0,8,t),F=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(m(n[0],-a,0,t),m(n[1],0,a,t),I=n[0],M=n[1]):(m(n,-a,a,t),I=-(M=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)m(n[0],-a,-1,t),m(n[1],1,a,t),x=n[0],P=n[1];else{if(m(n,-a,a,t),!n)throw Error(i+t+" cannot be zero: "+n);x=-(P=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(i+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw T=!n,Error(i+"crypto unavailable");T=n}else T=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(m(n=e[t],0,9,t),C=n),e.hasOwnProperty(t="POW_PRECISION")&&(m(n=e[t],0,a,t),G=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(i+t+" not an object: "+n);j=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(i+t+" invalid: "+n);H="0123456789"==n.slice(0,10),q=n}}return{DECIMAL_PLACES:S,ROUNDING_MODE:F,EXPONENTIAL_AT:[I,M],RANGE:[x,P],CRYPTO:T,MODULO_MODE:C,POW_PRECISION:G,FORMAT:j,ALPHABET:q}},V.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!V.DEBUG)return!0;var t,n,o=e.c,f=e.e,c=e.s;e:if("[object Array]"=={}.toString.call(o)){if((1===c||-1===c)&&f>=-a&&f<=a&&f===r(f)){if(0===o[0]){if(0===f&&1===o.length)return!0;break e}if((t=(f+1)%s)<1&&(t+=s),String(o[0]).length==t){for(t=0;t<o.length;t++)if((n=o[t])<0||n>=u||n!==r(n))break e;if(0!==n)return!0}}}else if(null===o&&null===f&&(null===c||1===c||-1===c))return!0;throw Error(i+"Invalid BigNumber: "+e)},V.maximum=V.max=function(){return k(arguments,-1)},V.minimum=V.min=function(){return k(arguments,1)},V.random=(E=9007199254740992*Math.random()&2097151?function(){return r(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,o,u,f,l,h=0,p=[],g=new V(B);if(null==e?e=S:m(e,0,a),f=n(e/s),T)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(f*=2));h<f;)(l=131072*t[h]+(t[h+1]>>>11))>=9e15?(o=crypto.getRandomValues(new Uint32Array(2)),t[h]=o[0],t[h+1]=o[1]):(p.push(l%1e14),h+=2);h=f/2}else{if(!crypto.randomBytes)throw T=!1,Error(i+"crypto unavailable");for(t=crypto.randomBytes(f*=7);h<f;)(l=281474976710656*(31&t[h])+1099511627776*t[h+1]+4294967296*t[h+2]+16777216*t[h+3]+(t[h+4]<<16)+(t[h+5]<<8)+t[h+6])>=9e15?crypto.randomBytes(7).copy(t,h):(p.push(l%1e14),h+=7);h=f/7}if(!T)for(;h<f;)(l=E())<9e15&&(p[h++]=l%1e14);for(f=p[--h],e%=s,f&&e&&(l=c[s-e],p[h]=r(f/l)*l);0===p[h];p.pop(),h--);if(h<0)p=[u=0];else{for(u=-1;0===p[0];p.splice(0,1),u-=s);for(h=1,l=p[0];l>=10;l/=10,h++);h<s&&(u-=s-h)}return g.e=u,g.c=p,g}),V.sum=function(){for(var e=1,t=arguments,n=new V(t[0]);e<t.length;)n=n.plus(t[e++]);return n},O=function(){function e(e,t,n,r){for(var i,o,u=[0],s=0,f=e.length;s<f;){for(o=u.length;o--;u[o]*=t);for(u[0]+=r.indexOf(e.charAt(s++)),i=0;i<u.length;i++)u[i]>n-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/n|0,u[i]%=n)}return u.reverse()}return function(t,n,r,i,o){var u,s,f,c,l,a,h,g,m=t.indexOf("."),N=S,b=F;for(m>=0&&(c=G,G=0,t=t.replace(".",""),a=(g=new V(n)).pow(t.length-m),G=c,g.c=e(w(p(a.c),a.e,"0"),10,r,"0123456789"),g.e=g.c.length),f=c=(h=e(t,n,r,o?(u=q,"0123456789"):(u="0123456789",q))).length;0==h[--c];h.pop());if(!h[0])return u.charAt(0);if(m<0?--f:(a.c=h,a.e=f,a.s=i,h=(a=y(a,g,N,b,r)).c,l=a.r,f=a.e),m=h[s=f+N+1],c=r/2,l=l||s<0||null!=h[s+1],l=b<4?(null!=m||l)&&(0==b||b==(a.s<0?3:2)):m>c||m==c&&(4==b||l||6==b&&1&h[s-1]||b==(a.s<0?8:7)),s<1||!h[0])t=l?w(u.charAt(1),-N,u.charAt(0)):u.charAt(0);else{if(h.length=s,l)for(--r;++h[--s]>r;)h[s]=0,s||(++f,h=[1].concat(h));for(c=h.length;!h[--c];);for(m=0,t="";m<=c;t+=u.charAt(h[m++]));t=w(t,f,u.charAt(0))}return t}}(),y=function(){function e(e,t,n){var r,i,o,u,s=0,f=e.length,c=t%l,a=t/l|0;for(e=e.slice();f--;)s=((i=c*(o=e[f]%l)+(r=a*o+(u=e[f]/l|0)*c)%l*l+s)/n|0)+(r/l|0)+a*u,e[f]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,o,f,c,l){var a,p,g,m,N,b,w,d,y,O,v,E,A,_,U,R,D,L=i.s==o.s?1:-1,B=i.c,S=o.c;if(!(B&&B[0]&&S&&S[0]))return new V(i.s&&o.s&&(B?!S||B[0]!=S[0]:S)?B&&0==B[0]||!S?0*L:L/0:NaN);for(y=(d=new V(L)).c=[],L=f+(p=i.e-o.e)+1,l||(l=u,p=h(i.e/s)-h(o.e/s),L=L/s|0),g=0;S[g]==(B[g]||0);g++);if(S[g]>(B[g]||0)&&p--,L<0)y.push(1),m=!0;else{for(_=B.length,R=S.length,g=0,L+=2,(N=r(l/(S[0]+1)))>1&&(S=e(S,N,l),B=e(B,N,l),R=S.length,_=B.length),A=R,v=(O=B.slice(0,R)).length;v<R;O[v++]=0);D=S.slice(),D=[0].concat(D),U=S[0],S[1]>=l/2&&U++;do{if(N=0,(a=t(S,O,R,v))<0){if(E=O[0],R!=v&&(E=E*l+(O[1]||0)),(N=r(E/U))>1)for(N>=l&&(N=l-1),w=(b=e(S,N,l)).length,v=O.length;1==t(b,O,w,v);)N--,n(b,R<w?D:S,w,l),w=b.length,a=1;else 0==N&&(a=N=1),w=(b=S.slice()).length;if(w<v&&(b=[0].concat(b)),n(O,b,v,l),v=O.length,-1==a)for(;t(S,O,R,v)<1;)N++,n(O,R<v?D:S,v,l),v=O.length}else 0===a&&(N++,O=[0]);y[g++]=N,O[0]?O[v++]=B[A]||0:(O=[B[A]],v=1)}while((A++<_||null!=O[0])&&L--);m=null!=O[0],y[0]||y.splice(0,1)}if(l==u){for(g=1,L=y[0];L>=10;L/=10,g++);$(d,f+(d.e=g+p*s-1)+1,c,m)}else d.e=p,d.r=+m;return d}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,_=/^([^.]+)\.$/,U=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,D=/^\s*\+(?=[\w.])|^\s+|\s+$/g,v=function(e,t,n,r){var o,u=n?t:t.replace(D,"");if(R.test(u))e.s=isNaN(u)?null:u<0?-1:1;else{if(!n&&(u=u.replace(A,function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t}),r&&(o=r,u=u.replace(_,"$1").replace(U,"0.$1")),t!=u))return new V(u,o);if(V.DEBUG)throw Error(i+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},L.absoluteValue=L.abs=function(){var e=new V(this);return e.s<0&&(e.s=1),e},L.comparedTo=function(e,t){return g(this,new V(e,t))},L.decimalPlaces=L.dp=function(e,t){var n,r,i,o=this;if(null!=e)return m(e,0,a),null==t?t=F:m(t,0,8),$(new V(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-h(this.e/s))*s,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},L.dividedBy=L.div=function(e,t){return y(this,new V(e,t),S,F)},L.dividedToIntegerBy=L.idiv=function(e,t){return y(this,new V(e,t),0,1)},L.exponentiatedBy=L.pow=function(e,t){var o,u,f,c,l,a,h,p,g=this;if((e=new V(e)).c&&!e.isInteger())throw Error(i+"Exponent not an integer: "+W(e));if(null!=t&&(t=new V(t)),l=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return p=new V(Math.pow(+W(g),l?e.s*(2-N(e)):+W(e))),t?p.mod(t):p;if(a=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new V(NaN);(u=!a&&g.isInteger()&&t.isInteger())&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||l&&g.c[1]>=24e7:g.c[0]<8e13||l&&g.c[0]<=9999975e7)))return c=g.s<0&&N(e)?-0:0,g.e>-1&&(c=1/c),new V(a?1/c:c);G&&(c=n(G/s+2))}for(l?(o=new V(.5),a&&(e.s=1),h=N(e)):h=(f=Math.abs(+W(e)))%2,p=new V(B);;){if(h){if(!(p=p.times(g)).c)break;c?p.c.length>c&&(p.c.length=c):u&&(p=p.mod(t))}if(f){if(0===(f=r(f/2)))break;h=f%2}else if($(e=e.times(o),e.e+1,1),e.e>14)h=N(e);else{if(0==(f=+W(e)))break;h=f%2}g=g.times(g),c?g.c&&g.c.length>c&&(g.c.length=c):u&&(g=g.mod(t))}return u?p:(a&&(p=B.div(p)),t?p.mod(t):c?$(p,G,F,void 0):p)},L.integerValue=function(e){var t=new V(this);return null==e?e=F:m(e,0,8),$(t,t.e+1,e)},L.isEqualTo=L.eq=function(e,t){return 0===g(this,new V(e,t))},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(e,t){return g(this,new V(e,t))>0},L.isGreaterThanOrEqualTo=L.gte=function(e,t){return 1===(t=g(this,new V(e,t)))||0===t},L.isInteger=function(){return!!this.c&&h(this.e/s)>this.c.length-2},L.isLessThan=L.lt=function(e,t){return g(this,new V(e,t))<0},L.isLessThanOrEqualTo=L.lte=function(e,t){return-1===(t=g(this,new V(e,t)))||0===t},L.isNaN=function(){return!this.s},L.isNegative=function(){return this.s<0},L.isPositive=function(){return this.s>0},L.isZero=function(){return!!this.c&&0==this.c[0]},L.minus=function(e,t){var n,r,i,o,f=this,c=f.s;if(t=(e=new V(e,t)).s,!c||!t)return new V(NaN);if(c!=t)return e.s=-t,f.plus(e);var l=f.e/s,a=e.e/s,p=f.c,g=e.c;if(!l||!a){if(!p||!g)return p?(e.s=-t,e):new V(g?f:NaN);if(!p[0]||!g[0])return g[0]?(e.s=-t,e):new V(p[0]?f:3==F?-0:0)}if(l=h(l),a=h(a),p=p.slice(),c=l-a){for((o=c<0)?(c=-c,i=p):(a=l,i=g),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(o=(c=p.length)<(t=g.length))?c:t,c=t=0;t<r;t++)if(p[t]!=g[t]){o=p[t]<g[t];break}if(o&&(i=p,p=g,g=i,e.s=-e.s),(t=(r=g.length)-(n=p.length))>0)for(;t--;p[n++]=0);for(t=u-1;r>c;){if(p[--r]<g[r]){for(n=r;n&&!p[--n];p[n]=t);--p[n],p[r]+=u}p[r]-=g[r]}for(;0==p[0];p.splice(0,1),--a);return p[0]?z(e,p,a):(e.s=3==F?-1:1,e.c=[e.e=0],e)},L.modulo=L.mod=function(e,t){var n,r,i=this;return e=new V(e,t),!i.c||!e.s||e.c&&!e.c[0]?new V(NaN):!e.c||i.c&&!i.c[0]?new V(i):(9==C?(r=e.s,e.s=1,n=y(i,e,0,3),e.s=r,n.s*=r):n=y(i,e,0,C),(e=i.minus(n.times(e))).c[0]||1!=C||(e.s=i.s),e)},L.multipliedBy=L.times=function(e,t){var n,r,i,o,f,c,a,p,g,m,N,b,w,d,y,O=this,v=O.c,E=(e=new V(e,t)).c;if(!(v&&E&&v[0]&&E[0]))return!O.s||!e.s||v&&!v[0]&&!E||E&&!E[0]&&!v?e.c=e.e=e.s=null:(e.s*=O.s,v&&E?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=h(O.e/s)+h(e.e/s),e.s*=O.s,(a=v.length)<(m=E.length)&&(w=v,v=E,E=w,i=a,a=m,m=i),i=a+m,w=[];i--;w.push(0));for(d=u,y=l,i=m;--i>=0;){for(n=0,N=E[i]%y,b=E[i]/y|0,o=i+(f=a);o>i;)n=((p=N*(p=v[--f]%y)+(c=b*p+(g=v[f]/y|0)*N)%y*y+w[o]+n)/d|0)+(c/y|0)+b*g,w[o--]=p%d;w[o]=n}return n?++r:w.splice(0,1),z(e,w,r)},L.negated=function(){var e=new V(this);return e.s=-e.s||null,e},L.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new V(e,t)).s,!i||!t)return new V(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/s,f=e.e/s,c=r.c,l=e.c;if(!o||!f){if(!c||!l)return new V(i/0);if(!c[0]||!l[0])return l[0]?e:new V(c[0]?r:0*i)}if(o=h(o),f=h(f),c=c.slice(),i=o-f){for(i>0?(f=o,n=l):(i=-i,n=c),n.reverse();i--;n.push(0));n.reverse()}for((i=c.length)-(t=l.length)<0&&(n=l,l=c,c=n,t=i),i=0;t;)i=(c[--t]=c[t]+l[t]+i)/u|0,c[t]=u===c[t]?0:c[t]%u;return i&&(c=[i].concat(c),++f),z(e,c,f)},L.precision=L.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return m(e,1,a),null==t?t=F:m(t,0,8),$(new V(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*s+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},L.shiftedBy=function(e){return m(e,-f,f),this.times("1e"+e)},L.squareRoot=L.sqrt=function(){var e,t,n,r,i,o=this,u=o.c,s=o.s,f=o.e,c=S+4,l=new V("0.5");if(1!==s||!u||!u[0])return new V(!s||s<0&&(!u||u[0])?NaN:u?o:1/0);if(0==(s=Math.sqrt(+W(o)))||s==1/0?(((t=p(u)).length+f)%2==0&&(t+="0"),s=Math.sqrt(+t),f=h((f+1)/2)-(f<0||f%2),n=new V(t=s==1/0?"5e"+f:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+f)):n=new V(s+""),n.c[0])for((s=(f=n.e)+c)<3&&(s=0);;)if(i=n,n=l.times(i.plus(y(o,i,c,1))),p(i.c).slice(0,s)===(t=p(n.c)).slice(0,s)){if(n.e<f&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(r||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||($(n,n.e+S+2,1),e=!n.times(n).eq(o));break}if(!r&&($(i,i.e+S+2,0),i.times(i).eq(o))){n=i;break}c+=4,s+=4,r=1}return $(n,n.e+S+1,F,e)},L.toExponential=function(e,t){return null!=e&&(m(e,0,a),e++),J(this,e,t,1)},L.toFixed=function(e,t){return null!=e&&(m(e,0,a),e=e+this.e+1),J(this,e,t)},L.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=j;else if("object"!=typeof n)throw Error(i+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var u,s=r.split("."),f=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||"",a=s[0],h=s[1],p=o.s<0,g=p?a.slice(1):a,m=g.length;if(c&&(u=f,f=c,c=u,m-=u),f>0&&m>0){for(u=m%f||f,a=g.substr(0,u);u<m;u+=f)a+=l+g.substr(u,f);c>0&&(a+=l+g.slice(u)),p&&(a="-"+a)}r=h?a+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):a}return(n.prefix||"")+r+(n.suffix||"")},L.toFraction=function(e){var t,n,r,o,u,f,l,a,h,g,m,N,b=this,w=b.c;if(null!=e&&(!(l=new V(e)).isInteger()&&(l.c||1!==l.s)||l.lt(B)))throw Error(i+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+W(l));if(!w)return new V(b);for(t=new V(B),h=n=new V(B),r=a=new V(B),N=p(w),u=t.e=N.length-b.e-1,t.c[0]=c[(f=u%s)<0?s+f:f],e=!e||l.comparedTo(t)>0?u>0?t:h:l,f=P,P=1/0,l=new V(N),a.c[0]=0;g=y(l,t,0,1),1!=(o=n.plus(g.times(r))).comparedTo(e);)n=r,r=o,h=a.plus(g.times(o=h)),a=o,t=l.minus(g.times(o=t)),l=o;return o=y(e.minus(n),r,0,1),a=a.plus(o.times(h)),n=n.plus(o.times(r)),a.s=h.s=b.s,m=y(h,r,u*=2,F).minus(b).abs().comparedTo(y(a,n,u,F).minus(b).abs())<1?[h,r]:[a,n],P=f,m},L.toNumber=function(){return+W(this)},L.toPrecision=function(e,t){return null!=e&&m(e,1,a),J(this,e,t,2)},L.toString=function(e){var t,n=this,r=n.s,i=n.e;return null===i?r?(t="Infinity",r<0&&(t="-"+t)):t="NaN":(null==e?t=i<=I||i>=M?b(p(n.c),i):w(p(n.c),i,"0"):10===e&&H?t=w(p((n=$(new V(n),S+i+1,F)).c),n.e,"0"):(m(e,2,q.length,"Base"),t=O(w(p(n.c),i,"0"),10,e,r,!0)),r<0&&n.c[0]&&(t="-"+t)),t},L.valueOf=L.toJSON=function(){return W(this)},L._isBigNumber=!0,L[Symbol.toStringTag]="BigNumber",L[Symbol.for("nodejs.util.inspect.custom")]=L.valueOf,null!=d&&V.set(d),V}(),y=function(){return(y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},O=function(){function e(){this.format=e.DEFAULT_FORMAT,d.config({FORMAT:this.format})}return e.prototype.set=function(e){"FORMAT"in e&&(this.format=y(y({},this.format),e.FORMAT),e.FORMAT=this.format),d.config(e)},e.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},e}();e.BigNumber=function(){function e(t){"object"==typeof t&&e.isBigNumber(t)?this.bn=t.bn.plus(0):this.bn=e.toBigNumberJs(t)}return e.prototype.clone=function(){return new e(this)},e.prototype.add=function(t){return new e(this.bn.plus(e.toBigNumberJs(t)))},e.prototype.sub=function(t){return new e(this.bn.minus(e.toBigNumberJs(t)))},e.prototype.mul=function(t){return new e(this.bn.times(e.toBigNumberJs(t)))},e.prototype.div=function(t){return new e(this.bn.div(e.toBigNumberJs(t)))},e.prototype.pow=function(t){return new e(this.bn.pow(e.toBigNumberJs(t)))},e.prototype.sqrt=function(){return new e(this.bn.sqrt())},e.prototype.abs=function(){return new e(this.bn.abs())},e.prototype.mod=function(t){return new e(this.bn.mod(e.toBigNumberJs(t)))},e.prototype.roundTo=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=4),new e(this.bn.dp(t||0,n))},e.prototype.eq=function(t){return this.bn.eq(e.toBigNumberJs(t))},e.prototype.lt=function(t){return this.bn.lt(e.toBigNumberJs(t))},e.prototype.gt=function(t){return this.bn.gt(e.toBigNumberJs(t))},e.prototype.lte=function(t){return this.bn.lte(e.toBigNumberJs(t))},e.prototype.gte=function(t){return this.bn.gte(e.toBigNumberJs(t))},e.prototype.isNaN=function(){return this.bn.isNaN()},e.prototype.isFinite=function(){return this.bn.isFinite()},e.prototype.isZero=function(){return this.eq(0)},e.prototype.isPositive=function(){return this.gt(0)},e.prototype.isNegative=function(){return this.lt(0)},e.prototype.isInt=function(){return this.bn.isInteger()},e.prototype.getDecimalsCount=function(){return this.bn.dp()},e.prototype.isEven=function(){return this.mod(2).eq(0)},e.prototype.isOdd=function(){return!this.isEven()},e.prototype.isInSignedRange=function(){return this.gte(e.MIN_VALUE)&&this.lte(e.MAX_VALUE)},e.prototype.isInUnsignedRange=function(){return this.gte(e.MIN_UNSIGNED_VALUE)&&this.lte(e.MAX_UNSIGNED_VALUE)},e.prototype.toFormat=function(e,t,n){return this.bn.toFormat(e,t,n)},e.prototype.toFixed=function(e,t){return null==e?this.bn.toFixed():this.bn.toFixed(e,t)},e.prototype.toString=function(e){return e?this.bn.toString(e):this.toFixed()},e.prototype.toNumber=function(){return this.bn.toNumber()},e.prototype.toJSON=function(){return this.bn.toFixed()},e.prototype.valueOf=function(){return this.bn.valueOf()},e.prototype.toBytes=function(t){var n=void 0===t?{}:t,r=n.isSigned,i=void 0===r||r,o=n.isLong,u=void 0===o||o;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!i&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(u&&i&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(u&&!i&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var s=i&&this.isNegative(),f=s?"1":"0",c=this.bn.plus(f).toString(2).replace("-",""),l=u?64:8*Math.ceil(c.length/8),a=e._toLength(l,c).split(""),h=[];do{h.push(parseInt(a.splice(0,8).join(""),2))}while(a.length);return s?Uint8Array.from(h.map(function(e){return 255-e})):Uint8Array.from(h)},e.fromBytes=function(t,n){var r=void 0===n?{}:n,i=r.isSigned,o=void 0===i||i,u=r.isLong,s=void 0===u||u;if(s&&8!==t.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");t=!s&&t.length>0||s?t:[0];var f=!!o&&t[0]>127,c=Array.from(t).map(function(e){return f?255-e:e}).map(function(t){return e._toLength(8,t.toString(2))}).join(""),l=new e(new d(c,2));return f?l.mul(-1).sub(1):l},e.max=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.toBigNumber(t).reduce(function(e,t){return e.gte(t)?e:t})},e.min=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.toBigNumber(t).reduce(function(e,t){return e.lte(t)?e:t})},e.sum=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.toBigNumber(t).reduce(function(e,t){return e.add(t)})},e.isBigNumber=function(t){return t&&"object"==typeof t&&(t instanceof e||Object.entries(e.prototype).filter(function(e){return"_"!==e[0].charAt(0)}).every(function(e){var n=e[0],r=e[1];return n in t&&typeof r==typeof t[n]}))},e.toBigNumber=function(t){return Array.isArray(t)?t.map(function(t){return new e(t)}):new e(t)},e.toBigNumberJs=function(t){return d.isBigNumber(t)?t:t instanceof e?t.bn:new d(t)},e._toLength=function(e,t){return new Array(e).fill("0",0,e).concat(t.split("")).slice(-e).join("")},e.MIN_VALUE=new e("-9223372036854775808"),e.MAX_VALUE=new e("9223372036854775807"),e.MIN_UNSIGNED_VALUE=new e("0"),e.MAX_UNSIGNED_VALUE=new e("18446744073709551615"),e.config=new O,e}(),function(e){!function(e){e[e.ROUND_UP=0]="ROUND_UP",e[e.ROUND_DOWN=1]="ROUND_DOWN",e[e.ROUND_CEIL=2]="ROUND_CEIL",e[e.ROUND_FLOOR=3]="ROUND_FLOOR",e[e.ROUND_HALF_UP=4]="ROUND_HALF_UP",e[e.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",e[e.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",e[e.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",e[e.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(e.ROUND_MODE||(e.ROUND_MODE={}))}(e.BigNumber||(e.BigNumber={}));var v=e.BigNumber;e.default=v,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -17,2 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Config = void 0; | ||
var bignumber_js_1 = __importDefault(require("bignumber.js")); | ||
@@ -26,3 +27,3 @@ var Config = /** @class */ (function () { | ||
if ('FORMAT' in configPart) { | ||
this.format = __assign({}, this.format, configPart.FORMAT); | ||
this.format = __assign(__assign({}, this.format), configPart.FORMAT); | ||
configPart.FORMAT = this.format; | ||
@@ -29,0 +30,0 @@ } |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var BigNumber_1 = require("./BigNumber"); | ||
__export(require("./BigNumber")); | ||
__exportStar(require("./BigNumber"), exports); | ||
exports.default = BigNumber_1.BigNumber; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@waves/bignumber", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Waves Library for work with Bignumber in javascript", | ||
@@ -30,3 +30,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"bignumber.js": "^9.0.1" | ||
"bignumber.js": "^9.1.2" | ||
}, | ||
@@ -45,3 +45,3 @@ "devDependencies": { | ||
"tslib": "^1.9.3", | ||
"typescript": "^3.4.5" | ||
"typescript": "^3.9.10" | ||
}, | ||
@@ -48,0 +48,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160478
3123
1
Updatedbignumber.js@^9.1.2