/* esm.sh - bignumber.js@9.3.1 */
var ve=Object.create;var Ae=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(C,R)=>()=>(R||C((R={exports:{}}).exports,R),R.exports);var Te=(C,R,K,ie)=>{if(R&&typeof R=="object"||typeof R=="function")for(let P of Se(R))!Re.call(C,P)&&P!==K&&Ae(C,P,{get:()=>R[P],enumerable:!(ie=Be(R,P))||ie.enumerable});return C};var De=(C,R,K)=>(K=C!=null?ve(Ie(C)):{},Te(R||!C||!C.__esModule?Ae(K,"default",{value:C,enumerable:!0}):K,C));var _e=Me((xe,oe)=>{(function(C){"use strict";var R,K=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ie=Math.ceil,P=Math.floor,G="[BigNumber Error] ",Oe=G+"Number primitive has more than 15 significant digits: ",X=1e14,N=14,ue=9007199254740991,ce=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Q=1e7,L=1e9;function de(O){var E,v,M,p=h.prototype={constructor:h,toString:null,valueOf:null},T=new h(1),x=20,B=4,F=-7,q=21,b=-1e7,V=1e7,ee=!1,ne=1,Z=0,ae={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},re="0123456789abcdefghijklmnopqrstuvwxyz",he=!0;function h(e,r){var i,o,t,l,c,n,f,u,s=this;if(!(s instanceof h))return new h(e,r);if(r==null){if(e&&e._isBigNumber===!0){s.s=e.s,!e.c||e.e>V?s.c=s.e=null:e.e<b?s.c=[s.e=0]:(s.e=e.e,s.c=e.c.slice());return}if((n=typeof e=="number")&&e*0==0){if(s.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,c=e;c>=10;c/=10,l++);l>V?s.c=s.e=null:(s.e=l,s.c=[e]);return}u=String(e)}else{if(!K.test(u=String(e)))return M(s,u,n);s.s=u.charCodeAt(0)==45?(u=u.slice(1),-1):1}(l=u.indexOf("."))>-1&&(u=u.replace(".","")),(c=u.search(/e/i))>0?(l<0&&(l=c),l+=+u.slice(c+1),u=u.substring(0,c)):l<0&&(l=u.length)}else{if(_(r,2,re.length,"Base"),r==10&&he)return s=new h(e),z(s,x+s.e+1,B);if(u=String(e),n=typeof e=="number"){if(e*0!=0)return M(s,u,n,r);if(s.s=1/e<0?(u=u.slice(1),-1):1,h.DEBUG&&u.replace(/^0\.0*|\./,"").length>15)throw Error(Oe+e)}else s.s=u.charCodeAt(0)===45?(u=u.slice(1),-1):1;for(i=re.slice(0,r),l=c=0,f=u.length;c<f;c++)if(i.indexOf(o=u.charAt(c))<0){if(o=="."){if(c>l){l=f;continue}}else if(!t&&(u==u.toUpperCase()&&(u=u.toLowerCase())||u==u.toLowerCase()&&(u=u.toUpperCase()))){t=!0,c=-1,l=0;continue}return M(s,String(e),n,r)}n=!1,u=v(u,r,10,s.s),(l=u.indexOf("."))>-1?u=u.replace(".",""):l=u.length}for(c=0;u.charCodeAt(c)===48;c++);for(f=u.length;u.charCodeAt(--f)===48;);if(u=u.slice(c,++f)){if(f-=c,n&&h.DEBUG&&f>15&&(e>ue||e!==P(e)))throw Error(Oe+s.s*e);if((l=l-c-1)>V)s.c=s.e=null;else if(l<b)s.c=[s.e=0];else{if(s.e=l,s.c=[],c=(l+1)%N,l<0&&(c+=N),c<f){for(c&&s.c.push(+u.slice(0,c)),f-=N;c<f;)s.c.push(+u.slice(c,c+=N));c=N-(u=u.slice(c)).length}else c-=f;for(;c--;u+="0");s.c.push(+u)}}else s.c=[s.e=0]}h.clone=de,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 r,i;if(e!=null)if(typeof e=="object"){if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(i=e[r],_(i,0,L,r),x=i),e.hasOwnProperty(r="ROUNDING_MODE")&&(i=e[r],_(i,0,8,r),B=i),e.hasOwnProperty(r="EXPONENTIAL_AT")&&(i=e[r],i&&i.pop?(_(i[0],-L,0,r),_(i[1],0,L,r),F=i[0],q=i[1]):(_(i,-L,L,r),F=-(q=i<0?-i:i))),e.hasOwnProperty(r="RANGE"))if(i=e[r],i&&i.pop)_(i[0],-L,-1,r),_(i[1],1,L,r),b=i[0],V=i[1];else if(_(i,-L,L,r),i)b=-(V=i<0?-i:i);else throw Error(G+r+" cannot be zero: "+i);if(e.hasOwnProperty(r="CRYPTO"))if(i=e[r],i===!!i)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))ee=i;else throw ee=!i,Error(G+"crypto unavailable");else ee=i;else throw Error(G+r+" not true or false: "+i);if(e.hasOwnProperty(r="MODULO_MODE")&&(i=e[r],_(i,0,9,r),ne=i),e.hasOwnProperty(r="POW_PRECISION")&&(i=e[r],_(i,0,L,r),Z=i),e.hasOwnProperty(r="FORMAT"))if(i=e[r],typeof i=="object")ae=i;else throw Error(G+r+" not an object: "+i);if(e.hasOwnProperty(r="ALPHABET"))if(i=e[r],typeof i=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(i))he=i.slice(0,10)=="0123456789",re=i;else throw Error(G+r+" invalid: "+i)}else throw Error(G+"Object expected: "+e);return{DECIMAL_PLACES:x,ROUNDING_MODE:B,EXPONENTIAL_AT:[F,q],RANGE:[b,V],CRYPTO:ee,MODULO_MODE:ne,POW_PRECISION:Z,FORMAT:ae,ALPHABET:re}},h.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!h.DEBUG)return!0;var r,i,o=e.c,t=e.e,l=e.s;e:if({}.toString.call(o)=="[object Array]"){if((l===1||l===-1)&&t>=-L&&t<=L&&t===P(t)){if(o[0]===0){if(t===0&&o.length===1)return!0;break e}if(r=(t+1)%N,r<1&&(r+=N),String(o[0]).length==r){for(r=0;r<o.length;r++)if(i=o[r],i<0||i>=X||i!==P(i))break e;if(i!==0)return!0}}}else if(o===null&&t===null&&(l===null||l===1||l===-1))return!0;throw Error(G+"Invalid BigNumber: "+e)},h.maximum=h.max=function(){return me(arguments,-1)},h.minimum=h.min=function(){return me(arguments,1)},h.random=(function(){var e=9007199254740992,r=Math.random()*e&2097151?function(){return P(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(i){var o,t,l,c,n,f=0,u=[],s=new h(T);if(i==null?i=x:_(i,0,L),c=ie(i/N),ee)if(crypto.getRandomValues){for(o=crypto.getRandomValues(new Uint32Array(c*=2));f<c;)n=o[f]*131072+(o[f+1]>>>11),n>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),o[f]=t[0],o[f+1]=t[1]):(u.push(n%1e14),f+=2);f=c/2}else if(crypto.randomBytes){for(o=crypto.randomBytes(c*=7);f<c;)n=(o[f]&31)*281474976710656+o[f+1]*1099511627776+o[f+2]*4294967296+o[f+3]*16777216+(o[f+4]<<16)+(o[f+5]<<8)+o[f+6],n>=9e15?crypto.randomBytes(7).copy(o,f):(u.push(n%1e14),f+=7);f=c/7}else throw ee=!1,Error(G+"crypto unavailable");if(!ee)for(;f<c;)n=r(),n<9e15&&(u[f++]=n%1e14);for(c=u[--f],i%=N,c&&i&&(n=ce[N-i],u[f]=P(c/n)*n);u[f]===0;u.pop(),f--);if(f<0)u=[l=0];else{for(l=-1;u[0]===0;u.splice(0,1),l-=N);for(f=1,n=u[0];n>=10;n/=10,f++);f<N&&(l-=N-f)}return s.e=l,s.c=u,s}})(),h.sum=function(){for(var e=1,r=arguments,i=new h(r[0]);e<r.length;)i=i.plus(r[e++]);return i},v=(function(){var e="0123456789";function r(i,o,t,l){for(var c,n=[0],f,u=0,s=i.length;u<s;){for(f=n.length;f--;n[f]*=o);for(n[0]+=l.indexOf(i.charAt(u++)),c=0;c<n.length;c++)n[c]>t-1&&(n[c+1]==null&&(n[c+1]=0),n[c+1]+=n[c]/t|0,n[c]%=t)}return n.reverse()}return function(i,o,t,l,c){var n,f,u,s,a,g,w,m,S=i.indexOf("."),D=x,d=B;for(S>=0&&(s=Z,Z=0,i=i.replace(".",""),m=new h(o),g=m.pow(i.length-S),Z=s,m.c=r(Y($(g.c),g.e,"0"),10,t,e),m.e=m.c.length),w=r(i,o,t,c?(n=re,e):(n=e,re)),u=s=w.length;w[--s]==0;w.pop());if(!w[0])return n.charAt(0);if(S<0?--u:(g.c=w,g.e=u,g.s=l,g=E(g,m,D,d,t),w=g.c,a=g.r,u=g.e),f=u+D+1,S=w[f],s=t/2,a=a||f<0||w[f+1]!=null,a=d<4?(S!=null||a)&&(d==0||d==(g.s<0?3:2)):S>s||S==s&&(d==4||a||d==6&&w[f-1]&1||d==(g.s<0?8:7)),f<1||!w[0])i=a?Y(n.charAt(1),-D,n.charAt(0)):n.charAt(0);else{if(w.length=f,a)for(--t;++w[--f]>t;)w[f]=0,f||(++u,w=[1].concat(w));for(s=w.length;!w[--s];);for(S=0,i="";S<=s;i+=n.charAt(w[S++]));i=Y(i,u,n.charAt(0))}return i}})(),E=(function(){function e(o,t,l){var c,n,f,u,s=0,a=o.length,g=t%Q,w=t/Q|0;for(o=o.slice();a--;)f=o[a]%Q,u=o[a]/Q|0,c=w*f+u*g,n=g*f+c%Q*Q+s,s=(n/l|0)+(c/Q|0)+w*u,o[a]=n%l;return s&&(o=[s].concat(o)),o}function r(o,t,l,c){var n,f;if(l!=c)f=l>c?1:-1;else for(n=f=0;n<l;n++)if(o[n]!=t[n]){f=o[n]>t[n]?1:-1;break}return f}function i(o,t,l,c){for(var n=0;l--;)o[l]-=n,n=o[l]<t[l]?1:0,o[l]=n*c+o[l]-t[l];for(;!o[0]&&o.length>1;o.splice(0,1));}return function(o,t,l,c,n){var f,u,s,a,g,w,m,S,D,d,A,U,se,we,Ne,W,te,H=o.s==t.s?1:-1,k=o.c,I=t.c;if(!k||!k[0]||!I||!I[0])return new h(!o.s||!t.s||(k?I&&k[0]==I[0]:!I)?NaN:k&&k[0]==0||!I?H*0:H/0);for(S=new h(H),D=S.c=[],u=o.e-t.e,H=l+u+1,n||(n=X,u=y(o.e/N)-y(t.e/N),H=H/N|0),s=0;I[s]==(k[s]||0);s++);if(I[s]>(k[s]||0)&&u--,H<0)D.push(1),a=!0;else{for(we=k.length,W=I.length,s=0,H+=2,g=P(n/(I[0]+1)),g>1&&(I=e(I,g,n),k=e(k,g,n),W=I.length,we=k.length),se=W,d=k.slice(0,W),A=d.length;A<W;d[A++]=0);te=I.slice(),te=[0].concat(te),Ne=I[0],I[1]>=n/2&&Ne++;do{if(g=0,f=r(I,d,W,A),f<0){if(U=d[0],W!=A&&(U=U*n+(d[1]||0)),g=P(U/Ne),g>1)for(g>=n&&(g=n-1),w=e(I,g,n),m=w.length,A=d.length;r(w,d,m,A)==1;)g--,i(w,W<m?te:I,m,n),m=w.length,f=1;else g==0&&(f=g=1),w=I.slice(),m=w.length;if(m<A&&(w=[0].concat(w)),i(d,w,A,n),A=d.length,f==-1)for(;r(I,d,W,A)<1;)g++,i(d,W<A?te:I,A,n),A=d.length}else f===0&&(g++,d=[0]);D[s++]=g,d[0]?d[A++]=k[se]||0:(d=[k[se]],A=1)}while((se++<we||d[0]!=null)&&H--);a=d[0]!=null,D[0]||D.splice(0,1)}if(n==X){for(s=1,H=D[0];H>=10;H/=10,s++);z(S,l+(S.e=s+u*N-1)+1,c,a)}else S.e=u,S.r=+a;return S}})();function pe(e,r,i,o){var t,l,c,n,f;if(i==null?i=B:_(i,0,8),!e.c)return e.toString();if(t=e.c[0],c=e.e,r==null)f=$(e.c),f=o==1||o==2&&(c<=F||c>=q)?le(f,c):Y(f,c,"0");else if(e=z(new h(e),r,i),l=e.e,f=$(e.c),n=f.length,o==1||o==2&&(r<=l||l<=F)){for(;n<r;f+="0",n++);f=le(f,l)}else if(r-=c+(o===2&&l>c),f=Y(f,l,"0"),l+1>n){if(--r>0)for(f+=".";r--;f+="0");}else if(r+=l-n,r>0)for(l+1==n&&(f+=".");r--;f+="0");return e.s<0&&t?"-"+f:f}function me(e,r){for(var i,o,t=1,l=new h(e[0]);t<e.length;t++)o=new h(e[t]),(!o.s||(i=j(l,o))===r||i===0&&l.s===r)&&(l=o);return l}function ge(e,r,i){for(var o=1,t=r.length;!r[--t];r.pop());for(t=r[0];t>=10;t/=10,o++);return(i=o+i*N-1)>V?e.c=e.e=null:i<b?e.c=[e.e=0]:(e.e=i,e.c=r),e}M=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,r=/^([^.]+)\.$/,i=/^\.([^.]+)$/,o=/^-?(Infinity|NaN)$/,t=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(l,c,n,f){var u,s=n?c:c.replace(t,"");if(o.test(s))l.s=isNaN(s)?null:s<0?-1:1;else{if(!n&&(s=s.replace(e,function(a,g,w){return u=(w=w.toLowerCase())=="x"?16:w=="b"?2:8,!f||f==u?g:a}),f&&(u=f,s=s.replace(r,"$1").replace(i,"0.$1")),c!=s))return new h(s,u);if(h.DEBUG)throw Error(G+"Not a"+(f?" base "+f:"")+" number: "+c);l.s=null}l.c=l.e=null}})();function z(e,r,i,o){var t,l,c,n,f,u,s,a=e.c,g=ce;if(a){e:{for(t=1,n=a[0];n>=10;n/=10,t++);if(l=r-t,l<0)l+=N,c=r,f=a[u=0],s=P(f/g[t-c-1]%10);else if(u=ie((l+1)/N),u>=a.length)if(o){for(;a.length<=u;a.push(0));f=s=0,t=1,l%=N,c=l-N+1}else break e;else{for(f=n=a[u],t=1;n>=10;n/=10,t++);l%=N,c=l-N+t,s=c<0?0:P(f/g[t-c-1]%10)}if(o=o||r<0||a[u+1]!=null||(c<0?f:f%g[t-c-1]),o=i<4?(s||o)&&(i==0||i==(e.s<0?3:2)):s>5||s==5&&(i==4||o||i==6&&(l>0?c>0?f/g[t-c]:0:a[u-1])%10&1||i==(e.s<0?8:7)),r<1||!a[0])return a.length=0,o?(r-=e.e+1,a[0]=g[(N-r%N)%N],e.e=-r||0):a[0]=e.e=0,e;if(l==0?(a.length=u,n=1,u--):(a.length=u+1,n=g[N-l],a[u]=c>0?P(f/g[t-c]%g[c])*n:0),o)for(;;)if(u==0){for(l=1,c=a[0];c>=10;c/=10,l++);for(c=a[0]+=n,n=1;c>=10;c/=10,n++);l!=n&&(e.e++,a[0]==X&&(a[0]=1));break}else{if(a[u]+=n,a[u]!=X)break;a[u--]=0,n=1}for(l=a.length;a[--l]===0;a.pop());}e.e>V?e.c=e.e=null:e.e<b&&(e.c=[e.e=0])}return e}function J(e){var r,i=e.e;return i===null?e.toString():(r=$(e.c),r=i<=F||i>=q?le(r,i):Y(r,i,"0"),e.s<0?"-"+r:r)}return p.absoluteValue=p.abs=function(){var e=new h(this);return e.s<0&&(e.s=1),e},p.comparedTo=function(e,r){return j(this,new h(e,r))},p.decimalPlaces=p.dp=function(e,r){var i,o,t,l=this;if(e!=null)return _(e,0,L),r==null?r=B:_(r,0,8),z(new h(l),e+l.e+1,r);if(!(i=l.c))return null;if(o=((t=i.length-1)-y(this.e/N))*N,t=i[t])for(;t%10==0;t/=10,o--);return o<0&&(o=0),o},p.dividedBy=p.div=function(e,r){return E(this,new h(e,r),x,B)},p.dividedToIntegerBy=p.idiv=function(e,r){return E(this,new h(e,r),0,1)},p.exponentiatedBy=p.pow=function(e,r){var i,o,t,l,c,n,f,u,s,a=this;if(e=new h(e),e.c&&!e.isInteger())throw Error(G+"Exponent not an integer: "+J(e));if(r!=null&&(r=new h(r)),n=e.e>14,!a.c||!a.c[0]||a.c[0]==1&&!a.e&&a.c.length==1||!e.c||!e.c[0])return s=new h(Math.pow(+J(a),n?e.s*(2-fe(e)):+J(e))),r?s.mod(r):s;if(f=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new h(NaN);o=!f&&a.isInteger()&&r.isInteger(),o&&(a=a.mod(r))}else{if(e.e>9&&(a.e>0||a.e<-1||(a.e==0?a.c[0]>1||n&&a.c[1]>=24e7:a.c[0]<8e13||n&&a.c[0]<=9999975e7)))return l=a.s<0&&fe(e)?-0:0,a.e>-1&&(l=1/l),new h(f?1/l:l);Z&&(l=ie(Z/N+2))}for(n?(i=new h(.5),f&&(e.s=1),u=fe(e)):(t=Math.abs(+J(e)),u=t%2),s=new h(T);;){if(u){if(s=s.times(a),!s.c)break;l?s.c.length>l&&(s.c.length=l):o&&(s=s.mod(r))}if(t){if(t=P(t/2),t===0)break;u=t%2}else if(e=e.times(i),z(e,e.e+1,1),e.e>14)u=fe(e);else{if(t=+J(e),t===0)break;u=t%2}a=a.times(a),l?a.c&&a.c.length>l&&(a.c.length=l):o&&(a=a.mod(r))}return o?s:(f&&(s=T.div(s)),r?s.mod(r):l?z(s,Z,B,c):s)},p.integerValue=function(e){var r=new h(this);return e==null?e=B:_(e,0,8),z(r,r.e+1,e)},p.isEqualTo=p.eq=function(e,r){return j(this,new h(e,r))===0},p.isFinite=function(){return!!this.c},p.isGreaterThan=p.gt=function(e,r){return j(this,new h(e,r))>0},p.isGreaterThanOrEqualTo=p.gte=function(e,r){return(r=j(this,new h(e,r)))===1||r===0},p.isInteger=function(){return!!this.c&&y(this.e/N)>this.c.length-2},p.isLessThan=p.lt=function(e,r){return j(this,new h(e,r))<0},p.isLessThanOrEqualTo=p.lte=function(e,r){return(r=j(this,new h(e,r)))===-1||r===0},p.isNaN=function(){return!this.s},p.isNegative=function(){return this.s<0},p.isPositive=function(){return this.s>0},p.isZero=function(){return!!this.c&&this.c[0]==0},p.minus=function(e,r){var i,o,t,l,c=this,n=c.s;if(e=new h(e,r),r=e.s,!n||!r)return new h(NaN);if(n!=r)return e.s=-r,c.plus(e);var f=c.e/N,u=e.e/N,s=c.c,a=e.c;if(!f||!u){if(!s||!a)return s?(e.s=-r,e):new h(a?c:NaN);if(!s[0]||!a[0])return a[0]?(e.s=-r,e):new h(s[0]?c:B==3?-0:0)}if(f=y(f),u=y(u),s=s.slice(),n=f-u){for((l=n<0)?(n=-n,t=s):(u=f,t=a),t.reverse(),r=n;r--;t.push(0));t.reverse()}else for(o=(l=(n=s.length)<(r=a.length))?n:r,n=r=0;r<o;r++)if(s[r]!=a[r]){l=s[r]<a[r];break}if(l&&(t=s,s=a,a=t,e.s=-e.s),r=(o=a.length)-(i=s.length),r>0)for(;r--;s[i++]=0);for(r=X-1;o>n;){if(s[--o]<a[o]){for(i=o;i&&!s[--i];s[i]=r);--s[i],s[o]+=X}s[o]-=a[o]}for(;s[0]==0;s.splice(0,1),--u);return s[0]?ge(e,s,u):(e.s=B==3?-1:1,e.c=[e.e=0],e)},p.modulo=p.mod=function(e,r){var i,o,t=this;return e=new h(e,r),!t.c||!e.s||e.c&&!e.c[0]?new h(NaN):!e.c||t.c&&!t.c[0]?new h(t):(ne==9?(o=e.s,e.s=1,i=E(t,e,0,3),e.s=o,i.s*=o):i=E(t,e,0,ne),e=t.minus(i.times(e)),!e.c[0]&&ne==1&&(e.s=t.s),e)},p.multipliedBy=p.times=function(e,r){var i,o,t,l,c,n,f,u,s,a,g,w,m,S,D,d=this,A=d.c,U=(e=new h(e,r)).c;if(!A||!U||!A[0]||!U[0])return!d.s||!e.s||A&&!A[0]&&!U||U&&!U[0]&&!A?e.c=e.e=e.s=null:(e.s*=d.s,!A||!U?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(o=y(d.e/N)+y(e.e/N),e.s*=d.s,f=A.length,a=U.length,f<a&&(m=A,A=U,U=m,t=f,f=a,a=t),t=f+a,m=[];t--;m.push(0));for(S=X,D=Q,t=a;--t>=0;){for(i=0,g=U[t]%D,w=U[t]/D|0,c=f,l=t+c;l>t;)u=A[--c]%D,s=A[c]/D|0,n=w*u+s*g,u=g*u+n%D*D+m[l]+i,i=(u/S|0)+(n/D|0)+w*s,m[l--]=u%S;m[l]=i}return i?++o:m.splice(0,1),ge(e,m,o)},p.negated=function(){var e=new h(this);return e.s=-e.s||null,e},p.plus=function(e,r){var i,o=this,t=o.s;if(e=new h(e,r),r=e.s,!t||!r)return new h(NaN);if(t!=r)return e.s=-r,o.minus(e);var l=o.e/N,c=e.e/N,n=o.c,f=e.c;if(!l||!c){if(!n||!f)return new h(t/0);if(!n[0]||!f[0])return f[0]?e:new h(n[0]?o:t*0)}if(l=y(l),c=y(c),n=n.slice(),t=l-c){for(t>0?(c=l,i=f):(t=-t,i=n),i.reverse();t--;i.push(0));i.reverse()}for(t=n.length,r=f.length,t-r<0&&(i=f,f=n,n=i,r=t),t=0;r;)t=(n[--r]=n[r]+f[r]+t)/X|0,n[r]=X===n[r]?0:n[r]%X;return t&&(n=[t].concat(n),++c),ge(e,n,c)},p.precision=p.sd=function(e,r){var i,o,t,l=this;if(e!=null&&e!==!!e)return _(e,1,L),r==null?r=B:_(r,0,8),z(new h(l),e,r);if(!(i=l.c))return null;if(t=i.length-1,o=t*N+1,t=i[t]){for(;t%10==0;t/=10,o--);for(t=i[0];t>=10;t/=10,o++);}return e&&l.e+1>o&&(o=l.e+1),o},p.shiftedBy=function(e){return _(e,-ue,ue),this.times("1e"+e)},p.squareRoot=p.sqrt=function(){var e,r,i,o,t,l=this,c=l.c,n=l.s,f=l.e,u=x+4,s=new h("0.5");if(n!==1||!c||!c[0])return new h(!n||n<0&&(!c||c[0])?NaN:c?l:1/0);if(n=Math.sqrt(+J(l)),n==0||n==1/0?(r=$(c),(r.length+f)%2==0&&(r+="0"),n=Math.sqrt(+r),f=y((f+1)/2)-(f<0||f%2),n==1/0?r="5e"+f:(r=n.toExponential(),r=r.slice(0,r.indexOf("e")+1)+f),i=new h(r)):i=new h(n+""),i.c[0]){for(f=i.e,n=f+u,n<3&&(n=0);;)if(t=i,i=s.times(t.plus(E(l,t,u,1))),$(t.c).slice(0,n)===(r=$(i.c)).slice(0,n))if(i.e<f&&--n,r=r.slice(n-3,n+1),r=="9999"||!o&&r=="4999"){if(!o&&(z(t,t.e+x+2,0),t.times(t).eq(l))){i=t;break}u+=4,n+=4,o=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(z(i,i.e+x+2,1),e=!i.times(i).eq(l));break}}return z(i,i.e+x+1,B,e)},p.toExponential=function(e,r){return e!=null&&(_(e,0,L),e++),pe(this,e,r,1)},p.toFixed=function(e,r){return e!=null&&(_(e,0,L),e=e+this.e+1),pe(this,e,r)},p.toFormat=function(e,r,i){var o,t=this;if(i==null)e!=null&&r&&typeof r=="object"?(i=r,r=null):e&&typeof e=="object"?(i=e,e=r=null):i=ae;else if(typeof i!="object")throw Error(G+"Argument not an object: "+i);if(o=t.toFixed(e,r),t.c){var l,c=o.split("."),n=+i.groupSize,f=+i.secondaryGroupSize,u=i.groupSeparator||"",s=c[0],a=c[1],g=t.s<0,w=g?s.slice(1):s,m=w.length;if(f&&(l=n,n=f,f=l,m-=l),n>0&&m>0){for(l=m%n||n,s=w.substr(0,l);l<m;l+=n)s+=u+w.substr(l,n);f>0&&(s+=u+w.slice(l)),g&&(s="-"+s)}o=a?s+(i.decimalSeparator||"")+((f=+i.fractionGroupSize)?a.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+(i.fractionGroupSeparator||"")):a):s}return(i.prefix||"")+o+(i.suffix||"")},p.toFraction=function(e){var r,i,o,t,l,c,n,f,u,s,a,g,w=this,m=w.c;if(e!=null&&(n=new h(e),!n.isInteger()&&(n.c||n.s!==1)||n.lt(T)))throw Error(G+"Argument "+(n.isInteger()?"out of range: ":"not an integer: ")+J(n));if(!m)return new h(w);for(r=new h(T),u=i=new h(T),o=f=new h(T),g=$(m),l=r.e=g.length-w.e-1,r.c[0]=ce[(c=l%N)<0?N+c:c],e=!e||n.comparedTo(r)>0?l>0?r:u:n,c=V,V=1/0,n=new h(g),f.c[0]=0;s=E(n,r,0,1),t=i.plus(s.times(o)),t.comparedTo(e)!=1;)i=o,o=t,u=f.plus(s.times(t=u)),f=t,r=n.minus(s.times(t=r)),n=t;return t=E(e.minus(i),o,0,1),f=f.plus(t.times(u)),i=i.plus(t.times(o)),f.s=u.s=w.s,l=l*2,a=E(u,o,l,B).minus(w).abs().comparedTo(E(f,i,l,B).minus(w).abs())<1?[u,o]:[f,i],V=c,a},p.toNumber=function(){return+J(this)},p.toPrecision=function(e,r){return e!=null&&_(e,1,L),pe(this,e,r,2)},p.toString=function(e){var r,i=this,o=i.s,t=i.e;return t===null?o?(r="Infinity",o<0&&(r="-"+r)):r="NaN":(e==null?r=t<=F||t>=q?le($(i.c),t):Y($(i.c),t,"0"):e===10&&he?(i=z(new h(i),x+t+1,B),r=Y($(i.c),i.e,"0")):(_(e,2,re.length,"Base"),r=v(Y($(i.c),t,"0"),10,e,o,!0)),o<0&&i.c[0]&&(r="-"+r)),r},p.valueOf=p.toJSON=function(){return J(this)},p._isBigNumber=!0,O!=null&&h.set(O),h}function y(O){var E=O|0;return O>0||O===E?E:E-1}function $(O){for(var E,v,M=1,p=O.length,T=O[0]+"";M<p;){for(E=O[M++]+"",v=N-E.length;v--;E="0"+E);T+=E}for(p=T.length;T.charCodeAt(--p)===48;);return T.slice(0,p+1||1)}function j(O,E){var v,M,p=O.c,T=E.c,x=O.s,B=E.s,F=O.e,q=E.e;if(!x||!B)return null;if(v=p&&!p[0],M=T&&!T[0],v||M)return v?M?0:-B:x;if(x!=B)return x;if(v=x<0,M=F==q,!p||!T)return M?0:!p^v?1:-1;if(!M)return F>q^v?1:-1;for(B=(F=p.length)<(q=T.length)?F:q,x=0;x<B;x++)if(p[x]!=T[x])return p[x]>T[x]^v?1:-1;return F==q?0:F>q^v?1:-1}function _(O,E,v,M){if(O<E||O>v||O!==P(O))throw Error(G+(M||"Argument")+(typeof O=="number"?O<E||O>v?" out of range: ":" not an integer: ":" not a primitive number: ")+String(O))}function fe(O){var E=O.c.length-1;return y(O.e/N)==E&&O.c[E]%2!=0}function le(O,E){return(O.length>1?O.charAt(0)+"."+O.slice(1):O)+(E<0?"e":"e+")+E}function Y(O,E,v){var M,p;if(E<0){for(p=v+".";++E;p+=v);O=p+O}else if(M=O.length,++E>M){for(p=v,E-=M;--E;p+=v);O+=p}else E<M&&(O=O.slice(0,E)+"."+O.slice(E));return O}R=de(),R.default=R.BigNumber=R,typeof define=="function"&&define.amd?define(function(){return R}):typeof oe<"u"&&oe.exports?oe.exports=R:(C||(C=typeof self<"u"&&self?self:window),C.BigNumber=R)})(xe)});var Ee=De(_e()),Le=Ee.default??Ee;export{Le as default};
//# sourceMappingURL=bignumber.mjs.map