@argent/x-shared 1.79.1 → 1.79.3
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/.ts-temp/tsconfig.tsbuildinfo +1 -1
- package/dist/node_modules/.pnpm/bignumber.js@10.0.2/node_modules/bignumber.js/dist/bignumber.cjs +1 -0
- package/dist/node_modules/.pnpm/bignumber.js@10.0.2/node_modules/bignumber.js/dist/bignumber.js +528 -0
- package/dist/src/chains/starknet/getAddressFromStarkName.cjs +1 -1
- package/dist/src/chains/starknet/getAddressFromStarkName.js +1 -1
- package/dist/src/features/paymaster/PaymasterService.cjs +1 -1
- package/dist/src/features/paymaster/PaymasterService.js +1 -1
- package/dist/src/utils/number/prettifyNumber.cjs +1 -1
- package/dist/src/utils/number/prettifyNumber.js +1 -1
- package/dist/src/utils/retryUntilInitialised.cjs +1 -1
- package/dist/src/utils/retryUntilInitialised.js +1 -1
- package/package.json +9 -8
- package/dist/.eslintrc.d.cts +0 -39
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs +0 -1
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js +0 -527
package/dist/node_modules/.pnpm/bignumber.js@10.0.2/node_modules/bignumber.js/dist/bignumber.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=d(),t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,r=Math.floor,i=`[BigNumber Error] `,a=0x5af3107a4000,o=14,s=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],l=1e7,u=1e9;function d(e){var y,b,x,S=F.prototype={constructor:F,toString:null,valueOf:null},C=new F(1),w=20,T=4,E=-7,D=21,O=-1e7,k=1e7,A=!1,j=1,M=0,N={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},P=`0123456789abcdefghijklmnopqrstuvwxyz`;function F(e,n){var r,a,s,c,l,u,d,f,p=this;if(!(p instanceof F))return new F(e,n);if(f=typeof e,n==null){if(L(e)){p.s=e.s,!e.c||e.e>k?p.c=p.e=null:e.e<O?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice());return}if(f==`number`){if(e*0!=0){p.s=isNaN(e)?null:e<0?-1:1,p.c=p.e=null;return}if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,l=e;l>=10;l/=10,c++);c>k?p.c=p.e=null:(p.e=c,p.c=[e]);return}d=String(e)}else{if(f==`string`){if(d=e,!t.test(d))return x(p,d)}else if(f==`bigint`)d=String(e);else throw Error(i+`Invalid argument: `+e);p.s=d.charCodeAt(0)==45?(d=d.slice(1),-1):1}(c=d.indexOf(`.`))>-1&&(d=d.replace(`.`,``)),(l=d.search(/e/i))>0?(c<0&&(c=l),c+=+d.slice(l+1),d=d.substring(0,l)):c<0&&(c=d.length)}else{if(f!=`string`)throw Error(i+`String expected: `+e);for(h(n,2,P.length,`Base`),d=e,p.s=d.charCodeAt(0)===45?(d=d.slice(1),-1):1,r=P.slice(0,n),c=l=0,u=d.length;l<u;l++)if(r.indexOf(a=d.charAt(l))<0){if(a==`.`){if(l>c){c=u;continue}}else if(!s&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){s=!0,l=-1,c=0;continue}return x(p,e,n)}d=b(d,n,10,p.s),(c=d.indexOf(`.`))>-1?d=d.replace(`.`,``):c=d.length}for(l=0;d.charCodeAt(l)===48;l++);for(u=d.length;d.charCodeAt(--u)===48;);if(d=d.slice(l,++u))if(u-=l,c=c-l-1,c>k)p.c=p.e=null;else if(c<O)p.c=[p.e=0];else{if(p.e=c,p.c=[],l=(c+1)%o,c<0&&(l+=o),l<u){for(l&&p.c.push(+d.slice(0,l)),u-=o;l<u;)p.c.push(+d.slice(l,l+=o));l=o-(d=d.slice(l)).length}else l-=u;for(;l--;d+=`0`);p.c.push(+d)}else p.c=[p.e=0]}F.clone=d,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(e){var t,n;if(e!=null)if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],h(n,0,u,t),w=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],h(n,0,8,t),T=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(h(n[0],-u,0,t),h(n[1],0,u,t),E=n[0],D=n[1]):(h(n,-u,u,t),E=-(D=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`))if(n=e[t],n&&n.pop)h(n[0],-u,-1,t),h(n[1],1,u,t),O=n[0],k=n[1];else if(h(n,-u,u,t),n)O=-(k=n<0?-n:n);else throw Error(i+t+` cannot be zero: `+n);if(e.hasOwnProperty(t=`CRYPTO`))if(n=e[t],n===!!n)if(n)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))A=n;else throw A=!n,Error(i+`crypto unavailable`);else A=n;else throw Error(i+t+` not true or false: `+n);if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],h(n,0,9,t),j=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],h(n,0,u,t),M=n),e.hasOwnProperty(t=`FORMAT`))if(n=e[t],typeof n==`object`)N=n;else throw Error(i+t+` not an object: `+n);if(e.hasOwnProperty(t=`ALPHABET`))if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))P=n;else throw Error(i+t+` invalid: `+n)}else throw Error(i+`Object expected: `+e);return{DECIMAL_PLACES:w,ROUNDING_MODE:T,EXPONENTIAL_AT:[E,D],RANGE:[O,k],CRYPTO:A,MODULO_MODE:j,POW_PRECISION:M,FORMAT:N,ALPHABET:P}},F.isBigNumber=function(e){if(!L(e))return!1;var t,n,i=e.c,s=e.e,c=e.s;if({}.toString.call(i)!=`[object Array]`)return i===null&&s===null&&(c===null||c===1||c===-1);if(c!==1&&c!==-1||s<-u||s>u||s!==r(s))return!1;if(i[0]===0)return s===0&&i.length===1;if(t=(s+1)%o,t<1&&(t+=o),String(i[0]).length!==t)return!1;for(t=0;t<i.length;t++)if(n=i[t],n<0||n>=a||n!==r(n))return!1;return n!==0},F.maximum=F.max=function(){return R(arguments,-1)},F.minimum=F.min=function(){return R(arguments,1)},F.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return r(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var a,s,l,d,f,p=0,m=[],g=new F(C);if(e==null?e=w:h(e,0,u),d=n(e/o),A)if(crypto.getRandomValues){for(a=crypto.getRandomValues(new Uint32Array(d*=2));p<d;)f=a[p]*131072+(a[p+1]>>>11),f>=9e15?(s=crypto.getRandomValues(new Uint32Array(2)),a[p]=s[0],a[p+1]=s[1]):(m.push(f%0x5af3107a4000),p+=2);p=d/2}else if(crypto.randomBytes){for(a=crypto.randomBytes(d*=7);p<d;)f=(a[p]&31)*281474976710656+a[p+1]*1099511627776+a[p+2]*4294967296+a[p+3]*16777216+(a[p+4]<<16)+(a[p+5]<<8)+a[p+6],f>=9e15?crypto.randomBytes(7).copy(a,p):(m.push(f%0x5af3107a4000),p+=7);p=d/7}else throw A=!1,Error(i+`crypto unavailable`);if(!A)for(;p<d;)f=t(),f<9e15&&(m[p++]=f%0x5af3107a4000);for(d=m[--p],e%=o,d&&e&&(f=c[o-e],m[p]=r(d/f)*f);m[p]===0;m.pop(),p--);if(p<0)m=[l=0];else{for(l=-1;m[0]===0;m.splice(0,1),l-=o);for(p=1,f=m[0];f>=10;f/=10,p++);p<o&&(l-=o-p)}return g.e=l,g.c=m,g}})(),F.sum=function(){for(var e=1,t=arguments,n=new F(t[0]);e<t.length;)n=n.plus(t[e++]);return n},b=(function(){var e=`0123456789`;function t(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(n,r,i,a,o){var s,c,l,u,d,f,m,h,g=n.indexOf(`.`),_=w,b=T;for(g>=0&&(u=M,M=0,n=n.replace(`.`,``),h=new F(r),f=h.pow(n.length-g),M=u,h.c=t(v(p(f.c),f.e,`0`),10,i,e),h.e=h.c.length),m=t(n,r,i,o?(s=P,e):(s=e,P)),l=u=m.length;m[--u]==0;m.pop());if(!m[0])return s.charAt(0);if(g<0?--l:(f.c=m,f.e=l,f.s=a,f=y(f,h,_,b,i),m=f.c,d=f.r,l=f.e),c=l+_+1,g=m[c],u=i/2,d=d||c<0||m[c+1]!=null,d=b<4?(g!=null||d)&&(b==0||b==(f.s<0?3:2)):g>u||g==u&&(b==4||d||b==6&&m[c-1]&1||b==(f.s<0?8:7)),c<1||!m[0])n=d?v(s.charAt(1),-_,s.charAt(0)):s.charAt(0);else{if(m.length=c,d)for(--i;++m[--c]>i;)m[c]=0,c||(++l,m=[1].concat(m));for(u=m.length;!m[--u];);for(g=0,n=``;g<=u;n+=s.charAt(m[g++]));n=v(n,l,s.charAt(0))}return n}})(),y=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,u=t%l,d=t/l|0;for(e=e.slice();c--;)a=e[c]%l,o=e[c]/l|0,r=d*a+o*u,i=u*a+r%l*l+s,s=(i/n|0)+(r/l|0)+d*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}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,s,c,l,u){var d,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k=i.s==s.s?1:-1,A=i.c,j=s.c;if(!A||!A[0]||!j||!j[0])return new F(!i.s||!s.s||(A?j&&A[0]==j[0]:!j)?NaN:A&&A[0]==0||!j?k*0:k/0);for(y=new F(k),b=y.c=[],p=i.e-s.e,k=c+p+1,u||(u=a,p=f(i.e/o)-f(s.e/o),k=k/o|0),m=0;j[m]==(A[m]||0);m++);if(j[m]>(A[m]||0)&&p--,k<0)b.push(1),h=!0;else{for(T=A.length,D=j.length,m=0,k+=2,g=r(u/(j[0]+1)),g>1&&(j=e(j,g,u),A=e(A,g,u),D=j.length,T=A.length),w=D,x=A.slice(0,D),S=x.length;S<D;x[S++]=0);O=j.slice(),O=[0].concat(O),E=j[0],j[1]>=u/2&&E++;do{if(g=0,d=t(j,x,D,S),d<0){if(C=x[0],D!=S&&(C=C*u+(x[1]||0)),g=r(C/E),g>1)for(g>=u&&(g=u-1),_=e(j,g,u),v=_.length,S=x.length;t(_,x,v,S)==1;)g--,n(_,D<v?O:j,v,u),v=_.length,d=1;else g==0&&(d=g=1),_=j.slice(),v=_.length;if(v<S&&(_=[0].concat(_)),n(x,_,S,u),S=x.length,d==-1)for(;t(j,x,D,S)<1;)g++,n(x,D<S?O:j,S,u),S=x.length}else d===0&&(g++,x=[0]);b[m++]=g,x[0]?x[S++]=A[w]||0:(x=[A[w]],S=1)}while((w++<T||x[0]!=null)&&k--);h=x[0]!=null,b[0]||b.splice(0,1)}if(u==a){for(m=1,k=b[0];k>=10;k/=10,m++);B(y,c+(y.e=m+p*o-1)+1,l,h)}else y.e=p,y.r=+h;return y}})();function I(e,t,n,r){var i,a,o,s,c;if(n==null?n=T:h(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)c=p(e.c),c=r==1||r==2&&(o<=E||o>=D)?_(c,o):v(c,o,`0`);else if(e=B(new F(e),t,n),a=e.e,c=p(e.c),s=c.length,r==1||r==2&&(t<=a||a<=E)){for(;s<t;c+=`0`,s++);c=_(c,a)}else if(t-=o+(r===2&&a>o),c=v(c,a,`0`),a+1>s){if(--t>0)for(c+=`.`;t--;c+=`0`);}else if(t+=a-s,t>0)for(a+1==s&&(c+=`.`);t--;c+=`0`);return e.s<0&&i?`-`+c:c}function L(e){return e instanceof F||!!e&&e._isBigNumber===!0}function R(e,t){for(var n,r,i=1,a=new F(e[0]);i<e.length;i++)r=new F(e[i]),(!r.s||(n=m(a,r))===t||n===0&&a.s===t)&&(a=r);return a}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*o-1)>k?e.c=e.e=null:n<O?e.c=[e.e=0]:(e.e=n,e.c=t),e}x=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,a=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,c){var l,u=s.replace(a,``);if(r.test(u)){o.s=isNaN(u)?null:u<0?-1:1,o.c=o.e=null;return}if(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),s!=u)return new F(u,l);throw Error(i+`Not a`+(c?` base `+c:``)+` number: `+s)}})();function B(e,t,i,s){var l,u,d,f,p,m,h,g=e.c,_=c;if(g){out:{for(l=1,f=g[0];f>=10;f/=10,l++);if(u=t-l,u<0)u+=o,d=t,p=g[m=0],h=r(p/_[l-d-1]%10);else if(m=n((u+1)/o),m>=g.length)if(s){for(;g.length<=m;g.push(0));p=h=0,l=1,u%=o,d=u-o+1}else break out;else{for(p=f=g[m],l=1;f>=10;f/=10,l++);u%=o,d=u-o+l,h=d<0?0:r(p/_[l-d-1]%10)}if(s=s||t<0||g[m+1]!=null||(d<0?p:p%_[l-d-1]),s=i<4?(h||s)&&(i==0||i==(e.s<0?3:2)):h>5||h==5&&(i==4||s||i==6&&(u>0?d>0?p/_[l-d]:0:g[m-1])%10&1||i==(e.s<0?8:7)),t<1||!g[0])return g.length=0,s?(t-=e.e+1,g[0]=_[(o-t%o)%o],e.e=-t||0):g[0]=e.e=0,e;if(u==0?(g.length=m,f=1,m--):(g.length=m+1,f=_[o-u],g[m]=d>0?r(p/_[l-d]%_[d])*f:0),s)for(;;)if(m==0){for(u=1,d=g[0];d>=10;d/=10,u++);for(d=g[0]+=f,f=1;d>=10;d/=10,f++);u!=f&&(e.e++,g[0]==a&&(g[0]=1));break}else{if(g[m]+=f,g[m]!=a)break;g[m--]=0,f=1}for(u=g.length;g[--u]===0;g.pop());}e.e>k?e.c=e.e=null:e.e<O&&(e.c=[e.e=0])}return e}function V(e){var t,n=e.e;return n===null?e.toString():(t=p(e.c),t=n<=E||n>=D?_(t,n):v(t,n,`0`),e.s<0?`-`+t:t)}return S.absoluteValue=S.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},S.comparedTo=function(e,t){return m(this,new F(e,t))},S.decimalPlaces=S.dp=function(e,t){var n,r,i,a=this;if(e!=null)return h(e,0,u),t==null?t=T:h(t,0,8),B(new F(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-f(this.e/o))*o,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},S.dividedBy=S.div=function(e,t){return y(this,new F(e,t),w,T)},S.dividedToIntegerBy=S.idiv=function(e,t){return y(this,new F(e,t),0,1)},S.exponentiatedBy=S.pow=function(e,t){var a,s,c,l,u,d,f,p,m,h=this;if(e=new F(e),e.c&&!e.isInteger())throw Error(i+`Exponent not an integer: `+V(e));if(t!=null&&(t=new F(t)),d=e.e>14,!h.c||!h.c[0]||h.c[0]==1&&!h.e&&h.c.length==1||!e.c||!e.c[0])return m=new F(V(h)**(d?e.s*(2-g(e)):+V(e))),t?m.mod(t):m;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new F(NaN);s=!f&&h.isInteger()&&t.isInteger(),s&&(h=h.mod(t))}else if(e.e>9&&(h.e>0||h.e<-1||(h.e==0?h.c[0]>1||d&&h.c[1]>=24e7:h.c[0]<8e13||d&&h.c[0]<=9999975e7)))return l=h.s<0&&g(e)?-0:0,h.e>-1&&(l=1/l),new F(f?1/l:l);else M&&(l=n(M/o+2));for(d?(a=new F(.5),f&&(e.s=1),p=g(e)):(c=Math.abs(+V(e)),p=c%2),m=new F(C);;){if(p){if(m=m.times(h),!m.c)break;l?m.c.length>l&&(m.c.length=l):s&&(m=m.mod(t))}if(c){if(c=r(c/2),c===0)break;p=c%2}else if(e=e.times(a),B(e,e.e+1,1),e.e>14)p=g(e);else{if(c=+V(e),c===0)break;p=c%2}h=h.times(h),l?h.c&&h.c.length>l&&(h.c.length=l):s&&(h=h.mod(t))}return s?m:(f&&(m=C.div(m)),t?m.mod(t):l?B(m,M,T,u):m)},S.integerValue=function(e){var t=new F(this);return e==null?e=T:h(e,0,8),B(t,t.e+1,e)},S.isEqualTo=S.eq=function(e,t){return m(this,new F(e,t))===0},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(e,t){return m(this,new F(e,t))>0},S.isGreaterThanOrEqualTo=S.gte=function(e,t){return(t=m(this,new F(e,t)))===1||t===0},S.isInteger=function(){return!!this.c&&f(this.e/o)>this.c.length-2},S.isLessThan=S.lt=function(e,t){return m(this,new F(e,t))<0},S.isLessThanOrEqualTo=S.lte=function(e,t){return(t=m(this,new F(e,t)))===-1||t===0},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&this.c[0]==0},S.minus=function(e,t){var n,r,i,s,c=this,l=c.s;if(e=new F(e,t),t=e.s,!l||!t)return new F(NaN);if(l!=t)return e.s=-t,c.plus(e);var u=c.e/o,d=e.e/o,p=c.c,m=e.c;if(!u||!d){if(!p||!m)return p?(e.s=-t,e):new F(m?c:NaN);if(!p[0]||!m[0])return m[0]?(e.s=-t,e):new F(p[0]?c:T==3?-0:0)}if(u=f(u),d=f(d),p=p.slice(),l=u-d){for((s=l<0)?(l=-l,i=p):(d=u,i=m),i.reverse(),t=l;t--;i.push(0));i.reverse()}else for(r=(s=(l=p.length)<(t=m.length))?l:t,l=t=0;t<r;t++)if(p[t]!=m[t]){s=p[t]<m[t];break}if(s&&(i=p,p=m,m=i,e.s=-e.s),t=(r=m.length)-(n=p.length),t>0)for(;t--;p[n++]=0);for(t=a-1;r>l;){if(p[--r]<m[r]){for(n=r;n&&!p[--n];p[n]=t);--p[n],p[r]+=a}p[r]-=m[r]}for(;p[0]==0;p.splice(0,1),--d);return p[0]?z(e,p,d):(e.s=T==3?-1:1,e.c=[e.e=0],e)},S.modulo=S.mod=function(e,t){var n,r,i=this;return e=new F(e,t),!i.c||!e.s||e.c&&!e.c[0]?new F(NaN):!e.c||i.c&&!i.c[0]?new F(i):(j==9?(r=e.s,e.s=1,n=y(i,e,0,3),e.s=r,n.s*=r):n=y(i,e,0,j),e=i.minus(n.times(e)),!e.c[0]&&j==1&&(e.s=i.s),e)},S.multipliedBy=S.times=function(e,t){var n,r,i,s,c,u,d,p,m,h,g,_,v,y,b,x=this,S=x.c,C=(e=new F(e,t)).c;if(!S||!C||!S[0]||!C[0])return!x.s||!e.s||S&&!S[0]&&!C||C&&!C[0]&&!S?e.c=e.e=e.s=null:(e.s*=x.s,!S||!C?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=f(x.e/o)+f(e.e/o),e.s*=x.s,d=S.length,h=C.length,d<h&&(v=S,S=C,C=v,i=d,d=h,h=i),i=d+h,v=[];i--;v.push(0));for(y=a,b=l,i=h;--i>=0;){for(n=0,g=C[i]%b,_=C[i]/b|0,c=d,s=i+c;s>i;)p=S[--c]%b,m=S[c]/b|0,u=_*p+m*g,p=g*p+u%b*b+v[s]+n,n=(p/y|0)+(u/b|0)+_*m,v[s--]=p%y;v[s]=n}return n?++r:v.splice(0,1),z(e,v,r)},S.negated=function(){var e=new F(this);return e.s=-e.s||null,e},S.plus=function(e,t){var n,r=this,i=r.s;if(e=new F(e,t),t=e.s,!i||!t)return new F(NaN);if(i!=t)return e.s=-t,r.minus(e);var s=r.e/o,c=e.e/o,l=r.c,u=e.c;if(!s||!c){if(!l||!u)return new F(i/0);if(!l[0]||!u[0])return u[0]?e:new F(l[0]?r:i*0)}if(s=f(s),c=f(c),l=l.slice(),i=s-c){for(i>0?(c=s,n=u):(i=-i,n=l),n.reverse();i--;n.push(0));n.reverse()}for(i=l.length,t=u.length,i-t<0&&(n=u,u=l,l=n,t=i),i=0;t;)i=(l[--t]=l[t]+u[t]+i)/a|0,l[t]=a===l[t]?0:l[t]%a;return i&&(l=[i].concat(l),++c),z(e,l,c)},S.precision=S.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return h(e,1,u),t==null?t=T:h(t,0,8),B(new F(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*o+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},S.shiftedBy=function(e){return h(e,-s,s),this.times(`1e`+e)},S.squareRoot=S.sqrt=function(){var e,t,n,r,i,a=this,o=a.c,s=a.s,c=a.e,l=w+4,u=new F(`0.5`);if(s!==1||!o||!o[0])return new F(!s||s<0&&(!o||o[0])?NaN:o?a:1/0);if(s=Math.sqrt(+V(a)),s==0||s==1/0?(t=p(o),(t.length+c)%2==0&&(t+=`0`),s=Math.sqrt(+t),c=f((c+1)/2)-(c<0||c%2),s==1/0?t=`5e`+c:(t=s.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+c),n=new F(t)):n=new F(s+``),n.c[0]){for(c=n.e,s=c+l,s<3&&(s=0);;)if(i=n,n=u.times(i.plus(y(a,i,l,1))),p(i.c).slice(0,s)===(t=p(n.c)).slice(0,s))if(n.e<c&&--s,t=t.slice(s-3,s+1),t==`9999`||!r&&t==`4999`){if(!r&&(B(i,i.e+w+2,0),i.times(i).eq(a))){n=i;break}l+=4,s+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)==`5`)&&(B(n,n.e+w+2,1),e=!n.times(n).eq(a));break}}return B(n,n.e+w+1,T,e)},S.toExponential=function(e,t){return e!=null&&(h(e,0,u),e++),I(this,e,t,1)},S.toFixed=function(e,t){return e!=null&&(h(e,0,u),e=e+this.e+1),I(this,e,t)},S.toFormat=function(e,t,n){var r,a=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=N;else if(typeof n!=`object`)throw Error(i+`Argument not an object: `+n);if(r=a.toFixed(e,t),a.c){var o,s=r.split(`.`),c=+n.groupSize,l=+n.secondaryGroupSize,u=n.groupSeparator||``,d=s[0],f=s[1],p=a.s<0,m=p?d.slice(1):d,h=m.length;if(l&&(o=c,c=l,l=o,h-=o),c>0&&h>0){for(o=h%c||c,d=m.substr(0,o);o<h;o+=c)d+=u+m.substr(o,c);l>0&&(d+=u+m.slice(o)),p&&(d=`-`+d)}r=f?d+(n.decimalSeparator||``)+((l=+n.fractionGroupSize)?f.replace(RegExp(`\\d{`+l+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):f):d}return(n.prefix||``)+r+(n.suffix||``)},S.toFraction=function(e){var t,n,r,a,s,l,u,d,f,m,h,g,_=this,v=_.c;if(e!=null&&(u=new F(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(C)))throw Error(i+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+V(u));if(!v)return new F(_);for(t=new F(C),f=n=new F(C),r=d=new F(C),g=p(v),s=t.e=g.length-_.e-1,t.c[0]=c[(l=s%o)<0?o+l:l],e=!e||u.comparedTo(t)>0?s>0?t:f:u,l=k,k=1/0,u=new F(g),d.c[0]=0;m=y(u,t,0,1),a=n.plus(m.times(r)),a.comparedTo(e)!=1;)n=r,r=a,f=d.plus(m.times(a=f)),d=a,t=u.minus(m.times(a=t)),u=a;return a=y(e.minus(n),r,0,1),d=d.plus(a.times(f)),n=n.plus(a.times(r)),d.s=f.s=_.s,s*=2,h=y(f,r,s,T).minus(_).abs().comparedTo(y(d,n,s,T).minus(_).abs())<1?[f,r]:[d,n],k=l,h},S.toNumber=function(){return+V(this)},S.toObject=function(){var e=this;return{c:e.c?e.c.slice():null,e:e.e,s:e.s}},S.toPrecision=function(e,t){return e!=null&&h(e,1,u),I(this,e,t,2)},S.toString=function(e){var t,n=this,r=n.s,i=n.e;return i===null?r?(t=`Infinity`,r<0&&(t=`-`+t)):t=`NaN`:(e==null?t=i<=E||i>=D?_(p(n.c),i):v(p(n.c),i,`0`):(h(e,2,P.length,`Base`),t=b(v(p(n.c),i,`0`),10,e,r,!0)),r<0&&n.c[0]&&(t=`-`+t)),t},S.valueOf=S.toJSON=function(){return V(this)},S._isBigNumber=!0,e!=null&&F.set(e),F}function f(e){var t=e|0;return e>0||e===t?t:t-1}function p(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=o-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function m(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function h(e,t,n,a){if(e<t||e>n||e!==r(e))throw Error(i+(a||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function g(e){var t=e.c.length-1;return f(e.e/o)==t&&e.c[t]%2!=0}function _(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function v(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}exports.default=e;
|
package/dist/node_modules/.pnpm/bignumber.js@10.0.2/node_modules/bignumber.js/dist/bignumber.js
ADDED
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/bignumber.js@10.0.2/node_modules/bignumber.js/dist/bignumber.mjs
|
|
2
|
+
var e = d(), t = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, n = Math.ceil, r = Math.floor, i = "[BigNumber Error] ", a = 0x5af3107a4000, o = 14, s = 9007199254740991, c = [
|
|
3
|
+
1,
|
|
4
|
+
10,
|
|
5
|
+
100,
|
|
6
|
+
1e3,
|
|
7
|
+
1e4,
|
|
8
|
+
1e5,
|
|
9
|
+
1e6,
|
|
10
|
+
1e7,
|
|
11
|
+
1e8,
|
|
12
|
+
1e9,
|
|
13
|
+
1e10,
|
|
14
|
+
1e11,
|
|
15
|
+
0xe8d4a51000,
|
|
16
|
+
0x9184e72a000
|
|
17
|
+
], l = 1e7, u = 1e9;
|
|
18
|
+
function d(e) {
|
|
19
|
+
var y, b, x, S = F.prototype = {
|
|
20
|
+
constructor: F,
|
|
21
|
+
toString: null,
|
|
22
|
+
valueOf: null
|
|
23
|
+
}, C = new F(1), w = 20, T = 4, E = -7, D = 21, O = -1e7, k = 1e7, A = !1, j = 1, M = 0, N = {
|
|
24
|
+
prefix: "",
|
|
25
|
+
groupSize: 3,
|
|
26
|
+
secondaryGroupSize: 0,
|
|
27
|
+
groupSeparator: ",",
|
|
28
|
+
decimalSeparator: ".",
|
|
29
|
+
fractionGroupSize: 0,
|
|
30
|
+
fractionGroupSeparator: "\xA0",
|
|
31
|
+
suffix: ""
|
|
32
|
+
}, P = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
33
|
+
function F(e, n) {
|
|
34
|
+
var r, a, s, c, l, u, d, f, p = this;
|
|
35
|
+
if (!(p instanceof F)) return new F(e, n);
|
|
36
|
+
if (f = typeof e, n == null) {
|
|
37
|
+
if (L(e)) {
|
|
38
|
+
p.s = e.s, !e.c || e.e > k ? p.c = p.e = null : e.e < O ? p.c = [p.e = 0] : (p.e = e.e, p.c = e.c.slice());
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (f == "number") {
|
|
42
|
+
if (e * 0 != 0) {
|
|
43
|
+
p.s = isNaN(e) ? null : e < 0 ? -1 : 1, p.c = p.e = null;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (p.s = 1 / e < 0 ? (e = -e, -1) : 1, e === ~~e) {
|
|
47
|
+
for (c = 0, l = e; l >= 10; l /= 10, c++);
|
|
48
|
+
c > k ? p.c = p.e = null : (p.e = c, p.c = [e]);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
d = String(e);
|
|
52
|
+
} else {
|
|
53
|
+
if (f == "string") {
|
|
54
|
+
if (d = e, !t.test(d)) return x(p, d);
|
|
55
|
+
} else if (f == "bigint") d = String(e);
|
|
56
|
+
else throw Error(i + "Invalid argument: " + e);
|
|
57
|
+
p.s = d.charCodeAt(0) == 45 ? (d = d.slice(1), -1) : 1;
|
|
58
|
+
}
|
|
59
|
+
(c = d.indexOf(".")) > -1 && (d = d.replace(".", "")), (l = d.search(/e/i)) > 0 ? (c < 0 && (c = l), c += +d.slice(l + 1), d = d.substring(0, l)) : c < 0 && (c = d.length);
|
|
60
|
+
} else {
|
|
61
|
+
if (f != "string") throw Error(i + "String expected: " + e);
|
|
62
|
+
for (h(n, 2, P.length, "Base"), d = e, p.s = d.charCodeAt(0) === 45 ? (d = d.slice(1), -1) : 1, r = P.slice(0, n), c = l = 0, u = d.length; l < u; l++) if (r.indexOf(a = d.charAt(l)) < 0) {
|
|
63
|
+
if (a == ".") {
|
|
64
|
+
if (l > c) {
|
|
65
|
+
c = u;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
} else if (!s && (d == d.toUpperCase() && (d = d.toLowerCase()) || d == d.toLowerCase() && (d = d.toUpperCase()))) {
|
|
69
|
+
s = !0, l = -1, c = 0;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
return x(p, e, n);
|
|
73
|
+
}
|
|
74
|
+
d = b(d, n, 10, p.s), (c = d.indexOf(".")) > -1 ? d = d.replace(".", "") : c = d.length;
|
|
75
|
+
}
|
|
76
|
+
for (l = 0; d.charCodeAt(l) === 48; l++);
|
|
77
|
+
for (u = d.length; d.charCodeAt(--u) === 48;);
|
|
78
|
+
if (d = d.slice(l, ++u)) if (u -= l, c = c - l - 1, c > k) p.c = p.e = null;
|
|
79
|
+
else if (c < O) p.c = [p.e = 0];
|
|
80
|
+
else {
|
|
81
|
+
if (p.e = c, p.c = [], l = (c + 1) % o, c < 0 && (l += o), l < u) {
|
|
82
|
+
for (l && p.c.push(+d.slice(0, l)), u -= o; l < u;) p.c.push(+d.slice(l, l += o));
|
|
83
|
+
l = o - (d = d.slice(l)).length;
|
|
84
|
+
} else l -= u;
|
|
85
|
+
for (; l--; d += "0");
|
|
86
|
+
p.c.push(+d);
|
|
87
|
+
}
|
|
88
|
+
else p.c = [p.e = 0];
|
|
89
|
+
}
|
|
90
|
+
F.clone = d, F.ROUND_UP = 0, F.ROUND_DOWN = 1, F.ROUND_CEIL = 2, F.ROUND_FLOOR = 3, F.ROUND_HALF_UP = 4, F.ROUND_HALF_DOWN = 5, F.ROUND_HALF_EVEN = 6, F.ROUND_HALF_CEIL = 7, F.ROUND_HALF_FLOOR = 8, F.EUCLID = 9, F.config = F.set = function(e) {
|
|
91
|
+
var t, n;
|
|
92
|
+
if (e != null) if (typeof e == "object") {
|
|
93
|
+
if (e.hasOwnProperty(t = "DECIMAL_PLACES") && (n = e[t], h(n, 0, u, t), w = n), e.hasOwnProperty(t = "ROUNDING_MODE") && (n = e[t], h(n, 0, 8, t), T = n), e.hasOwnProperty(t = "EXPONENTIAL_AT") && (n = e[t], n && n.pop ? (h(n[0], -u, 0, t), h(n[1], 0, u, t), E = n[0], D = n[1]) : (h(n, -u, u, t), E = -(D = n < 0 ? -n : n))), e.hasOwnProperty(t = "RANGE")) if (n = e[t], n && n.pop) h(n[0], -u, -1, t), h(n[1], 1, u, t), O = n[0], k = n[1];
|
|
94
|
+
else if (h(n, -u, u, t), n) O = -(k = n < 0 ? -n : n);
|
|
95
|
+
else throw Error(i + t + " cannot be zero: " + n);
|
|
96
|
+
if (e.hasOwnProperty(t = "CRYPTO")) if (n = e[t], n === !!n) if (n) if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes)) A = n;
|
|
97
|
+
else throw A = !n, Error(i + "crypto unavailable");
|
|
98
|
+
else A = n;
|
|
99
|
+
else throw Error(i + t + " not true or false: " + n);
|
|
100
|
+
if (e.hasOwnProperty(t = "MODULO_MODE") && (n = e[t], h(n, 0, 9, t), j = n), e.hasOwnProperty(t = "POW_PRECISION") && (n = e[t], h(n, 0, u, t), M = n), e.hasOwnProperty(t = "FORMAT")) if (n = e[t], typeof n == "object") N = n;
|
|
101
|
+
else throw Error(i + t + " not an object: " + n);
|
|
102
|
+
if (e.hasOwnProperty(t = "ALPHABET")) if (n = e[t], typeof n == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(n)) P = n;
|
|
103
|
+
else throw Error(i + t + " invalid: " + n);
|
|
104
|
+
} else throw Error(i + "Object expected: " + e);
|
|
105
|
+
return {
|
|
106
|
+
DECIMAL_PLACES: w,
|
|
107
|
+
ROUNDING_MODE: T,
|
|
108
|
+
EXPONENTIAL_AT: [E, D],
|
|
109
|
+
RANGE: [O, k],
|
|
110
|
+
CRYPTO: A,
|
|
111
|
+
MODULO_MODE: j,
|
|
112
|
+
POW_PRECISION: M,
|
|
113
|
+
FORMAT: N,
|
|
114
|
+
ALPHABET: P
|
|
115
|
+
};
|
|
116
|
+
}, F.isBigNumber = function(e) {
|
|
117
|
+
if (!L(e)) return !1;
|
|
118
|
+
var t, n, i = e.c, s = e.e, c = e.s;
|
|
119
|
+
if ({}.toString.call(i) != "[object Array]") return i === null && s === null && (c === null || c === 1 || c === -1);
|
|
120
|
+
if (c !== 1 && c !== -1 || s < -u || s > u || s !== r(s)) return !1;
|
|
121
|
+
if (i[0] === 0) return s === 0 && i.length === 1;
|
|
122
|
+
if (t = (s + 1) % o, t < 1 && (t += o), String(i[0]).length !== t) return !1;
|
|
123
|
+
for (t = 0; t < i.length; t++) if (n = i[t], n < 0 || n >= a || n !== r(n)) return !1;
|
|
124
|
+
return n !== 0;
|
|
125
|
+
}, F.maximum = F.max = function() {
|
|
126
|
+
return R(arguments, -1);
|
|
127
|
+
}, F.minimum = F.min = function() {
|
|
128
|
+
return R(arguments, 1);
|
|
129
|
+
}, F.random = (function() {
|
|
130
|
+
var e = 9007199254740992, t = Math.random() * e & 2097151 ? function() {
|
|
131
|
+
return r(Math.random() * e);
|
|
132
|
+
} : function() {
|
|
133
|
+
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
134
|
+
};
|
|
135
|
+
return function(e) {
|
|
136
|
+
var a, s, l, d, f, p = 0, m = [], g = new F(C);
|
|
137
|
+
if (e == null ? e = w : h(e, 0, u), d = n(e / o), A) if (crypto.getRandomValues) {
|
|
138
|
+
for (a = crypto.getRandomValues(new Uint32Array(d *= 2)); p < d;) f = a[p] * 131072 + (a[p + 1] >>> 11), f >= 9e15 ? (s = crypto.getRandomValues(new Uint32Array(2)), a[p] = s[0], a[p + 1] = s[1]) : (m.push(f % 0x5af3107a4000), p += 2);
|
|
139
|
+
p = d / 2;
|
|
140
|
+
} else if (crypto.randomBytes) {
|
|
141
|
+
for (a = crypto.randomBytes(d *= 7); p < d;) f = (a[p] & 31) * 281474976710656 + a[p + 1] * 1099511627776 + a[p + 2] * 4294967296 + a[p + 3] * 16777216 + (a[p + 4] << 16) + (a[p + 5] << 8) + a[p + 6], f >= 9e15 ? crypto.randomBytes(7).copy(a, p) : (m.push(f % 0x5af3107a4000), p += 7);
|
|
142
|
+
p = d / 7;
|
|
143
|
+
} else throw A = !1, Error(i + "crypto unavailable");
|
|
144
|
+
if (!A) for (; p < d;) f = t(), f < 9e15 && (m[p++] = f % 0x5af3107a4000);
|
|
145
|
+
for (d = m[--p], e %= o, d && e && (f = c[o - e], m[p] = r(d / f) * f); m[p] === 0; m.pop(), p--);
|
|
146
|
+
if (p < 0) m = [l = 0];
|
|
147
|
+
else {
|
|
148
|
+
for (l = -1; m[0] === 0; m.splice(0, 1), l -= o);
|
|
149
|
+
for (p = 1, f = m[0]; f >= 10; f /= 10, p++);
|
|
150
|
+
p < o && (l -= o - p);
|
|
151
|
+
}
|
|
152
|
+
return g.e = l, g.c = m, g;
|
|
153
|
+
};
|
|
154
|
+
})(), F.sum = function() {
|
|
155
|
+
for (var e = 1, t = arguments, n = new F(t[0]); e < t.length;) n = n.plus(t[e++]);
|
|
156
|
+
return n;
|
|
157
|
+
}, b = (function() {
|
|
158
|
+
var e = "0123456789";
|
|
159
|
+
function t(e, t, n, r) {
|
|
160
|
+
for (var i, a = [0], o, s = 0, c = e.length; s < c;) {
|
|
161
|
+
for (o = a.length; o--; a[o] *= t);
|
|
162
|
+
for (a[0] += r.indexOf(e.charAt(s++)), i = 0; i < a.length; i++) a[i] > n - 1 && (a[i + 1] ?? (a[i + 1] = 0), a[i + 1] += a[i] / n | 0, a[i] %= n);
|
|
163
|
+
}
|
|
164
|
+
return a.reverse();
|
|
165
|
+
}
|
|
166
|
+
return function(n, r, i, a, o) {
|
|
167
|
+
var s, c, l, u, d, f, m, h, g = n.indexOf("."), _ = w, b = T;
|
|
168
|
+
for (g >= 0 && (u = M, M = 0, n = n.replace(".", ""), h = new F(r), f = h.pow(n.length - g), M = u, h.c = t(v(p(f.c), f.e, "0"), 10, i, e), h.e = h.c.length), m = t(n, r, i, o ? (s = P, e) : (s = e, P)), l = u = m.length; m[--u] == 0; m.pop());
|
|
169
|
+
if (!m[0]) return s.charAt(0);
|
|
170
|
+
if (g < 0 ? --l : (f.c = m, f.e = l, f.s = a, f = y(f, h, _, b, i), m = f.c, d = f.r, l = f.e), c = l + _ + 1, g = m[c], u = i / 2, d = d || c < 0 || m[c + 1] != null, d = b < 4 ? (g != null || d) && (b == 0 || b == (f.s < 0 ? 3 : 2)) : g > u || g == u && (b == 4 || d || b == 6 && m[c - 1] & 1 || b == (f.s < 0 ? 8 : 7)), c < 1 || !m[0]) n = d ? v(s.charAt(1), -_, s.charAt(0)) : s.charAt(0);
|
|
171
|
+
else {
|
|
172
|
+
if (m.length = c, d) for (--i; ++m[--c] > i;) m[c] = 0, c || (++l, m = [1].concat(m));
|
|
173
|
+
for (u = m.length; !m[--u];);
|
|
174
|
+
for (g = 0, n = ""; g <= u; n += s.charAt(m[g++]));
|
|
175
|
+
n = v(n, l, s.charAt(0));
|
|
176
|
+
}
|
|
177
|
+
return n;
|
|
178
|
+
};
|
|
179
|
+
})(), y = (function() {
|
|
180
|
+
function e(e, t, n) {
|
|
181
|
+
var r, i, a, o, s = 0, c = e.length, u = t % l, d = t / l | 0;
|
|
182
|
+
for (e = e.slice(); c--;) a = e[c] % l, o = e[c] / l | 0, r = d * a + o * u, i = u * a + r % l * l + s, s = (i / n | 0) + (r / l | 0) + d * o, e[c] = i % n;
|
|
183
|
+
return s && (e = [s].concat(e)), e;
|
|
184
|
+
}
|
|
185
|
+
function t(e, t, n, r) {
|
|
186
|
+
var i, a;
|
|
187
|
+
if (n != r) a = n > r ? 1 : -1;
|
|
188
|
+
else for (i = a = 0; i < n; i++) if (e[i] != t[i]) {
|
|
189
|
+
a = e[i] > t[i] ? 1 : -1;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
return a;
|
|
193
|
+
}
|
|
194
|
+
function n(e, t, n, r) {
|
|
195
|
+
for (var i = 0; n--;) e[n] -= i, i = e[n] < t[n] ? 1 : 0, e[n] = i * r + e[n] - t[n];
|
|
196
|
+
for (; !e[0] && e.length > 1; e.splice(0, 1));
|
|
197
|
+
}
|
|
198
|
+
return function(i, s, c, l, u) {
|
|
199
|
+
var d, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k = i.s == s.s ? 1 : -1, A = i.c, j = s.c;
|
|
200
|
+
if (!A || !A[0] || !j || !j[0]) return new F(!i.s || !s.s || (A ? j && A[0] == j[0] : !j) ? NaN : A && A[0] == 0 || !j ? k * 0 : k / 0);
|
|
201
|
+
for (y = new F(k), b = y.c = [], p = i.e - s.e, k = c + p + 1, u || (u = a, p = f(i.e / o) - f(s.e / o), k = k / o | 0), m = 0; j[m] == (A[m] || 0); m++);
|
|
202
|
+
if (j[m] > (A[m] || 0) && p--, k < 0) b.push(1), h = !0;
|
|
203
|
+
else {
|
|
204
|
+
for (T = A.length, D = j.length, m = 0, k += 2, g = r(u / (j[0] + 1)), g > 1 && (j = e(j, g, u), A = e(A, g, u), D = j.length, T = A.length), w = D, x = A.slice(0, D), S = x.length; S < D; x[S++] = 0);
|
|
205
|
+
O = j.slice(), O = [0].concat(O), E = j[0], j[1] >= u / 2 && E++;
|
|
206
|
+
do {
|
|
207
|
+
if (g = 0, d = t(j, x, D, S), d < 0) {
|
|
208
|
+
if (C = x[0], D != S && (C = C * u + (x[1] || 0)), g = r(C / E), g > 1) for (g >= u && (g = u - 1), _ = e(j, g, u), v = _.length, S = x.length; t(_, x, v, S) == 1;) g--, n(_, D < v ? O : j, v, u), v = _.length, d = 1;
|
|
209
|
+
else g == 0 && (d = g = 1), _ = j.slice(), v = _.length;
|
|
210
|
+
if (v < S && (_ = [0].concat(_)), n(x, _, S, u), S = x.length, d == -1) for (; t(j, x, D, S) < 1;) g++, n(x, D < S ? O : j, S, u), S = x.length;
|
|
211
|
+
} else d === 0 && (g++, x = [0]);
|
|
212
|
+
b[m++] = g, x[0] ? x[S++] = A[w] || 0 : (x = [A[w]], S = 1);
|
|
213
|
+
} while ((w++ < T || x[0] != null) && k--);
|
|
214
|
+
h = x[0] != null, b[0] || b.splice(0, 1);
|
|
215
|
+
}
|
|
216
|
+
if (u == a) {
|
|
217
|
+
for (m = 1, k = b[0]; k >= 10; k /= 10, m++);
|
|
218
|
+
B(y, c + (y.e = m + p * o - 1) + 1, l, h);
|
|
219
|
+
} else y.e = p, y.r = +h;
|
|
220
|
+
return y;
|
|
221
|
+
};
|
|
222
|
+
})();
|
|
223
|
+
function I(e, t, n, r) {
|
|
224
|
+
var i, a, o, s, c;
|
|
225
|
+
if (n == null ? n = T : h(n, 0, 8), !e.c) return e.toString();
|
|
226
|
+
if (i = e.c[0], o = e.e, t == null) c = p(e.c), c = r == 1 || r == 2 && (o <= E || o >= D) ? _(c, o) : v(c, o, "0");
|
|
227
|
+
else if (e = B(new F(e), t, n), a = e.e, c = p(e.c), s = c.length, r == 1 || r == 2 && (t <= a || a <= E)) {
|
|
228
|
+
for (; s < t; c += "0", s++);
|
|
229
|
+
c = _(c, a);
|
|
230
|
+
} else if (t -= o + (r === 2 && a > o), c = v(c, a, "0"), a + 1 > s) {
|
|
231
|
+
if (--t > 0) for (c += "."; t--; c += "0");
|
|
232
|
+
} else if (t += a - s, t > 0) for (a + 1 == s && (c += "."); t--; c += "0");
|
|
233
|
+
return e.s < 0 && i ? "-" + c : c;
|
|
234
|
+
}
|
|
235
|
+
function L(e) {
|
|
236
|
+
return e instanceof F || !!e && e._isBigNumber === !0;
|
|
237
|
+
}
|
|
238
|
+
function R(e, t) {
|
|
239
|
+
for (var n, r, i = 1, a = new F(e[0]); i < e.length; i++) r = new F(e[i]), (!r.s || (n = m(a, r)) === t || n === 0 && a.s === t) && (a = r);
|
|
240
|
+
return a;
|
|
241
|
+
}
|
|
242
|
+
function z(e, t, n) {
|
|
243
|
+
for (var r = 1, i = t.length; !t[--i]; t.pop());
|
|
244
|
+
for (i = t[0]; i >= 10; i /= 10, r++);
|
|
245
|
+
return (n = r + n * o - 1) > k ? e.c = e.e = null : n < O ? e.c = [e.e = 0] : (e.e = n, e.c = t), e;
|
|
246
|
+
}
|
|
247
|
+
x = (function() {
|
|
248
|
+
var e = /^(-?)0([xbo])(?=\w[\w.]*$)/i, t = /^([^.]+)\.$/, n = /^\.([^.]+)$/, r = /^-?(Infinity|NaN)$/, a = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
|
249
|
+
return function(o, s, c) {
|
|
250
|
+
var l, u = s.replace(a, "");
|
|
251
|
+
if (r.test(u)) {
|
|
252
|
+
o.s = isNaN(u) ? null : u < 0 ? -1 : 1, o.c = o.e = null;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (u = u.replace(e, function(e, t, n) {
|
|
256
|
+
return l = (n = n.toLowerCase()) == "x" ? 16 : n == "b" ? 2 : 8, !c || c == l ? t : e;
|
|
257
|
+
}), c && (l = c, u = u.replace(t, "$1").replace(n, "0.$1")), s != u) return new F(u, l);
|
|
258
|
+
throw Error(i + "Not a" + (c ? " base " + c : "") + " number: " + s);
|
|
259
|
+
};
|
|
260
|
+
})();
|
|
261
|
+
function B(e, t, i, s) {
|
|
262
|
+
var l, u, d, f, p, m, h, g = e.c, _ = c;
|
|
263
|
+
if (g) {
|
|
264
|
+
out: {
|
|
265
|
+
for (l = 1, f = g[0]; f >= 10; f /= 10, l++);
|
|
266
|
+
if (u = t - l, u < 0) u += o, d = t, p = g[m = 0], h = r(p / _[l - d - 1] % 10);
|
|
267
|
+
else if (m = n((u + 1) / o), m >= g.length) if (s) {
|
|
268
|
+
for (; g.length <= m; g.push(0));
|
|
269
|
+
p = h = 0, l = 1, u %= o, d = u - o + 1;
|
|
270
|
+
} else break out;
|
|
271
|
+
else {
|
|
272
|
+
for (p = f = g[m], l = 1; f >= 10; f /= 10, l++);
|
|
273
|
+
u %= o, d = u - o + l, h = d < 0 ? 0 : r(p / _[l - d - 1] % 10);
|
|
274
|
+
}
|
|
275
|
+
if (s = s || t < 0 || g[m + 1] != null || (d < 0 ? p : p % _[l - d - 1]), s = i < 4 ? (h || s) && (i == 0 || i == (e.s < 0 ? 3 : 2)) : h > 5 || h == 5 && (i == 4 || s || i == 6 && (u > 0 ? d > 0 ? p / _[l - d] : 0 : g[m - 1]) % 10 & 1 || i == (e.s < 0 ? 8 : 7)), t < 1 || !g[0]) return g.length = 0, s ? (t -= e.e + 1, g[0] = _[(o - t % o) % o], e.e = -t || 0) : g[0] = e.e = 0, e;
|
|
276
|
+
if (u == 0 ? (g.length = m, f = 1, m--) : (g.length = m + 1, f = _[o - u], g[m] = d > 0 ? r(p / _[l - d] % _[d]) * f : 0), s) for (;;) if (m == 0) {
|
|
277
|
+
for (u = 1, d = g[0]; d >= 10; d /= 10, u++);
|
|
278
|
+
for (d = g[0] += f, f = 1; d >= 10; d /= 10, f++);
|
|
279
|
+
u != f && (e.e++, g[0] == a && (g[0] = 1));
|
|
280
|
+
break;
|
|
281
|
+
} else {
|
|
282
|
+
if (g[m] += f, g[m] != a) break;
|
|
283
|
+
g[m--] = 0, f = 1;
|
|
284
|
+
}
|
|
285
|
+
for (u = g.length; g[--u] === 0; g.pop());
|
|
286
|
+
}
|
|
287
|
+
e.e > k ? e.c = e.e = null : e.e < O && (e.c = [e.e = 0]);
|
|
288
|
+
}
|
|
289
|
+
return e;
|
|
290
|
+
}
|
|
291
|
+
function V(e) {
|
|
292
|
+
var t, n = e.e;
|
|
293
|
+
return n === null ? e.toString() : (t = p(e.c), t = n <= E || n >= D ? _(t, n) : v(t, n, "0"), e.s < 0 ? "-" + t : t);
|
|
294
|
+
}
|
|
295
|
+
return S.absoluteValue = S.abs = function() {
|
|
296
|
+
var e = new F(this);
|
|
297
|
+
return e.s < 0 && (e.s = 1), e;
|
|
298
|
+
}, S.comparedTo = function(e, t) {
|
|
299
|
+
return m(this, new F(e, t));
|
|
300
|
+
}, S.decimalPlaces = S.dp = function(e, t) {
|
|
301
|
+
var n, r, i, a = this;
|
|
302
|
+
if (e != null) return h(e, 0, u), t == null ? t = T : h(t, 0, 8), B(new F(a), e + a.e + 1, t);
|
|
303
|
+
if (!(n = a.c)) return null;
|
|
304
|
+
if (r = ((i = n.length - 1) - f(this.e / o)) * o, i = n[i]) for (; i % 10 == 0; i /= 10, r--);
|
|
305
|
+
return r < 0 && (r = 0), r;
|
|
306
|
+
}, S.dividedBy = S.div = function(e, t) {
|
|
307
|
+
return y(this, new F(e, t), w, T);
|
|
308
|
+
}, S.dividedToIntegerBy = S.idiv = function(e, t) {
|
|
309
|
+
return y(this, new F(e, t), 0, 1);
|
|
310
|
+
}, S.exponentiatedBy = S.pow = function(e, t) {
|
|
311
|
+
var a, s, c, l, u, d, f, p, m, h = this;
|
|
312
|
+
if (e = new F(e), e.c && !e.isInteger()) throw Error(i + "Exponent not an integer: " + V(e));
|
|
313
|
+
if (t != null && (t = new F(t)), d = e.e > 14, !h.c || !h.c[0] || h.c[0] == 1 && !h.e && h.c.length == 1 || !e.c || !e.c[0]) return m = new F(V(h) ** (d ? e.s * (2 - g(e)) : +V(e))), t ? m.mod(t) : m;
|
|
314
|
+
if (f = e.s < 0, t) {
|
|
315
|
+
if (t.c ? !t.c[0] : !t.s) return new F(NaN);
|
|
316
|
+
s = !f && h.isInteger() && t.isInteger(), s && (h = h.mod(t));
|
|
317
|
+
} else if (e.e > 9 && (h.e > 0 || h.e < -1 || (h.e == 0 ? h.c[0] > 1 || d && h.c[1] >= 24e7 : h.c[0] < 8e13 || d && h.c[0] <= 9999975e7))) return l = h.s < 0 && g(e) ? -0 : 0, h.e > -1 && (l = 1 / l), new F(f ? 1 / l : l);
|
|
318
|
+
else M && (l = n(M / o + 2));
|
|
319
|
+
for (d ? (a = new F(.5), f && (e.s = 1), p = g(e)) : (c = Math.abs(+V(e)), p = c % 2), m = new F(C);;) {
|
|
320
|
+
if (p) {
|
|
321
|
+
if (m = m.times(h), !m.c) break;
|
|
322
|
+
l ? m.c.length > l && (m.c.length = l) : s && (m = m.mod(t));
|
|
323
|
+
}
|
|
324
|
+
if (c) {
|
|
325
|
+
if (c = r(c / 2), c === 0) break;
|
|
326
|
+
p = c % 2;
|
|
327
|
+
} else if (e = e.times(a), B(e, e.e + 1, 1), e.e > 14) p = g(e);
|
|
328
|
+
else {
|
|
329
|
+
if (c = +V(e), c === 0) break;
|
|
330
|
+
p = c % 2;
|
|
331
|
+
}
|
|
332
|
+
h = h.times(h), l ? h.c && h.c.length > l && (h.c.length = l) : s && (h = h.mod(t));
|
|
333
|
+
}
|
|
334
|
+
return s ? m : (f && (m = C.div(m)), t ? m.mod(t) : l ? B(m, M, T, u) : m);
|
|
335
|
+
}, S.integerValue = function(e) {
|
|
336
|
+
var t = new F(this);
|
|
337
|
+
return e == null ? e = T : h(e, 0, 8), B(t, t.e + 1, e);
|
|
338
|
+
}, S.isEqualTo = S.eq = function(e, t) {
|
|
339
|
+
return m(this, new F(e, t)) === 0;
|
|
340
|
+
}, S.isFinite = function() {
|
|
341
|
+
return !!this.c;
|
|
342
|
+
}, S.isGreaterThan = S.gt = function(e, t) {
|
|
343
|
+
return m(this, new F(e, t)) > 0;
|
|
344
|
+
}, S.isGreaterThanOrEqualTo = S.gte = function(e, t) {
|
|
345
|
+
return (t = m(this, new F(e, t))) === 1 || t === 0;
|
|
346
|
+
}, S.isInteger = function() {
|
|
347
|
+
return !!this.c && f(this.e / o) > this.c.length - 2;
|
|
348
|
+
}, S.isLessThan = S.lt = function(e, t) {
|
|
349
|
+
return m(this, new F(e, t)) < 0;
|
|
350
|
+
}, S.isLessThanOrEqualTo = S.lte = function(e, t) {
|
|
351
|
+
return (t = m(this, new F(e, t))) === -1 || t === 0;
|
|
352
|
+
}, S.isNaN = function() {
|
|
353
|
+
return !this.s;
|
|
354
|
+
}, S.isNegative = function() {
|
|
355
|
+
return this.s < 0;
|
|
356
|
+
}, S.isPositive = function() {
|
|
357
|
+
return this.s > 0;
|
|
358
|
+
}, S.isZero = function() {
|
|
359
|
+
return !!this.c && this.c[0] == 0;
|
|
360
|
+
}, S.minus = function(e, t) {
|
|
361
|
+
var n, r, i, s, c = this, l = c.s;
|
|
362
|
+
if (e = new F(e, t), t = e.s, !l || !t) return new F(NaN);
|
|
363
|
+
if (l != t) return e.s = -t, c.plus(e);
|
|
364
|
+
var u = c.e / o, d = e.e / o, p = c.c, m = e.c;
|
|
365
|
+
if (!u || !d) {
|
|
366
|
+
if (!p || !m) return p ? (e.s = -t, e) : new F(m ? c : NaN);
|
|
367
|
+
if (!p[0] || !m[0]) return m[0] ? (e.s = -t, e) : new F(p[0] ? c : T == 3 ? -0 : 0);
|
|
368
|
+
}
|
|
369
|
+
if (u = f(u), d = f(d), p = p.slice(), l = u - d) {
|
|
370
|
+
for ((s = l < 0) ? (l = -l, i = p) : (d = u, i = m), i.reverse(), t = l; t--; i.push(0));
|
|
371
|
+
i.reverse();
|
|
372
|
+
} else for (r = (s = (l = p.length) < (t = m.length)) ? l : t, l = t = 0; t < r; t++) if (p[t] != m[t]) {
|
|
373
|
+
s = p[t] < m[t];
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
if (s && (i = p, p = m, m = i, e.s = -e.s), t = (r = m.length) - (n = p.length), t > 0) for (; t--; p[n++] = 0);
|
|
377
|
+
for (t = a - 1; r > l;) {
|
|
378
|
+
if (p[--r] < m[r]) {
|
|
379
|
+
for (n = r; n && !p[--n]; p[n] = t);
|
|
380
|
+
--p[n], p[r] += a;
|
|
381
|
+
}
|
|
382
|
+
p[r] -= m[r];
|
|
383
|
+
}
|
|
384
|
+
for (; p[0] == 0; p.splice(0, 1), --d);
|
|
385
|
+
return p[0] ? z(e, p, d) : (e.s = T == 3 ? -1 : 1, e.c = [e.e = 0], e);
|
|
386
|
+
}, S.modulo = S.mod = function(e, t) {
|
|
387
|
+
var n, r, i = this;
|
|
388
|
+
return e = new F(e, t), !i.c || !e.s || e.c && !e.c[0] ? new F(NaN) : !e.c || i.c && !i.c[0] ? new F(i) : (j == 9 ? (r = e.s, e.s = 1, n = y(i, e, 0, 3), e.s = r, n.s *= r) : n = y(i, e, 0, j), e = i.minus(n.times(e)), !e.c[0] && j == 1 && (e.s = i.s), e);
|
|
389
|
+
}, S.multipliedBy = S.times = function(e, t) {
|
|
390
|
+
var n, r, i, s, c, u, d, p, m, h, g, _, v, y, b, x = this, S = x.c, C = (e = new F(e, t)).c;
|
|
391
|
+
if (!S || !C || !S[0] || !C[0]) return !x.s || !e.s || S && !S[0] && !C || C && !C[0] && !S ? e.c = e.e = e.s = null : (e.s *= x.s, !S || !C ? e.c = e.e = null : (e.c = [0], e.e = 0)), e;
|
|
392
|
+
for (r = f(x.e / o) + f(e.e / o), e.s *= x.s, d = S.length, h = C.length, d < h && (v = S, S = C, C = v, i = d, d = h, h = i), i = d + h, v = []; i--; v.push(0));
|
|
393
|
+
for (y = a, b = l, i = h; --i >= 0;) {
|
|
394
|
+
for (n = 0, g = C[i] % b, _ = C[i] / b | 0, c = d, s = i + c; s > i;) p = S[--c] % b, m = S[c] / b | 0, u = _ * p + m * g, p = g * p + u % b * b + v[s] + n, n = (p / y | 0) + (u / b | 0) + _ * m, v[s--] = p % y;
|
|
395
|
+
v[s] = n;
|
|
396
|
+
}
|
|
397
|
+
return n ? ++r : v.splice(0, 1), z(e, v, r);
|
|
398
|
+
}, S.negated = function() {
|
|
399
|
+
var e = new F(this);
|
|
400
|
+
return e.s = -e.s || null, e;
|
|
401
|
+
}, S.plus = function(e, t) {
|
|
402
|
+
var n, r = this, i = r.s;
|
|
403
|
+
if (e = new F(e, t), t = e.s, !i || !t) return new F(NaN);
|
|
404
|
+
if (i != t) return e.s = -t, r.minus(e);
|
|
405
|
+
var s = r.e / o, c = e.e / o, l = r.c, u = e.c;
|
|
406
|
+
if (!s || !c) {
|
|
407
|
+
if (!l || !u) return new F(i / 0);
|
|
408
|
+
if (!l[0] || !u[0]) return u[0] ? e : new F(l[0] ? r : i * 0);
|
|
409
|
+
}
|
|
410
|
+
if (s = f(s), c = f(c), l = l.slice(), i = s - c) {
|
|
411
|
+
for (i > 0 ? (c = s, n = u) : (i = -i, n = l), n.reverse(); i--; n.push(0));
|
|
412
|
+
n.reverse();
|
|
413
|
+
}
|
|
414
|
+
for (i = l.length, t = u.length, i - t < 0 && (n = u, u = l, l = n, t = i), i = 0; t;) i = (l[--t] = l[t] + u[t] + i) / a | 0, l[t] = a === l[t] ? 0 : l[t] % a;
|
|
415
|
+
return i && (l = [i].concat(l), ++c), z(e, l, c);
|
|
416
|
+
}, S.precision = S.sd = function(e, t) {
|
|
417
|
+
var n, r, i, a = this;
|
|
418
|
+
if (e != null && e !== !!e) return h(e, 1, u), t == null ? t = T : h(t, 0, 8), B(new F(a), e, t);
|
|
419
|
+
if (!(n = a.c)) return null;
|
|
420
|
+
if (i = n.length - 1, r = i * o + 1, i = n[i]) {
|
|
421
|
+
for (; i % 10 == 0; i /= 10, r--);
|
|
422
|
+
for (i = n[0]; i >= 10; i /= 10, r++);
|
|
423
|
+
}
|
|
424
|
+
return e && a.e + 1 > r && (r = a.e + 1), r;
|
|
425
|
+
}, S.shiftedBy = function(e) {
|
|
426
|
+
return h(e, -s, s), this.times("1e" + e);
|
|
427
|
+
}, S.squareRoot = S.sqrt = function() {
|
|
428
|
+
var e, t, n, r, i, a = this, o = a.c, s = a.s, c = a.e, l = w + 4, u = new F("0.5");
|
|
429
|
+
if (s !== 1 || !o || !o[0]) return new F(!s || s < 0 && (!o || o[0]) ? NaN : o ? a : Infinity);
|
|
430
|
+
if (s = Math.sqrt(+V(a)), s == 0 || s == Infinity ? (t = p(o), (t.length + c) % 2 == 0 && (t += "0"), s = Math.sqrt(+t), c = f((c + 1) / 2) - (c < 0 || c % 2), s == Infinity ? t = "5e" + c : (t = s.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + c), n = new F(t)) : n = new F(s + ""), n.c[0]) {
|
|
431
|
+
for (c = n.e, s = c + l, s < 3 && (s = 0);;) if (i = n, n = u.times(i.plus(y(a, i, l, 1))), p(i.c).slice(0, s) === (t = p(n.c)).slice(0, s)) if (n.e < c && --s, t = t.slice(s - 3, s + 1), t == "9999" || !r && t == "4999") {
|
|
432
|
+
if (!r && (B(i, i.e + w + 2, 0), i.times(i).eq(a))) {
|
|
433
|
+
n = i;
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
l += 4, s += 4, r = 1;
|
|
437
|
+
} else {
|
|
438
|
+
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (B(n, n.e + w + 2, 1), e = !n.times(n).eq(a));
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return B(n, n.e + w + 1, T, e);
|
|
443
|
+
}, S.toExponential = function(e, t) {
|
|
444
|
+
return e != null && (h(e, 0, u), e++), I(this, e, t, 1);
|
|
445
|
+
}, S.toFixed = function(e, t) {
|
|
446
|
+
return e != null && (h(e, 0, u), e = e + this.e + 1), I(this, e, t);
|
|
447
|
+
}, S.toFormat = function(e, t, n) {
|
|
448
|
+
var r, a = this;
|
|
449
|
+
if (n == null) e != null && t && typeof t == "object" ? (n = t, t = null) : e && typeof e == "object" ? (n = e, e = t = null) : n = N;
|
|
450
|
+
else if (typeof n != "object") throw Error(i + "Argument not an object: " + n);
|
|
451
|
+
if (r = a.toFixed(e, t), a.c) {
|
|
452
|
+
var o, s = r.split("."), c = +n.groupSize, l = +n.secondaryGroupSize, u = n.groupSeparator || "", d = s[0], f = s[1], p = a.s < 0, m = p ? d.slice(1) : d, h = m.length;
|
|
453
|
+
if (l && (o = c, c = l, l = o, h -= o), c > 0 && h > 0) {
|
|
454
|
+
for (o = h % c || c, d = m.substr(0, o); o < h; o += c) d += u + m.substr(o, c);
|
|
455
|
+
l > 0 && (d += u + m.slice(o)), p && (d = "-" + d);
|
|
456
|
+
}
|
|
457
|
+
r = f ? d + (n.decimalSeparator || "") + ((l = +n.fractionGroupSize) ? f.replace(RegExp("\\d{" + l + "}\\B", "g"), "$&" + (n.fractionGroupSeparator || "")) : f) : d;
|
|
458
|
+
}
|
|
459
|
+
return (n.prefix || "") + r + (n.suffix || "");
|
|
460
|
+
}, S.toFraction = function(e) {
|
|
461
|
+
var t, n, r, a, s, l, u, d, f, m, h, g, _ = this, v = _.c;
|
|
462
|
+
if (e != null && (u = new F(e), !u.isInteger() && (u.c || u.s !== 1) || u.lt(C))) throw Error(i + "Argument " + (u.isInteger() ? "out of range: " : "not an integer: ") + V(u));
|
|
463
|
+
if (!v) return new F(_);
|
|
464
|
+
for (t = new F(C), f = n = new F(C), r = d = new F(C), g = p(v), s = t.e = g.length - _.e - 1, t.c[0] = c[(l = s % o) < 0 ? o + l : l], e = !e || u.comparedTo(t) > 0 ? s > 0 ? t : f : u, l = k, k = Infinity, u = new F(g), d.c[0] = 0; m = y(u, t, 0, 1), a = n.plus(m.times(r)), a.comparedTo(e) != 1;) n = r, r = a, f = d.plus(m.times(a = f)), d = a, t = u.minus(m.times(a = t)), u = a;
|
|
465
|
+
return a = y(e.minus(n), r, 0, 1), d = d.plus(a.times(f)), n = n.plus(a.times(r)), d.s = f.s = _.s, s *= 2, h = y(f, r, s, T).minus(_).abs().comparedTo(y(d, n, s, T).minus(_).abs()) < 1 ? [f, r] : [d, n], k = l, h;
|
|
466
|
+
}, S.toNumber = function() {
|
|
467
|
+
return +V(this);
|
|
468
|
+
}, S.toObject = function() {
|
|
469
|
+
var e = this;
|
|
470
|
+
return {
|
|
471
|
+
c: e.c ? e.c.slice() : null,
|
|
472
|
+
e: e.e,
|
|
473
|
+
s: e.s
|
|
474
|
+
};
|
|
475
|
+
}, S.toPrecision = function(e, t) {
|
|
476
|
+
return e != null && h(e, 1, u), I(this, e, t, 2);
|
|
477
|
+
}, S.toString = function(e) {
|
|
478
|
+
var t, n = this, r = n.s, i = n.e;
|
|
479
|
+
return i === null ? r ? (t = "Infinity", r < 0 && (t = "-" + t)) : t = "NaN" : (e == null ? t = i <= E || i >= D ? _(p(n.c), i) : v(p(n.c), i, "0") : (h(e, 2, P.length, "Base"), t = b(v(p(n.c), i, "0"), 10, e, r, !0)), r < 0 && n.c[0] && (t = "-" + t)), t;
|
|
480
|
+
}, S.valueOf = S.toJSON = function() {
|
|
481
|
+
return V(this);
|
|
482
|
+
}, S._isBigNumber = !0, e != null && F.set(e), F;
|
|
483
|
+
}
|
|
484
|
+
function f(e) {
|
|
485
|
+
var t = e | 0;
|
|
486
|
+
return e > 0 || e === t ? t : t - 1;
|
|
487
|
+
}
|
|
488
|
+
function p(e) {
|
|
489
|
+
for (var t, n, r = 1, i = e.length, a = e[0] + ""; r < i;) {
|
|
490
|
+
for (t = e[r++] + "", n = o - t.length; n--; t = "0" + t);
|
|
491
|
+
a += t;
|
|
492
|
+
}
|
|
493
|
+
for (i = a.length; a.charCodeAt(--i) === 48;);
|
|
494
|
+
return a.slice(0, i + 1 || 1);
|
|
495
|
+
}
|
|
496
|
+
function m(e, t) {
|
|
497
|
+
var n, r, i = e.c, a = t.c, o = e.s, s = t.s, c = e.e, l = t.e;
|
|
498
|
+
if (!o || !s) return null;
|
|
499
|
+
if (n = i && !i[0], r = a && !a[0], n || r) return n ? r ? 0 : -s : o;
|
|
500
|
+
if (o != s) return o;
|
|
501
|
+
if (n = o < 0, r = c == l, !i || !a) return r ? 0 : !i ^ n ? 1 : -1;
|
|
502
|
+
if (!r) return c > l ^ n ? 1 : -1;
|
|
503
|
+
for (s = (c = i.length) < (l = a.length) ? c : l, o = 0; o < s; o++) if (i[o] != a[o]) return i[o] > a[o] ^ n ? 1 : -1;
|
|
504
|
+
return c == l ? 0 : c > l ^ n ? 1 : -1;
|
|
505
|
+
}
|
|
506
|
+
function h(e, t, n, a) {
|
|
507
|
+
if (e < t || e > n || e !== r(e)) throw Error(i + (a || "Argument") + (typeof e == "number" ? e < t || e > n ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(e));
|
|
508
|
+
}
|
|
509
|
+
function g(e) {
|
|
510
|
+
var t = e.c.length - 1;
|
|
511
|
+
return f(e.e / o) == t && e.c[t] % 2 != 0;
|
|
512
|
+
}
|
|
513
|
+
function _(e, t) {
|
|
514
|
+
return (e.length > 1 ? e.charAt(0) + "." + e.slice(1) : e) + (t < 0 ? "e" : "e+") + t;
|
|
515
|
+
}
|
|
516
|
+
function v(e, t, n) {
|
|
517
|
+
var r, i;
|
|
518
|
+
if (t < 0) {
|
|
519
|
+
for (i = n + "."; ++t; i += n);
|
|
520
|
+
e = i + e;
|
|
521
|
+
} else if (r = e.length, ++t > r) {
|
|
522
|
+
for (i = n, t -= r; --t; i += n);
|
|
523
|
+
e += i;
|
|
524
|
+
} else t < r && (e = e.slice(0, t) + "." + e.slice(t));
|
|
525
|
+
return e;
|
|
526
|
+
}
|
|
527
|
+
//#endregion
|
|
528
|
+
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`./address.cjs`),t=require(`../../errors/address.cjs`),n=require(`../../errors/call.cjs`),r=require(`../../errors/network.cjs`),i=require(`../../utils/starknet/starknet.cjs`),a=require(`./network.cjs`);let o=require(`starknet`);function s(e){return e.replace(`.stark`,``).split(`.`).map(e=>o.starknetId.useEncoded(e).toString(10))}function c(e){let t=a.getChainIdFromNetworkId(e);return o.starknetId.getStarknetIdContract(t)}function l(e,t){let r=c(t),a=s(e);try{let e={domain:a,hint:[]};return i.callSchema.parse({contractAddress:r,entrypoint:`domain_to_address`,calldata:e})}catch(e){throw new n.CallError({code:`NOT_VALID`,options:{error:e}})}}async function u(i,a,o){if(!a||!o)throw new r.NetworkError({code:`NO_NETWORK_OR_MULTICALL`});let s
|
|
1
|
+
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`./address.cjs`),t=require(`../../errors/address.cjs`),n=require(`../../errors/call.cjs`),r=require(`../../errors/network.cjs`),i=require(`../../utils/starknet/starknet.cjs`),a=require(`./network.cjs`);let o=require(`starknet`);function s(e){return e.replace(`.stark`,``).split(`.`).map(e=>o.starknetId.useEncoded(e).toString(10))}function c(e){let t=a.getChainIdFromNetworkId(e);return o.starknetId.getStarknetIdContract(t)}function l(e,t){let r=c(t),a=s(e);try{let e={domain:a,hint:[]};return i.callSchema.parse({contractAddress:r,entrypoint:`domain_to_address`,calldata:e})}catch(e){throw new n.CallError({code:`NOT_VALID`,options:{error:e}})}}async function u(i,a,o){if(!a||!o)throw new r.NetworkError({code:`NO_NETWORK_OR_MULTICALL`});let s;try{s=l(i,a)}catch(e){throw new n.CallError({code:`NOT_VALID`,options:{error:e}})}let c,u;try{c=await o.callContract(s),u=c[0]}catch{throw new t.AddressError({code:`STARKNAME_ERROR`})}if(e.isZeroAddress(u))throw new t.AddressError({code:`STARKNAME_NOT_FOUND`,message:`${i} not found`});if(!e.isValidAddress(u))throw new t.AddressError({code:`STARKNAME_INVALID_ADDRESS`,message:`${i} resolved to an invalid address (${u})`});return e.normalizeAddress(u)}exports.getAddressFromStarkName=u,exports.getCallFromStarkName=l,exports.getStarknetIdContractAddressFromNetworkId=c,exports.starkNameToCallDataDomain=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/starknet/starknet.cjs`),n=require(`../../chains/starknet/network.cjs`),r=require(`../../utils/url/urlWithQuery.cjs`),i=require(`./types.cjs`);let a=require(`starknet`),o=require(`url-join`);o=e.__toESM(o);var s=class{constructor(e=``,t){this.argentRelayerUrl=e,this.httpService=t}async buildRequestInit(e,t,n,r={}){let i=r.getAdditionalHeaders?await r.getAdditionalHeaders(e,t,n):{};return{body:n,headers:{"Content-Type":`application/json`,...i}}}async getExecutionData(e,i={}){let{useAvnu:s,isSubsidised:c}=i,{networkId:l}=e,u=l?{network:n.getArgentNetwork(l)}:void 0,d=s?(0,o.default)(this.getAvnuUrl(l),`/build-typed-data`):r.urlWithQuery([this.argentRelayerUrl,`/build-typed-data`],u),f=s?e.calls.map(e=>({contractAddress:a.num.toHex(e.contractAddress),calldata:a.CallData.toCalldata(e.calldata).map(e=>a.num.toHex(e)),entrypoint:e.entrypoint})):e.calls,p=c?null:e.feeTokenAddress===void 0?void 0:a.num.toHex(e.feeTokenAddress),m=c?null:e.maxFee===void 0?void 0:a.num.toHex(e.maxFee),h={calls:f,userAddress:e.accountAddress,gasTokenAddress:p,maxGasTokenAmount:m,accountClassHash:e.accountClassHash},g=a.json.stringify(h),_=await this.buildRequestInit(d,`POST`,g,i),v=await this.httpService.post(d,_),y=t.typedDataSchema.safeParse(v);if(!y.success)throw Error(`Invalid response from paymaster`);return y.data}getAvnuUrl(e){if(!e)throw Error(`Network id is required for Avnu paymaster`);let t
|
|
1
|
+
const e=require(`../../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/starknet/starknet.cjs`),n=require(`../../chains/starknet/network.cjs`),r=require(`../../utils/url/urlWithQuery.cjs`),i=require(`./types.cjs`);let a=require(`starknet`),o=require(`url-join`);o=e.__toESM(o);var s=class{constructor(e=``,t){this.argentRelayerUrl=e,this.httpService=t}async buildRequestInit(e,t,n,r={}){let i=r.getAdditionalHeaders?await r.getAdditionalHeaders(e,t,n):{};return{body:n,headers:{"Content-Type":`application/json`,...i}}}async getExecutionData(e,i={}){let{useAvnu:s,isSubsidised:c}=i,{networkId:l}=e,u=l?{network:n.getArgentNetwork(l)}:void 0,d=s?(0,o.default)(this.getAvnuUrl(l),`/build-typed-data`):r.urlWithQuery([this.argentRelayerUrl,`/build-typed-data`],u),f=s?e.calls.map(e=>({contractAddress:a.num.toHex(e.contractAddress),calldata:a.CallData.toCalldata(e.calldata).map(e=>a.num.toHex(e)),entrypoint:e.entrypoint})):e.calls,p=c?null:e.feeTokenAddress===void 0?void 0:a.num.toHex(e.feeTokenAddress),m=c?null:e.maxFee===void 0?void 0:a.num.toHex(e.maxFee),h={calls:f,userAddress:e.accountAddress,gasTokenAddress:p,maxGasTokenAmount:m,accountClassHash:e.accountClassHash},g=a.json.stringify(h),_=await this.buildRequestInit(d,`POST`,g,i),v=await this.httpService.post(d,_),y=t.typedDataSchema.safeParse(v);if(!y.success)throw Error(`Invalid response from paymaster`);return y.data}getAvnuUrl(e){if(!e)throw Error(`Network id is required for Avnu paymaster`);let t;if(e===`mainnet`||e===`mainnet-alpha`)t=`starknet`;else if(e===`sepolia`||e===`sepolia-alpha`)t=`sepolia`;else throw Error(`Invalid network id`);return`https://${t}.api.avnu.fi/paymaster/v1`}async execute(e,t={}){let{useAvnu:s,isSubsidised:c}=t,{networkId:l}=e,u=l?{network:n.getArgentNetwork(l)}:void 0,d=s?(0,o.default)(this.getAvnuUrl(l),`/execute`):r.urlWithQuery([this.argentRelayerUrl,`/execute`],u);c&&(d=r.urlWithQuery(d,{isSubsidised:`true`}));let f={signature:e.signature,userAddress:e.accountAddress,typedData:s?a.json.stringify(e.typedData):e.typedData,deploymentData:e.deploymentData},p=a.json.stringify(f),m=await this.buildRequestInit(d,`POST`,p,t),h=await this.httpService.post(d,m),g=i.paymasterExecuteResponse.safeParse(h);if(!g.success)throw Error(`Invalid response from paymaster`);return g.data.transactionHash}async deployAccount(e,t={}){let{useAvnu:s,isSubsidised:c}=t,{networkId:l}=e,u=l?{network:n.getArgentNetwork(l)}:void 0,d=s?(0,o.default)(this.getAvnuUrl(l),`/execute`):r.urlWithQuery([this.argentRelayerUrl,`/execute`],u);c&&(d=r.urlWithQuery(d,{isSubsidised:`true`}));let f={userAddress:e.accountAddress,deploymentData:e.deploymentData},p=a.json.stringify(f),m=await this.buildRequestInit(d,`POST`,p,t),h=await this.httpService.post(d,m),g=i.paymasterExecuteResponse.safeParse(h);if(!g.success)throw Error(`Invalid response from paymaster`);return g.data.transactionHash}async canUserSubsidise(e,t={}){let n=r.urlWithQuery([this.argentRelayerUrl,`/can-user-subsidise`]),o=a.json.stringify(e),s=await this.buildRequestInit(n,`POST`,o,t),c=await this.httpService.post(n,s),l=i.canSubsidiseResponse.safeParse(c);if(!l.success)throw Error(`Invalid response from paymaster`);return l.data.canSubsidise}};exports.PaymasterService=s;
|
|
@@ -36,7 +36,7 @@ var l = class {
|
|
|
36
36
|
}
|
|
37
37
|
getAvnuUrl(e) {
|
|
38
38
|
if (!e) throw Error("Network id is required for Avnu paymaster");
|
|
39
|
-
let t
|
|
39
|
+
let t;
|
|
40
40
|
if (e === "mainnet" || e === "mainnet-alpha") t = "starknet";
|
|
41
41
|
else if (e === "sepolia" || e === "sepolia-alpha") t = "sepolia";
|
|
42
42
|
else throw Error("Invalid network id");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./isNumeric.cjs`),t=require(`../../../node_modules/.pnpm/bignumber.js@
|
|
1
|
+
const e=require(`./isNumeric.cjs`),t=require(`../../../node_modules/.pnpm/bignumber.js@10.0.2/node_modules/bignumber.js/dist/bignumber.cjs`);var n={CURRENCY:{minDecimalPlaces:2,maxDecimalPlaces:10,minDecimalSignificantDigits:2,decimalPlacesWhenZero:2,allowLeadingZerosInDecimalPart:!0,groupSeparator:`,`,decimalSeparator:`.`},TOKEN:{minDecimalPlaces:4,maxDecimalPlaces:16,minDecimalSignificantDigits:2,decimalPlacesWhenZero:1,allowLeadingZerosInDecimalPart:!0,groupSeparator:`,`,decimalSeparator:`.`}},r=(e,t)=>o(e,{...n.CURRENCY,...t||{}}),i=(e,t)=>o(e,{...n.TOKEN,...t||{}}),a={groupSize:3,decimalSeparator:`.`,groupSeparator:`,`},o=(r,{minDecimalPlaces:i,maxDecimalPlaces:o,minDecimalSignificantDigits:s,decimalPlacesWhenZero:c,allowLeadingZerosInDecimalPart:l,groupSeparator:u,decimalSeparator:d=a.decimalSeparator,maxNrDigits:f,roundingMode:p}=n.CURRENCY)=>{if(!e.isNumeric(r))return null;let m={...a,groupSeparator:u,decimalSeparator:d},h=new t.default(typeof r==`bigint`?r.toString():r),g,_=`0.${``.padStart(c-1,`0`)}1`;if(h.lt(new t.default(_))&&!l)g=`0.${``.padStart(c,`0`)}`;else if(h.gte(1))g=i===0?h.toFormat(i,t.default.ROUND_FLOOR,m):p?h.toFormat(i,p,m):h.toFormat(i,m);else{let e=(p?h.toFormat(o,p,m):h.toFormat(o,m)).split(d)[1].match(/^0+/),t=l&&e&&e.length?e[0].length:0,n=Math.max(t+s,i);g=p?h.toFormat(n,p,m):h.toFormat(n,m)}let[v,y]=g.split(d),b=v;if(y){let e=y.replace(/0+$/,``);b+=e?`.${e}`:``}let x=1+g.indexOf(`.`)+c;if(b.length<x&&(b=g.substring(0,x)),f){let e=b.replace(RegExp(`[${u}${d}]`,`g`),``).length;if(v.replace(RegExp(`[${u}]`,`g`),``).length>f)b=v;else if(e>f){let t=e-f,n=b.indexOf(d);if(n!==-1){let e=Math.max(0,b.length-n-1-t);b=b.substring(0,n+1+e)}}}return b};exports.prettifyCurrencyNumber=r,exports.prettifyNumber=o,exports.prettifyNumberConfig=n,exports.prettifyTokenNumber=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNumeric as e } from "./isNumeric.js";
|
|
2
|
-
import t from "../../../node_modules/.pnpm/bignumber.js@
|
|
2
|
+
import t from "../../../node_modules/.pnpm/bignumber.js@10.0.2/node_modules/bignumber.js/dist/bignumber.js";
|
|
3
3
|
//#region src/utils/number/prettifyNumber.ts
|
|
4
4
|
var n = {
|
|
5
5
|
CURRENCY: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./schemas.cjs`);let n=require(`async-retry`);n=e.__toESM(n);async function r(e,r,i={retries:5,minTimeout:5e3}){return(0,n.default)(async n=>{let i
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./schemas.cjs`);let n=require(`async-retry`);n=e.__toESM(n);async function r(e,r,i={retries:5,minTimeout:5e3}){return(0,n.default)(async n=>{let i;try{i=await e()}catch{return n(Error(`Error fetching`)),null}let a=t.safeParseAndWarn(r,i);if(!a.success)return n(Error(`Error parsing response`)),null;if(a.data.status!==`initialised`)throw Error(`Not initialised yet`);return a.data},i)}exports.retryUntilInitialised=r;
|