!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):b((a=a||self).countUp={})}(this,function(b){"use strict";var c=function(){return(c=Object.assign||function(b){for(var c,d=1,e=arguments.length;d<e;d++)for(const a in c=arguments[d])Object.prototype.hasOwnProperty.call(c,a)&&(b[a]=c[a]);return b}).apply(this,arguments)},d=function(){function a(b,d,a){const f=this;this.target=b,this.endVal=d,this.options=a,this.version="2.0.7",this.defaults={startVal:0,decimalPlaces:0,duration:2,useEasing:!0,useGrouping:!0,smartEasingThreshold:999,smartEasingAmount:333,separator:",",decimal:".",prefix:"",suffix:""},this.finalEndVal=null,this.useEasing=!0,this.countDown=!1,this.error="",this.startVal=0,this.paused=!0,this.count=function(a){f.startTime||(f.startTime=a);const b=a-f.startTime;f.remaining=f.duration-b,f.frameVal=f.useEasing?f.countDown?f.startVal-f.easingFn(b,0,f.startVal-f.endVal,f.duration):f.easingFn(b,f.startVal,f.endVal-f.startVal,f.duration):f.countDown?f.startVal-(f.startVal-f.endVal)*(b/f.duration):f.startVal+(f.endVal-f.startVal)*(b/f.duration),f.frameVal=f.countDown?f.frameVal<f.endVal?f.endVal:f.frameVal:f.frameVal>f.endVal?f.endVal:f.frameVal,f.frameVal=+f.frameVal.toFixed(f.options.decimalPlaces),f.printValue(f.frameVal),b<f.duration?f.rAF=requestAnimationFrame(f.count):null===f.finalEndVal?f.callback&&f.callback():f.update(f.finalEndVal)},this.formatNumber=function(b){let c,d,g,h,j,k=0>b?"-":"";if(c=Math.abs(b).toFixed(f.options.decimalPlaces),g=(d=(c+="").split("."))[0],h=1<d.length?f.options.decimal+d[1]:"",f.options.useGrouping){j="";for(let a=0,b=g.length;a<b;++a)0!=a&&0==a%3&&(j=f.options.separator+j),j=g[b-a-1]+j;g=j}return f.options.numerals&&f.options.numerals.length&&(g=g.replace(/[0-9]/g,function(a){return f.options.numerals[+a]}),h=h.replace(/[0-9]/g,function(a){return f.options.numerals[+a]})),k+f.options.prefix+g+h+f.options.suffix},this.easeOutExpo=function(b,c,d,a){return 1024*(d*(1-Math.pow(2,-10*b/a)))/1023+c},this.options=c(c({},this.defaults),a),this.formattingFn=this.options.formattingFn?this.options.formattingFn:this.formatNumber,this.easingFn=this.options.easingFn?this.options.easingFn:this.easeOutExpo,this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.endVal=this.validateValue(d),this.options.decimalPlaces=Math.max(this.options.decimalPlaces),this.resetDuration(),this.options.separator=this.options.separator+"",this.useEasing=this.options.useEasing,""===this.options.separator&&(this.options.useGrouping=!1),this.el="string"==typeof b?document.getElementById(b):b,this.el?this.printValue(this.startVal):this.error="[CountUp] target is null or undefined"}return a.prototype.determineDirectionAndSmartEasing=function(){const b=this.finalEndVal?this.finalEndVal:this.endVal;this.countDown=this.startVal>b;const a=b-this.startVal;if(Math.abs(a)>this.options.smartEasingThreshold){this.finalEndVal=b;const c=this.countDown?1:-1;this.endVal=b+c*this.options.smartEasingAmount,this.duration/=2}else this.endVal=b,this.finalEndVal=null;this.useEasing=!this.finalEndVal&&this.options.useEasing},a.prototype.start=function(a){this.error||(this.callback=a,0<this.duration?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},a.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},a.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},a.prototype.update=function(a){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(a),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,this.finalEndVal||this.resetDuration(),this.finalEndVal=null,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},a.prototype.printValue=function(a){const b=this.formattingFn(a);"INPUT"===this.el.tagName?this.el.value=b:"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=b:this.el.innerHTML=b},a.prototype.ensureNumber=function(a){return"number"==typeof a&&!isNaN(a)},a.prototype.validateValue=function(a){const b=+a;return this.ensureNumber(b)?b:(this.error="[CountUp] invalid start or end value: "+a,null)},a.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*+this.options.duration,this.remaining=this.duration},a}();b.CountUp=d,Object.defineProperty(b,"__esModule",{value:!0})});