function countUp(a,t,e,n,i,r){this.options=r||{useEasing:!0,useGrouping:!0,separator:",",decimal:"."};for(var o=0,s=["webkit","moz","ms"],l=0;l<s.length&&!window.requestAnimationFrame;++l)window.requestAnimationFrame=window[s[l]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[s[l]+"CancelAnimationFrame"]||window[s[l]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a,t){var e=(new Date).getTime(),n=Math.max(0,16-(e-o)),i=window.setTimeout(function(){a(e+n)},n);return o=e+n,i}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});var m=this;this.d="string"==typeof a?document.getElementById(a):a,this.startVal=Number(t),this.endVal=Number(e),this.countDown=this.startVal>this.endVal,this.startTime=null,this.timestamp=null,this.remaining=null,this.frameVal=this.startVal,this.rAF=null,this.decimals=Math.max(0,n||0),this.dec=Math.pow(10,this.decimals),this.duration=1e3*i||2e3,this.easeOutExpo=function(a,t,e,n){return e*(1-Math.pow(2,-10*a/n))*1024/1023+t},this.count=function(a){null===m.startTime&&(m.startTime=a),m.timestamp=a;var t=a-m.startTime;if(m.remaining=m.duration-t,m.options.useEasing)if(m.countDown){e=m.easeOutExpo(t,0,m.startVal-m.endVal,m.duration);m.frameVal=m.startVal-e}else m.frameVal=m.easeOutExpo(t,m.startVal,m.endVal-m.startVal,m.duration);else if(m.countDown){var e=(m.startVal-m.endVal)*(t/m.duration);m.frameVal=m.startVal-e}else m.frameVal=m.startVal+(m.endVal-m.startVal)*(t/m.duration);m.frameVal=Math.round(m.frameVal*m.dec)/m.dec,m.countDown?m.frameVal=m.frameVal<m.endVal?m.endVal:m.frameVal:m.frameVal=m.frameVal>m.endVal?m.endVal:m.frameVal,m.d.innerHTML=m.formatNumber(m.frameVal.toFixed(m.decimals)),t<m.duration?m.rAF=requestAnimationFrame(m.count):null!=m.callback&&m.callback()},this.start=function(a){return m.callback=a,isNaN(m.endVal)||isNaN(m.startVal)?(console.log("countUp error: startVal or endVal is not a number"),m.d.innerHTML="--"):m.rAF=requestAnimationFrame(m.count),!1},this.stop=function(){cancelAnimationFrame(m.rAF)},this.reset=function(){m.startTime=null,cancelAnimationFrame(m.rAF),m.d.innerHTML=m.formatNumber(m.startVal.toFixed(m.decimals))},this.resume=function(){m.startTime=null,m.duration=m.remaining,m.startVal=m.frameVal,requestAnimationFrame(m.count)},this.formatNumber=function(a){var t,e,n,i;if(t=(a+="").split("."),e=t[0],n=t.length>1?m.options.decimal+t[1]:"",i=/(\d+)(\d{3})/,m.options.useGrouping)for(;i.test(e);)e=e.replace(i,"$1"+m.options.separator+"$2");return e+n},m.d.innerHTML=m.formatNumber(m.startVal.toFixed(m.decimals))}