PageSourceSearch

https://yteam-plumbing.com/wp-content/plugins/oxyextras/components/assets/countUp.js?ver=2.0.5

js yteam-plumbing.com collected 2026-10-01 07:10:06 UTC 10,807 bytes, 259 lines download raw bytes

1(function (global, factory) {
2    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3    typeof define === 'function' && define.amd ? define(['exports'], factory) :
4    (global = global || self, factory(global.countUp = {}));
5}(this, (function (exports) { 'use strict';
6
7    var __assign = (undefined && undefined.__assign) || function () {
8        __assign = Object.assign || function(t) {
9            for (var s, i = 1, n = arguments.length; i < n; i++) {
10                s = arguments[i];
11                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
12                    t[p] = s[p];
13            }
14            return t;
15        };
16        return __assign.apply(this, arguments);
17    };
18    // playground: stackblitz.com/edit/countup-typescript
19    var CountUp = /** @class */ (function () {
20        function CountUp(target, endVal, options) {
21            var _this = this;
22            this.target = target;
23            this.endVal = endVal;
24            this.options = options;
25            this.version = '2.0.5';
26            this.defaults = {
27                startVal: 0,
28                decimalPlaces: 0,
29                duration: 2,
30                useEasing: true,
31                useGrouping: true,
32                smartEasingThreshold: 999,
33                smartEasingAmount: 333,
34                separator: ',',
35                decimal: '.',
36                prefix: '',
37                suffix: ''
38            };
39            this.finalEndVal = null; // for smart easing
40            this.useEasing = true;
41            this.countDown = false;
42            this.error = '';
43            this.startVal = 0;
44            this.paused = true;
45            this.count = function (timestamp) {
46                if (!_this.startTime) {
47                    _this.startTime = timestamp;
48                }
49                var progress = timestamp - _this.startTime;
50                _this.remaining = _this.duration - progress;
51                // to ease or not to ease
52                if (_this.useEasing) {
53                    if (_this.countDown) {
54                        _this.frameVal = _this.startVal - _this.easingFn(progress, 0, _this.startVal - _this.endVal, _this.duration);
55                    }
56                    else {
57                        _this.frameVal = _this.easingFn(progress, _this.startVal, _this.endVal - _this.startVal, _this.duration);
58                    }
59                }
60                else {
61                    if (_this.countDown) {
62                        _this.frameVal = _this.startVal - ((_this.startVal - _this.endVal) * (progress / _this.duration));
63                    }
64                    else {
65                        _this.frameVal = _this.startVal + (_this.endVal - _this.startVal) * (progress / _this.duration);
66                    }
67                }
68                // don't go past endVal since progress can exceed duration in the last frame
69                if (_this.countDown) {
70                    _this.frameVal = (_this.frameVal < _this.endVal) ? _this.endVal : _this.frameVal;
71                }
72                else {
73                    _this.frameVal = (_this.frameVal > _this.endVal) ? _this.endVal : _this.frameVal;
74                }
75                // decimal
76                _this.frameVal = Math.round(_this.frameVal * _this.decimalMult) / _this.decimalMult;
77                // format and print value
78                _this.printValue(_this.frameVal);
79                // whether to continue
80                if (progress < _this.duration) {
81                    _this.rAF = requestAnimationFrame(_this.count);
82                }
83                else if (_this.finalEndVal !== null) {
84                    // smart easing
85                    _this.update(_this.finalEndVal);
86                }
87                else {
88                    if (_this.callback) {
89                        _this.callback();
90                    }
91                }
92            };
93            // default format and easing functions
94            this.formatNumber = function (num) {
95                var neg = (num < 0) ? '-' : '';
96                var result, x, x1, x2, x3;
97                result = Math.abs(num).toFixed(_this.options.decimalPlaces);
98                result += '';
99                x = result.split('.');
100                x1 = x[0];
101                x2 = x.length > 1 ? _this.options.decimal + x[1] : '';
102                if (_this.options.useGrouping) {
103                    x3 = '';
104                    for (var i = 0, len = x1.length; i < len; ++i) {
105                        if (i !== 0 && (i % 3) === 0) {
106                            x3 = _this.options.separator + x3;
107                        }
108                        x3 = x1[len - i - 1] + x3;
109                    }
110                    x1 = x3;
111                }
112                // optional numeral substitution
113                if (_this.options.numerals && _this.options.numerals.length) {
114                    x1 = x1.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
115                    x2 = x2.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
116                }
117                return neg + _this.options.prefix + x1 + x2 + _this.options.suffix;
118            };
119            this.easeOutExpo = function (t, b, c, d) {
120                return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
121            };
122            this.options = __assign(__assign({}, this.defaults), options);
123            this.formattingFn = (this.options.formattingFn) ?
124                this.options.formattingFn : this.formatNumber;
125            this.easingFn = (this.options.easingFn) ?
126                this.options.easingFn : this.easeOutExpo;
127            this.startVal = this.validateValue(this.options.startVal);
128            this.frameVal = this.startVal;
129            this.endVal = this.validateValue(endVal);
130            this.options.decimalPlaces = Math.max( this.options.decimalPlaces);
131            this.decimalMult = Math.pow(10, this.options.decimalPlaces);
132            this.resetDuration();
133            this.options.separator = String(this.options.separator);
134            this.useEasing = this.options.useEasing;
135            if (this.options.separator === '') {
136                this.options.useGrouping = false;
137            }
138            this.el = (typeof target === 'string') ? document.getElementById(target) : target;
139            if (this.el) {
140                this.printValue(this.startVal);
141            }
142            else {
143                this.error = '[CountUp] target is null or undefined';
144            }
145        }
146        // determines where easing starts and whether to count down or up
147        CountUp.prototype.determineDirectionAndSmartEasing = function () {
148            var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
149            this.countDown = (this.startVal > end);
150            var animateAmount = end - this.startVal;
151            if (Math.abs(animateAmount) > this.options.smartEasingThreshold) {
152                this.finalEndVal = end;
153                var up = (this.countDown) ? 1 : -1;
154                this.endVal = end + (up * this.options.smartEasingAmount);
155                this.duration = this.duration / 2;
156            }
157            else {
158                this.endVal = end;
159                this.finalEndVal = null;
160            }
161            if (this.finalEndVal) {
162                this.useEasing = false;
163            }
164            else {
165                this.useEasing = this.options.useEasing;
166            }
167        };
168        // start animation
169        CountUp.prototype.start = function (callback) {
170            if (this.error) {
171                return;
172            }
173            this.callback = callback;
174            if (this.duration > 0) {
175                this.determineDirectionAndSmartEasing();
176                this.paused = false;
177                this.rAF = requestAnimationFrame(this.count);
178            }
179            else {
180                this.printValue(this.endVal);
181            }
182        };
183        // pause/resume animation
184        CountUp.prototype.pauseResume = function () {
185            if (!this.paused) {
186                cancelAnimationFrame(this.rAF);
187            }
188            else {
189                this.startTime = null;
190                this.duration = this.remaining;
191                this.startVal = this.frameVal;
192                this.determineDirectionAndSmartEasing();
193                this.rAF = requestAnimationFrame(this.count);
194            }
195            this.paused = !this.paused;
196        };
197        // reset to startVal so animation can be run again
198        CountUp.prototype.reset = function () {
199            cancelAnimationFrame(this.rAF);
200            this.paused = true;
201            this.resetDuration();
202            this.startVal = this.validateValue(this.options.startVal);
203            this.frameVal = this.startVal;
204            this.printValue(this.startVal);
205        };
206        // pass a new endVal and start animation
207        CountUp.prototype.update = function (newEndVal) {
208            cancelAnimationFrame(this.rAF);
209            this.startTime = null;
210            this.endVal = this.validateValue(newEndVal);
211            if (this.endVal === this.frameVal) {
212                return;
213            }
214            this.startVal = this.frameVal;
215            if (!this.finalEndVal) {
216                this.resetDuration();
217            }
218            this.determineDirectionAndSmartEasing();
219            this.rAF = requestAnimationFrame(this.count);
220        };
221        CountUp.prototype.printValue = function (val) {
222            var result = this.formattingFn(val);
223            if (this.el.tagName === 'INPUT') {
224                var input = this.el;
225                input.value = result;
226            }
227            else if (this.el.tagName === 'text' || this.el.tagName === 'tspan') {
228                this.el.textContent = result;
229            }
230            else {
231                this.el.innerHTML = result;
232            }
233        };
234        CountUp.prototype.ensureNumber = function (n) {
235            return (typeof n === 'number' && !isNaN(n));
236        };
237        CountUp.prototype.validateValue = function (value) {
238            var newValue = Number(value);
239            if (!this.ensureNumber(newValue)) {
240                this.error = "[CountUp] invalid start or end value: " + value;
241                return null;
242            }
243            else {
244                return newValue;
245            }
246        };
247        CountUp.prototype.resetDuration = function () {
248            this.startTime = null;
249            this.duration = Number(this.options.duration) * 1000;
250            this.remaining = this.duration;
251        };
252        return CountUp;
253    }());
254
255    exports.CountUp = CountUp;
256
257    Object.defineProperty(exports, '__esModule', { value: true });
258
259})));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.