var ABBR={th:3,mi:6,bi:9,tr:12},DEFAULT_OPTIONS={zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0,abbrLabel:{th:"k",mi:"m",bi:"b",tr:"t"}},TRILLION=1e12,BILLION=1e9,MILLION=1e6,THOUSAND=1e3;function numIsNaN(e){return"number"==typeof e&&isNaN(e)}function toFixed(e,n,t,r){var o=e.toString().split("."),i=n-(r||0),a=2===o.length?Math.min(Math.max(o[1].length,i),n):i,l=Math.pow(10,a),f=(t(e+"e+"+a)/l).toFixed(a);if(r>n-a){var m=new RegExp("\\.?0{1,"+(r-(n-a))+"}$");f=f.replace(m,"")}return f}function numberToFormat(e,n,t,r){var o=Math.abs(n),i=!1,a=!1,l="",f="",m=!1,u=void 0,s=void 0;t=t||"",n=n||0,~t.indexOf("(")?(i=!0,t=t.replace(/[(|)]/g,"")):(~t.indexOf("+")||~t.indexOf("-"))&&(s=~t.indexOf("+")?t.indexOf("+"):n<0?t.indexOf("-"):-1,t=t.replace(/[+|-]/g,"")),~t.indexOf("a")&&(u=!!(u=t.match(/a(k|m|b|t)?/))&&u[1],~t.indexOf(" a")&&(l=" "),t=t.replace(new RegExp(l+"a[kmbt]?"),""),o>=TRILLION&&!u||"t"===u?(l+=e.abbrLabel.tr,n/=TRILLION):o=BILLION&&!u||"b"===u?(l+=e.abbrLabel.bi,n/=BILLION):o=MILLION&&!u||"m"===u?(l+=e.abbrLabel.mi,n/=MILLION):(o=THOUSAND&&!u||"k"===u)&&(l+=e.abbrLabel.th,n/=THOUSAND)),~t.indexOf("[.]")&&(a=!0,t=t.replace("[.]","."));var p=n.toString().split(".")[0],d=t.split(".")[1],O=t.indexOf(","),c=(t.split(".")[0].split(",")[0].match(/0/g)||[]).length;if(d?(p=(f=~d.indexOf("[")?toFixed(n,(d=(d=d.replace("]","")).split("["))[0].length+d[1].length,r,d[1].length):toFixed(n,d.length,r)).split(".")[0],f=~f.indexOf(".")?"."+f.split(".")[1]:"",a&&0==+f.slice(1)&&(f="")):p=toFixed(n,0,r),l&&!u&&+p>=1e3&&l!==ABBR.trillion&&(p=""+ +p/1e3,l=ABBR.million),~p.indexOf("-")&&(p=p.slice(1),m=!0),p.length0;b--)p="0"+p;O>-1&&(p=p.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")),t.indexOf(".")||(p="");var L=p+f+(l||"");return i?L=(i&&m?"(":"")+L+(i&&m?")":""):s>=0?L=0===s?(m?"-":"+")+L:L+(m?"-":"+"):m&&(L="-"+L),L}function extend(e,n){Object.keys(n).forEach(function(t){e[t]=n[t]})}var numerifyPercent={regexp:/%/,format:function(e,n,t,r){var o=~n.indexOf(" %")?" ":"",i=void 0;return r.options.scalePercentBy100&&(e*=100),n=n.replace(/\s?%/,""),~(i=r._numberToFormat(e,n,t)).indexOf(")")?((i=i.split("")).splice(-1,0,o+"%"),i=i.join("")):i=i+o+"%",i}},options={},formats={};function format(e,n,t){n=n||options.defaultFormat,t=t||Math.round;var r=void 0,o=void 0;if(0===e&&null!==options.zeroFormat)r=options.zeroFormat;else if(null===e&&null!==options.nullFormat)r=options.nullFormat;else{for(var i in formats)if(formats[i]&&n.match(formats[i].regexp)){o=formats[i].format;break}r=(o=o||numberToFormat.bind(null,options))(e,n,t,numerify)}return r}function numerify(e,n,t){return format(0===e||void 0===e?0:null===e||numIsNaN(e)?null:"string"==typeof e?options.zeroFormat&&e===options.zeroFormat?0:options.nullFormat&&e===options.nullFormat||!e.replace(/[^0-9]+/g,"").length?null:+e:+e||null,n,t)}extend(options,DEFAULT_OPTIONS),numerify.options=options,numerify._numberToFormat=numberToFormat.bind(null,options),numerify.register=function(e,n){formats[e]=n},numerify.unregister=function(e){formats[e]=null},numerify.setOptions=function(e){extend(options,e)},numerify.reset=function(){extend(options,DEFAULT_OPTIONS)},numerify.register("percentage",numerifyPercent);export default numerify;