function q(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function N(t,r){if((a=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"))<0)return null;var a,n=t.slice(0,a);return[n.length>1?n[0]+n.slice(2):n,+t.slice(a+1)]}function B(t){return t=N(Math.abs(t)),t?t[1]:NaN}function H(t,r){return function(a,n){for(var o=a.length,l=[],m=0,e=t[0],y=0;o>0&&e>0&&(y+e+1>n&&(e=Math.max(1,n-y)),l.push(a.substring(o-=e,o+e)),!((y+=e+1)>n));)e=t[m=(m+1)%t.length];return l.reverse().join(r)}}function J(t){return function(r){return r.replace(/[0-9]/g,function(a){return t[+a]})}}var K=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function E(t){if(!(r=K.exec(t)))throw Error("invalid format: "+t);var r;return new P({fill:r[1],align:r[2],sign:r[3],symbol:r[4],zero:r[5],width:r[6],comma:r[7],precision:r[8]&&r[8].slice(1),trim:r[9],type:r[10]})}E.prototype=P.prototype;function P(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}P.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Q(t){t:for(var r=t.length,a=1,n=-1,o;a<r;++a)switch(t[a]){case".":n=o=a;break;case"0":n===0&&(n=a),o=a;break;default:if(!+t[a])break t;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(o+1):t}var X;function V(t,r){var a=N(t,r);if(!a)return t+"";var n=a[0],o=a[1],l=o-(X=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,m=n.length;return l===m?n:l>m?n+Array(l-m+1).join("0"):l>0?n.slice(0,l)+"."+n.slice(l):"0."+Array(1-l).join("0")+N(t,Math.max(0,r+l-1))[0]}function F(t,r){var a=N(t,r);if(!a)return t+"";var n=a[0],o=a[1];return o<0?"0."+Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+Array(o-n.length+2).join("0")}var L={"%":(t,r)=>(t*100).toFixed(r),b:t=>Math.round(t).toString(2),c:t=>t+"",d:q,e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:t=>Math.round(t).toString(8),p:(t,r)=>F(t*100,r),r:F,s:V,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function O(t){return t}var G=Array.prototype.map,I=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function W(t){var r=t.grouping===void 0||t.thousands===void 0?O:H(G.call(t.grouping,Number),t.thousands+""),a=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",l=t.numerals===void 0?O:J(G.call(t.numerals,String)),m=t.percent===void 0?"%":t.percent+"",e=t.minus===void 0?"−":t.minus+"",y=t.nan===void 0?"NaN":t.nan+"";function j(s){s=E(s);var x=s.fill,b=s.align,u=s.sign,M=s.symbol,g=s.zero,w=s.width,z=s.comma,d=s.precision,$=s.trim,c=s.type;c==="n"?(z=!0,c="g"):L[c]||(d===void 0&&(d=12),$=!0,c="g"),(g||x==="0"&&b==="=")&&(g=!0,x="0",b="=");var U=M==="$"?a:M==="#"&&/[boxX]/.test(c)?"0"+c.toLowerCase():"",Y=M==="$"?n:/[%p]/.test(c)?m:"",C=L[c],Z=/[defgprs%]/.test(c);d=d===void 0?6:/[gprs]/.test(c)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d));function T(i){var p=U,f=Y,v,D,S;if(c==="c")f=C(i)+f,i="";else{i=+i;var k=i<0||1/i<0;if(i=isNaN(i)?y:C(Math.abs(i),d),$&&(i=Q(i)),k&&+i==0&&u!=="+"&&(k=!1),p=(k?u==="("?u:e:u==="-"||u==="("?"":u)+p,f=(c==="s"?I[8+X/3]:"")+f+(k&&u==="("?")":""),Z){for(v=-1,D=i.length;++v<D;)if(S=i.charCodeAt(v),48>S||S>57){f=(S===46?o+i.slice(v+1):i.slice(v))+f,i=i.slice(0,v);break}}}z&&!g&&(i=r(i,1/0));var _=p.length+i.length+f.length,h=_<w?Array(w-_+1).join(x):"";switch(z&&g&&(i=r(h+i,h.length?w-f.length:1/0),h=""),b){case"<":i=p+i+f+h;break;case"=":i=p+h+i+f;break;case"^":i=h.slice(0,_=h.length>>1)+p+i+f+h.slice(_);break;default:i=h+p+i+f;break}return l(i)}return T.toString=function(){return s+""},T}function R(s,x){var b=j((s=E(s),s.type="f",s)),u=Math.max(-8,Math.min(8,Math.floor(B(x)/3)))*3,M=10**-u,g=I[8+u/3];return function(w){return b(M*w)+g}}return{format:j,formatPrefix:R}}var A,tt,rt;it({thousands:",",grouping:[3],currency:["$",""]});function it(t){return A=W(t),tt=A.format,rt=A.formatPrefix,A}export{rt as a,tt as b,B as e,E as f};
