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