! function(a, b) { "function" == typeof define && define.amd ? define(b) : "object" == typeof exports ? module.exports = b(require, exports, module) : a.countup = b() } (this, function() { var d = function(a, b, c, d, e, f) { for (var g = 0, h = ["webkit", "moz", "ms", "o"], i = 0; i < h.length && !window.requestanimationframe; ++i) window.requestanimationframe = window[h[i] + "requestanimationframe"], window.cancelanimationframe = window[h[i] + "cancelanimationframe"] || window[h[i] + "cancelrequestanimationframe"]; window.requestanimationframe || (window.requestanimationframe = function(a) { var c = (new date).gettime(), d = math.max(0, 16 - (c - g)), e = window.settimeout(function() { a(c + d) }, d); return g = c + d, e }), window.cancelanimationframe || (window.cancelanimationframe = function(a) { cleartimeout(a) }), this.options = { useeasing: !0, usegrouping: !0, separator: ",", decimal: "." }; for (var j in f) f.hasownproperty(j) && (this.options[j] = f[j]); "" === this.options.separator && (this.options.usegrouping = !1), this.options.prefix || (this.options.prefix = ""), this.options.suffix || (this.options.suffix = ""), this.d = "string" == typeof a ? document.getelementbyid(a) : a, this.startval = number(b), isnan(b) && (this.startval = number(b.match(/[\d]+/g).join(""))), this.endval = number(c), isnan(c) && (this.endval = number(c.match(/[\d]+/g).join(""))), this.countdown = this.startval > this.endval, this.frameval = this.startval, this.decimals = math.max(0, d || 0), this.dec = math.pow(10, this.decimals), this.duration = 1e3 * number(e) || 2e3; var k = this; this.version = function() { return "1.5.3" }, this.printvalue = function(a) { var b = isnan(a) ? "--": k.formatnumber(a); "input" == k.d.tagname ? this.d.value = b: "text" == k.d.tagname ? this.d.textcontent = b: this.d.innerhtml = b }, this.easeoutexpo = function(a, b, c, d) { return 1024 * c * ( - math.pow(2, -10 * a / d) + 1) / 1023 + b }, this.count = function(a) { k.starttime || (k.starttime = a), k.timestamp = a; var b = a - k.starttime; k.remaining = k.duration - b, k.frameval = k.options.useeasing ? k.countdown ? k.startval - k.easeoutexpo(b, 0, k.startval - k.endval, k.duration) : k.easeoutexpo(b, k.startval, k.endval - k.startval, k.duration) : k.countdown ? k.startval - (k.startval - k.endval) * (b / k.duration) : k.startval + (k.endval - k.startval) * (b / k.duration), k.frameval = k.countdown ? k.frameval < k.endval ? k.endval: k.frameval: k.frameval > k.endval ? k.endval: k.frameval, k.frameval = math.round(k.frameval * k.dec) / k.dec, k.printvalue(k.frameval), b < k.duration ? k.raf = requestanimationframe(k.count) : k.callback && k.callback() }, this.start = function(a) { return k.callback = a, isnan(k.endval) || isnan(k.startval) || k.startval === k.endval ? (console.log("countup error: startval or endval is not a number"), k.printvalue(c)) : k.raf = requestanimationframe(k.count), !1 }, this.pauseresume = function() { k.paused ? (k.paused = !1, delete k.starttime, k.duration = k.remaining, k.startval = k.frameval, requestanimationframe(k.count)) : (k.paused = !0, cancelanimationframe(k.raf)) }, this.reset = function() { k.paused = !1, delete k.starttime, k.startval = b, cancelanimationframe(k.raf), k.printvalue(k.startval) }, this.update = function(a) { cancelanimationframe(k.raf), k.paused = !1, delete k.starttime, k.startval = k.frameval, k.endval = number(a), k.countdown = k.startval > k.endval, k.raf = requestanimationframe(k.count) }, this.formatnumber = function(a) { a = a.tofixed(k.decimals), a += ""; var b, c, d, e; if (b = a.split("."), c = b[0], d = b.length > 1 ? k.options.decimal + b[1] : "", e = /(\d+)(\d{3})/, k.options.usegrouping) for (; e.test(c);) c = c.replace(e, "$1" + k.options.separator + "$2"); return k.options.prefix + c + d + k.options.suffix }, k.printvalue(k.startval) }; return d });