/*! * numeral.js * version : 1.5.3 * author : Adam Draper * license : MIT * http://adamwdraper.github.com/Numeral-js/ */ (function(){var f,q="1.5.3",l={},e="en",m=null,h="0,0",n=(typeof module!=="undefined"&&module.exports);function k(t){this._value=t}function p(x,u,z,t){var w=Math.pow(10,u),y,v;v=(z(x*w)/w).toFixed(u);if(t){y=new RegExp("0{1,"+t+"}$");v=v.replace(y,"")}return v}function o(w,u,v){var t;if(u.indexOf("$")>-1){t=b(w,u,v)}else{if(u.indexOf("%")>-1){t=a(w,u,v)}else{if(u.indexOf(":")>-1){t=r(w,u)}else{t=i(w._value,u,v)}}}return t}function d(u,z){var y=z,B,x,w,v,C=["KB","MB","GB","TB","PB","EB","ZB","YB"],A=false,t;if(z.indexOf(":")>-1){u._value=c(z)}else{if(z===m){u._value=0}else{if(l[e].delimiters.decimal!=="."){z=z.replace(/\./g,"").replace(l[e].delimiters.decimal,".")}B=new RegExp("[^a-zA-Z]"+l[e].abbreviations.thousand+"(?:\\)|(\\"+l[e].currency.symbol+")?(?:\\))?)?$");x=new RegExp("[^a-zA-Z]"+l[e].abbreviations.million+"(?:\\)|(\\"+l[e].currency.symbol+")?(?:\\))?)?$");w=new RegExp("[^a-zA-Z]"+l[e].abbreviations.billion+"(?:\\)|(\\"+l[e].currency.symbol+")?(?:\\))?)?$");v=new RegExp("[^a-zA-Z]"+l[e].abbreviations.trillion+"(?:\\)|(\\"+l[e].currency.symbol+")?(?:\\))?)?$");for(t=0;t<=C.length;t++){A=(z.indexOf(C[t])>-1)?Math.pow(1024,t+1):false;if(A){break}}u._value=((A)?A:1)*((y.match(B))?Math.pow(10,3):1)*((y.match(x))?Math.pow(10,6):1)*((y.match(w))?Math.pow(10,9):1)*((y.match(v))?Math.pow(10,12):1)*((z.indexOf("%")>-1)?0.01:1)*(((z.split("-").length+Math.min(z.split("(").length-1,z.split(")").length-1))%2)?1:-1)*Number(z.replace(/[^0-9\.]+/g,""));u._value=(A)?Math.ceil(u._value):u._value}}return u._value}function b(w,A,y){var z=A.indexOf("$"),x=A.indexOf("("),u=A.indexOf("-"),t="",B,v;if(A.indexOf(" $")>-1){t=" ";A=A.replace(" $","")}else{if(A.indexOf("$ ")>-1){t=" ";A=A.replace("$ ","")}else{A=A.replace("$","")}}v=i(w._value,A,y);if(z<=1){if(v.indexOf("(")>-1||v.indexOf("-")>-1){v=v.split("");B=1;if(z-1){v=v.split("");v.splice(-1,0,t+l[e].currency.symbol);v=v.join("")}else{v=v+t+l[e].currency.symbol}}return v}function a(y,w,x){var v="",t,u=y._value*100;if(w.indexOf(" %")>-1){v=" ";w=w.replace(" %","")}else{w=w.replace("%","")}t=i(u,w,x);if(t.indexOf(")")>-1){t=t.split("");t.splice(-1,0,v+"%");t=t.join("")}else{t=t+v+"%"}return t}function r(w){var t=Math.floor(w._value/60/60),u=Math.floor((w._value-(t*60*60))/60),v=Math.round(w._value-(t*60*60)-(u*60));return t+":"+((u<10)?"0"+u:u)+":"+((v<10)?"0"+v:v)}function c(t){var u=t.split(":"),v=0;if(u.length===3){v=v+(Number(u[0])*60*60);v=v+(Number(u[1])*60);v=v+Number(u[2])}else{if(u.length===2){v=v+(Number(u[0])*60);v=v+Number(u[1])}}return Number(v)}function i(I,M,z){var G=false,A=false,R=false,F="",Q=false,O=false,u=false,H=false,x=false,E="",v="",D=Math.abs(I),K=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],J,L,B,C,N,y,P="",t=false;if(I===0&&m!==null){return m}else{if(M.indexOf("(")>-1){G=true;M=M.slice(1,-1)}else{if(M.indexOf("+")>-1){A=true;M=M.replace(/\+/g,"")}}if(M.indexOf("a")>-1){Q=M.indexOf("aK")>=0;O=M.indexOf("aM")>=0;u=M.indexOf("aB")>=0;H=M.indexOf("aT")>=0;x=Q||O||u||H;if(M.indexOf(" a")>-1){F=" ";M=M.replace(" a","")}else{M=M.replace("a","")}if(D>=Math.pow(10,12)&&!x||H){F=F+l[e].abbreviations.trillion;I=I/Math.pow(10,12)}else{if(D=Math.pow(10,9)&&!x||u){F=F+l[e].abbreviations.billion;I=I/Math.pow(10,9)}else{if(D=Math.pow(10,6)&&!x||O){F=F+l[e].abbreviations.million;I=I/Math.pow(10,6)}else{if(D=Math.pow(10,3)&&!x||Q){F=F+l[e].abbreviations.thousand;I=I/Math.pow(10,3)}}}}}if(M.indexOf("b")>-1){if(M.indexOf(" b")>-1){E=" ";M=M.replace(" b","")}else{M=M.replace("b","")}for(B=0;B<=K.length;B++){J=Math.pow(1024,B);L=Math.pow(1024,B+1);if(I>=J&&I0){I=I/J}break}}}if(M.indexOf("o")>-1){if(M.indexOf(" o")>-1){v=" ";M=M.replace(" o","")}else{M=M.replace("o","")}v=v+l[e].ordinal(I)}if(M.indexOf("[.]")>-1){R=true;M=M.replace("[.]",".")}C=I.toString().split(".")[0];N=M.split(".")[1];y=M.indexOf(",");if(N){if(N.indexOf("[")>-1){N=N.replace("]","");N=N.split("[");P=p(I,(N[0].length+N[1].length),z,N[1].length)}else{P=p(I,N.length,z)}C=P.split(".")[0];if(P.split(".")[1].length){P=l[e].delimiters.decimal+P.split(".")[1]}else{P=""}if(R&&Number(P.slice(1))===0){P=""}}else{C=p(I,null,z)}if(C.indexOf("-")>-1){C=C.slice(1);t=true}if(y>-1){C=C.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+l[e].delimiters.thousands)}if(M.indexOf(".")===0){C=""}return((G&&t)?"(":"")+((!G&&t)?"-":"")+((!t&&A)?"+":"")+C+P+((v)?v:"")+((F)?F:"")+((E)?E:"")+((G&&t)?")":"")}}f=function(t){if(f.isNumeral(t)){t=t.value()}else{if(t===0||typeof t==="undefined"){t=0}else{if(!Number(t)){t=f.fn.unformat(t)}}}return new k(Number(t))};f.version=q;f.isNumeral=function(t){return t instanceof k};f.language=function(u,t){if(!u){return e}if(u&&!t){if(!l[u]){throw new Error("Unknown language : "+u)}e=u}if(t||!l[u]){g(u,t)}return f};f.languageData=function(t){if(!t){return l[e]}if(!l[t]){throw new Error("Unknown language : "+t)}return l[t]};f.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(u){var t=u%10;return(~~(u%100/10)===1)?"th":(t===1)?"st":(t===2)?"nd":(t===3)?"rd":"th"},currency:{symbol:"$"}});f.zeroFormat=function(t){m=typeof(t)==="string"?t:null};f.defaultFormat=function(t){h=typeof(t)==="string"?t:"0.0"};function g(u,t){l[u]=t}if("function"!==typeof Array.prototype.reduce){Array.prototype.reduce=function(y,w){if(null===this||"undefined"===typeof this){throw new TypeError("Array.prototype.reduce called on null or undefined")}if("function"!==typeof y){throw new TypeError(y+" is not a function")}var t,v,u=this.length>>>0,x=false;if(1t;++t){if(this.hasOwnProperty(t)){if(x){v=y(v,this[t],t,this)}else{v=this[t];x=true}}}if(!x){throw new TypeError("Reduce of empty array with no initial value")}return v}}function j(t){var u=t.toString().split(".");if(u.length<2){return 1}return Math.pow(10,u[1].length)}function s(){var t=Array.prototype.slice.call(arguments);return t.reduce(function(w,u){var v=j(w),x=j(u);return v>x?v:x},-Infinity)}f.fn=k.prototype={clone:function(){return f(this)},format:function(u,t){return o(this,u?u:h,(t!==undefined)?t:Math.round)},unformat:function(t){if(Object.prototype.toString.call(t)==="[object Number]"){return t}return d(this,t?t:h)},value:function(){return this._value},valueOf:function(){return this._value},set:function(t){this._value=Number(t);return this},add:function(v){var t=s.call(null,this._value,v);function u(w,z,x,y){return w+t*z}this._value=[this._value,v].reduce(u,0)/t;return this},subtract:function(v){var t=s.call(null,this._value,v);function u(w,z,x,y){return w-t*z}this._value=[v].reduce(u,this._value*t)/t;return this},multiply:function(u){function t(w,z,x,y){var v=s(w,z);return(w*v)*(z*v)/(v*v)}this._value=[this._value,u].reduce(t,1);return this},divide:function(u){function t(w,z,x,y){var v=s(w,z);return(w*v)/(z*v)}this._value=[this._value,u].reduce(t);return this},difference:function(t){return Math.abs(f(this._value).subtract(t).value())}};if(n){module.exports=f}if(typeof ender==="undefined"){this["numeral"]=f}if(typeof define==="function"&&define.amd){define([],function(){return f})}}).call(this);