diff --git a/demo/src/kute-base.js b/demo/src/kute-base.js index ae66149..f12bd0e 100644 --- a/demo/src/kute-base.js +++ b/demo/src/kute-base.js @@ -6,7 +6,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.KUTE = factory()); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.KUTE = factory()); }(this, (function () { 'use strict'; var version = "2.0.13"; @@ -218,14 +218,14 @@ } } if (Component.Interpolate) { - for (var fn$1 in Component.Interpolate) { - var compIntObj = Component.Interpolate[fn$1]; - if ( typeof(compIntObj) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj; + for (var fni in Component.Interpolate) { + var compIntObj = Component.Interpolate[fni]; + if ( typeof(compIntObj) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj; } else { for ( var sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj[sfn]; + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj[sfn]; } } } @@ -233,8 +233,8 @@ linkProperty[ComponentName] = Component.Interpolate; } if (Component.Util) { - for (var fn$2 in Component.Util){ - !Util[fn$2] && (Util[fn$2] = Component.Util[fn$2]); + for (var fnu in Component.Util){ + !Util[fnu] && (Util[fnu] = Component.Util[fnu]); } } return {name:ComponentName} diff --git a/demo/src/kute-base.min.js b/demo/src/kute-base.min.js index a173e1c..b356fa7 100644 --- a/demo/src/kute-base.min.js +++ b/demo/src/kute-base.min.js @@ -1,2 +1,2 @@ // KUTE.js Base v2.0.13 | thednp © 2020 | MIT-License -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).KUTE=n()}(this,(function(){"use strict";var t={},n=[],e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},i={},r={},o={};o.now=self.performance.now.bind(self.performance);var a=0,s=function(t){for(var e=0;e>0)/1e3;return i}O.prototype.start=function(n){return g(this),this.playing=!0,this._startTime=void 0!==n?n:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),E.call(this),this._startFired=!0),!a&&s(),this},O.prototype.stop=function(){return this.playing&&(_(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},O.prototype.close=function(){for(var t in h)for(var n in h[t])h[t][n].call(this,n);this._startFired=!1,u.call(this)},O.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},O.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},O.prototype.update=function(n){var e,i;if((n=void 0!==n?n:t.Time())1?1:e,i=this._easing(e),this.valuesEnd)t[r](this.element,this.valuesStart[r],this.valuesEnd[r],i);return this._onUpdate&&this._onUpdate.call(this),1!==e||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},y.tween=O;var k="undefined"!=typeof DOMMatrix?DOMMatrix:"undefined"!=typeof WebKitCSSMatrix?WebKitCSSMatrix:"undefined"!=typeof CSSMatrix?CSSMatrix:"undefined"!=typeof MSCSSMatrix?MSCSSMatrix:null,x={component:"transformMatrixBase",property:"transform",functions:{onStart:{transform:function(n){this.valuesEnd[n]&&!t[n]&&(t[n]=function(t,e,i,r){var o=new k,a={};for(var s in i)a[s]="perspective"===s?b(e[s],i[s],r):I(e[s],i[s],r);a.perspective&&(o.m34=-1/a.perspective),o=a.translate3d?o.translate(a.translate3d[0],a.translate3d[1],a.translate3d[2]):o,o=a.rotate3d?o.rotate(a.rotate3d[0],a.rotate3d[1],a.rotate3d[2]):o,a.skew&&(o=a.skew[0]?o.skewX(a.skew[0]):o,o=a.skew[1]?o.skewY(a.skew[1]):o),o=a.scale3d?o.scale(a.scale3d[0],a.scale3d[1],a.scale3d[2]):o,t.style[n]=o.toString()})},CSS3Matrix:function(n){this.valuesEnd.transform&&!t[n]&&(t[n]=k)}}},Interpolate:{perspective:b,translate3d:I,rotate3d:I,skew:I,scale3d:I}};function U(n){n in this.valuesEnd&&!t[n]&&(t[n]=function(t,e,i,r){t.style[n]=(r>.99||r<.01?(10*b(e,i,r)>>0)/10:b(e,i,r)>>0)+"px"})}var q=["top","left","width","height"],A={};q.map((function(t){return A[t]=U}));var B={component:"baseBoxModel",category:"boxModel",properties:q,Interpolate:{numbers:b},functions:{onStart:A}};var F={component:"baseOpacity",property:"opacity",Interpolate:{numbers:b},functions:{onStart:function(n){n in this.valuesEnd&&!t[n]&&(t[n]=function(t,e,i,r){t.style[n]=(1e3*b(e,i,r)>>0)/1e3})}}},j=new T(x),K=new T(B),Q=new T(F);return{Animation:T,Components:{Transform:j,BoxModel:K,Opacity:Q},TweenBase:O,fromTo:function(t,n,e,i){return i=i||{},new y.tween(M(t),n,e,i)},Objects:d,Easing:m,Util:v,Render:f,Interpolate:i,Internals:C,Selector:M,Version:"2.0.13"}})); +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).KUTE=n()}(this,(function(){"use strict";var t={},n=[],e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},i={},r={},o={};o.now=self.performance.now.bind(self.performance);var a=0,s=function(t){for(var e=0;e>0)/1e3;return i}E.prototype.start=function(n){return g(this),this.playing=!0,this._startTime=void 0!==n?n:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),b.call(this),this._startFired=!0),!a&&s(),this},E.prototype.stop=function(){return this.playing&&(_(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},E.prototype.close=function(){for(var t in h)for(var n in h[t])h[t][n].call(this,n);this._startFired=!1,u.call(this)},E.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},E.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},E.prototype.update=function(n){var e,i;if((n=void 0!==n?n:t.Time())1?1:e,i=this._easing(e),this.valuesEnd)t[r](this.element,this.valuesStart[r],this.valuesEnd[r],i);return this._onUpdate&&this._onUpdate.call(this),1!==e||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},y.tween=E;var k="undefined"!=typeof DOMMatrix?DOMMatrix:"undefined"!=typeof WebKitCSSMatrix?WebKitCSSMatrix:"undefined"!=typeof CSSMatrix?CSSMatrix:"undefined"!=typeof MSCSSMatrix?MSCSSMatrix:null,x={component:"transformMatrixBase",property:"transform",functions:{onStart:{transform:function(n){this.valuesEnd[n]&&!t[n]&&(t[n]=function(t,e,i,r){var o=new k,a={};for(var s in i)a[s]="perspective"===s?O(e[s],i[s],r):I(e[s],i[s],r);a.perspective&&(o.m34=-1/a.perspective),o=a.translate3d?o.translate(a.translate3d[0],a.translate3d[1],a.translate3d[2]):o,o=a.rotate3d?o.rotate(a.rotate3d[0],a.rotate3d[1],a.rotate3d[2]):o,a.skew&&(o=a.skew[0]?o.skewX(a.skew[0]):o,o=a.skew[1]?o.skewY(a.skew[1]):o),o=a.scale3d?o.scale(a.scale3d[0],a.scale3d[1],a.scale3d[2]):o,t.style[n]=o.toString()})},CSS3Matrix:function(n){this.valuesEnd.transform&&!t[n]&&(t[n]=k)}}},Interpolate:{perspective:O,translate3d:I,rotate3d:I,skew:I,scale3d:I}};function U(n){n in this.valuesEnd&&!t[n]&&(t[n]=function(t,e,i,r){t.style[n]=(r>.99||r<.01?(10*O(e,i,r)>>0)/10:O(e,i,r)>>0)+"px"})}var q=["top","left","width","height"],A={};q.map((function(t){return A[t]=U}));var B={component:"baseBoxModel",category:"boxModel",properties:q,Interpolate:{numbers:O},functions:{onStart:A}};var F={component:"baseOpacity",property:"opacity",Interpolate:{numbers:O},functions:{onStart:function(n){n in this.valuesEnd&&!t[n]&&(t[n]=function(t,e,i,r){t.style[n]=(1e3*O(e,i,r)>>0)/1e3})}}},j=new M(x),K=new M(B),Q=new M(F);return{Animation:M,Components:{Transform:j,BoxModel:K,Opacity:Q},TweenBase:E,fromTo:function(t,n,e,i){return i=i||{},new y.tween(C(t),n,e,i)},Objects:d,Easing:m,Util:v,Render:f,Interpolate:i,Internals:T,Selector:C,Version:"2.0.13"}})); diff --git a/demo/src/kute-extra.js b/demo/src/kute-extra.js index 661a924..9323f53 100644 --- a/demo/src/kute-extra.js +++ b/demo/src/kute-extra.js @@ -6,7 +6,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.KUTE = factory()); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.KUTE = factory()); }(this, (function () { 'use strict'; var version = "2.0.13"; @@ -631,8 +631,8 @@ this[("_on" + (name.charAt(0).toUpperCase() + name.slice(1)))] = fn; } }; - TweenExtra.prototype.option = function option (option$1,value) { - this[("_" + option$1)] = value; + TweenExtra.prototype.option = function option (o,v) { + this[("_" + o)] = v; }; return TweenExtra; }(Tween)); @@ -829,14 +829,14 @@ } } if (Component.Interpolate) { - for (var fn$1 in Component.Interpolate) { - var compIntObj = Component.Interpolate[fn$1]; - if ( typeof(compIntObj) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj; + for (var fni in Component.Interpolate) { + var compIntObj = Component.Interpolate[fni]; + if ( typeof(compIntObj) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj; } else { for ( var sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj[sfn]; + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj[sfn]; } } } @@ -844,8 +844,8 @@ linkProperty[ComponentName] = Component.Interpolate; } if (Component.Util) { - for (var fn$2 in Component.Util){ - !Util[fn$2] && (Util[fn$2] = Component.Util[fn$2]); + for (var fnu in Component.Util){ + !Util[fnu] && (Util[fnu] = Component.Util[fnu]); } } return propertyInfo @@ -885,15 +885,15 @@ propertyInfo.interface = []; propertyInfo.render = []; propertyInfo.warning = []; - for (var fn in Functions) { - if (fn in Component.functions) { - fn === 'prepareProperty' ? propertyInfo.interface.push("fromTo()") : 0; - fn === 'prepareStart' ? propertyInfo.interface.push("to()") : 0; - fn === 'onStart' ? propertyInfo.render = "can render update" : 0; + for (var fnf in Functions) { + if (fnf in Component.functions) { + fnf === 'prepareProperty' ? propertyInfo.interface.push("fromTo()") : 0; + fnf === 'prepareStart' ? propertyInfo.interface.push("to()") : 0; + fnf === 'onStart' ? propertyInfo.render = "can render update" : 0; } else { - fn === 'prepareProperty' ? propertyInfo.warning.push("fromTo()") : 0; - fn === 'prepareStart' ? propertyInfo.warning.push("to()") : 0; - fn === 'onStart' ? propertyInfo.render = "no function to render update" : 0; + fnf === 'prepareProperty' ? propertyInfo.warning.push("fromTo()") : 0; + fnf === 'prepareStart' ? propertyInfo.warning.push("to()") : 0; + fnf === 'onStart' ? propertyInfo.render = "no function to render update" : 0; } } propertyInfo.interface.length ? propertyInfo.interface = (Category||Property) + " can use [" + (propertyInfo.interface.join(', ')) + "] method(s)" : delete propertyInfo.uses; @@ -902,16 +902,16 @@ if (Component.Interpolate) { propertyInfo.uses = []; propertyInfo.adds = []; - for (var fn$1 in Component.Interpolate) { - var compIntObj = Component.Interpolate[fn$1]; + for (var fni in Component.Interpolate) { + var compIntObj = Component.Interpolate[fni]; if ( typeof(compIntObj) === 'function' ) { - if ( !Interpolate[fn$1] ) { - propertyInfo.adds.push(("" + fn$1)); + if ( !Interpolate[fni] ) { + propertyInfo.adds.push(("" + fni)); } - propertyInfo.uses.push(("" + fn$1)); + propertyInfo.uses.push(("" + fni)); } else { for ( var sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn$1] ) { + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { propertyInfo.adds.push(("" + sfn)); } propertyInfo.uses.push(("" + sfn)); @@ -1560,9 +1560,9 @@ if (typeof c === 'string') { return c } else { - return c.shift() + c.join(',') + return c.shift() + c.join(' ') } - }).join(' ') + }).join('') } function onStartCubicMorph(tweenProp){ @@ -1584,23 +1584,21 @@ return pathArray.map(function (x) { return Array.isArray(x) ? clonePath(x) : !isNaN(+x) ? +x : x; } ) } - var SVGPCOps = { + var SVGPathCommanderOptions = { decimals:3, round:1 }; function roundPath(pathArray) { - return pathArray.map( function (seg) { return seg.map(function (c,i) { - var nr = +c, dc = Math.pow(10,SVGPCOps.decimals); - return i ? (nr % 1 === 0 ? nr : (nr*dc>>0)/dc) : c - } - ); }) + return pathArray.map( function (seg) { return seg.map(function (c,i) { + var nr = +c, dc = Math.pow(10,SVGPathCommanderOptions.decimals); + return i ? (nr % 1 === 0 ? nr : (nr*dc>>0)/dc) : c + } + ); }) } function SVGPathArray(pathString){ this.segments = []; - this.isClosed = 0; - this.isAbsolute = 0; this.pathValue = pathString; this.max = pathString.length; this.index = 0; @@ -1612,48 +1610,29 @@ } var paramCounts = { a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0 }; - function isSpace(ch) { - var specialSpaces = [ - 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, - 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF ]; - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029) || - (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && specialSpaces.indexOf(ch) >= 0); - } - function isCommand(code) { - switch (code | 0x20) { - case 0x6D: - case 0x7A: - case 0x6C: - case 0x68: - case 0x76: - case 0x63: - case 0x73: - case 0x71: - case 0x74: - case 0x61: - case 0x72: - return true; + + function finalizeSegment(state) { + var cmd = state.pathValue[state.segmentStart], cmdLC = cmd.toLowerCase(), params = state.data; + if (cmdLC === 'm' && params.length > 2) { + state.segments.push([ cmd, params[0], params[1] ]); + params = params.slice(2); + cmdLC = 'l'; + cmd = (cmd === 'm') ? 'l' : 'L'; } - return false; - } - function isArc(code) { - return (code | 0x20) === 0x61; - } - function isDigit(code) { - return (code >= 48 && code <= 57); - } - function isDigitStart(code) { - return (code >= 48 && code <= 57) || - code === 0x2B || - code === 0x2D || - code === 0x2E; - } - function skipSpaces(state) { - while (state.index < state.max && isSpace(state.pathValue.charCodeAt(state.index))) { - state.index++; + if (cmdLC === 'r') { + state.segments.push([ cmd ].concat(params)); + } else { + while (params.length >= paramCounts[cmdLC]) { + state.segments.push([ cmd ].concat(params.splice(0, paramCounts[cmdLC]))); + if (!paramCounts[cmdLC]) { + break; + } + } } } + + var invalidPathValue = 'Invalid path value'; + function scanFlag(state) { var ch = state.pathValue.charCodeAt(state.index); if (ch === 0x30) { @@ -1666,8 +1645,13 @@ state.index++; return; } - state.err = 'SvgPath: arc flag can be 0 or 1 only (at pos ' + state.index + ')'; + state.err = invalidPathValue; } + + function isDigit(code) { + return (code >= 48 && code <= 57); + } + function scanParam(state) { var start = state.index, index = start, @@ -1678,7 +1662,7 @@ hasDot = false, ch; if (index >= max) { - state.err = 'SvgPath: missed param (at pos ' + index + ')'; + state.err = invalidPathValue; return; } ch = state.pathValue.charCodeAt(index); @@ -1687,7 +1671,7 @@ ch = (index < max) ? state.pathValue.charCodeAt(index) : 0; } if (!isDigit(ch) && ch !== 0x2E) { - state.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')'; + state.err = invalidPathValue; return; } if (ch !== 0x2E) { @@ -1696,7 +1680,7 @@ ch = (index < max) ? state.pathValue.charCodeAt(index) : 0; if (zeroFirst && index < max) { if (ch && isDigit(ch)) { - state.err = 'SvgPath: numbers started with `0` such as `09` are illegal (at pos ' + start + ')'; + state.err = invalidPathValue; return; } } @@ -1717,7 +1701,7 @@ } if (ch === 0x65 || ch === 0x45) { if (hasDot && !hasCeiling && !hasDecimal) { - state.err = 'SvgPath: invalid float exponent (at pos ' + index + ')'; + state.err = invalidPathValue; return; } index++; @@ -1730,39 +1714,64 @@ index++; } } else { - state.err = 'SvgPath: invalid float exponent (at pos ' + index + ')'; + state.err = invalidPathValue; return; } } state.index = index; - state.param = parseFloat(state.pathValue.slice(start, index)) + 0.0; + state.param = +state.pathValue.slice(start, index); } - function finalizeSegment(state) { - var cmd = state.pathValue[state.segmentStart], cmdLC = cmd.toLowerCase(), params = state.data; - if (cmdLC === 'm' && params.length > 2) { - state.segments.push([ cmd, params[0], params[1] ]); - params = params.slice(2); - cmdLC = 'l'; - cmd = (cmd === 'm') ? 'l' : 'L'; + + function isCommand(code) { + switch (code | 0x20) { + case 0x6D: + case 0x7A: + case 0x6C: + case 0x68: + case 0x76: + case 0x63: + case 0x73: + case 0x71: + case 0x74: + case 0x61: + case 0x72: + return true; } - if (cmdLC === 'r') { - state.segments.push([ cmd ].concat(params)); - } else { - while (params.length >= paramCounts[cmdLC]) { - state.segments.push([ cmd ].concat(params.splice(0, paramCounts[cmdLC]))); - if (!paramCounts[cmdLC]) { - break; - } - } + return false; + } + + function isDigitStart(code) { + return (code >= 48 && code <= 57) || + code === 0x2B || + code === 0x2D || + code === 0x2E; + } + + function isArc(code) { + return (code | 0x20) === 0x61; + } + + function isSpace(ch) { + var specialSpaces = [ + 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, + 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF ]; + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029) || + (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && specialSpaces.indexOf(ch) >= 0); + } + + function skipSpaces(state) { + while (state.index < state.max && isSpace(state.pathValue.charCodeAt(state.index))) { + state.index++; } } + function scanSegment(state) { - var max = state.max, cmdCode, is_arc, comma_found, need_params, i; + var max = state.max, cmdCode, comma_found, need_params, i; state.segmentStart = state.index; cmdCode = state.pathValue.charCodeAt(state.index); - is_arc = isArc(cmdCode); if (!isCommand(cmdCode)) { - state.err = 'SvgPath: bad command ' + state.pathValue[state.index] + ' (at pos ' + state.index + ')'; + state.err = invalidPathValue; return; } need_params = paramCounts[state.pathValue[state.index].toLowerCase()]; @@ -1770,14 +1779,13 @@ skipSpaces(state); state.data = []; if (!need_params) { - state.isClosed = 1; finalizeSegment(state); return; } comma_found = false; for (;;) { for (i = need_params; i > 0; i--) { - if (is_arc && (i === 3 || i === 4)) { scanFlag(state); } + if (isArc(cmdCode) && (i === 3 || i === 4)) { scanFlag(state); } else { scanParam(state); } if (state.err.length) { return; @@ -1803,8 +1811,9 @@ } finalizeSegment(state); } + function parsePathString(pathString) { - if ( Array.isArray(pathString) ) { + if ( Array.isArray(pathString) && Array.isArray(pathString[0])) { return clonePath(pathString) } var state = new SVGPathArray(pathString), max = state.max; @@ -1816,7 +1825,7 @@ state.segments = []; } else if (state.segments.length) { if ('mM'.indexOf(state.segments[0][0]) < 0) { - state.err = 'SvgPath: string should start with `M` or `m`'; + state.err = invalidPathValue; state.segments = []; } else { state.segments[0][0] = 'M'; @@ -1896,8 +1905,9 @@ if (!pathArray || !pathArray.length) { return [["M", 0, 0]]; } - var res = [], x = 0, y = 0, mx = 0, my = 0, start = 0, - ii = pathArray.length, + var resultArray = [], + x = 0, y = 0, mx = 0, my = 0, + start = 0, ii = pathArray.length, crz = pathArray.length === 3 && pathArray[0][0] === "M" && pathArray[1][0].toUpperCase() === "R" && @@ -1908,11 +1918,11 @@ mx = x; my = y; start++; - res[0] = ["M", x, y]; + resultArray[0] = ["M", x, y]; } var loop = function ( i ) { - var r = (void 0), pa = pathArray[i], pa0 = pa[0]; - res.push(r = []); + var r = [], pa = pathArray[i], pa0 = pa[0], dots = []; + resultArray.push(r = []); if (pa0 !== pa0.toUpperCase()) { r[0] = pa0.toUpperCase(); switch (r[0]) { @@ -1932,47 +1942,47 @@ r[1] = +pa[1] + x; break; case "R": - var dots$1 = [x, y].concat(pa.slice(1)); - for (var j = 2, jj = dots$1.length; j < jj; j++) { - dots$1[j] = +dots$1[j] + x; - dots$1[++j] = +dots$1[j] + y; + dots = [x, y].concat(pa.slice(1)); + for (var j = 2, jj = dots.length; j < jj; j++) { + dots[j] = +dots[j] + x; + dots[++j] = +dots[j] + y; } - res.pop(); - res = res.concat(catmullRom2bezier(dots$1, crz)); + resultArray.pop(); + resultArray = resultArray.concat(catmullRom2bezier(dots, crz)); break; case "O": - res.pop(); - dots$1 = ellipsePath(x, y, +pa[1], +pa[2]); - dots$1.push(dots$1[0]); - res = res.concat(dots$1); + resultArray.pop(); + dots = ellipsePath(x, y, +pa[1], +pa[2]); + dots.push(dots[0]); + resultArray = resultArray.concat(dots); break; case "U": - res.pop(); - res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); - r = ["U"].concat(res[res.length - 1].slice(-2)); + resultArray.pop(); + resultArray = resultArray.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); + r = ["U"].concat(resultArray[resultArray.length - 1].slice(-2)); break; case "M": mx = +pa[1] + x; my = +pa[2] + y; default: - for (var j$1 = 1, jj$1 = pa.length; j$1 < jj$1; j$1++) { - r[j$1] = +pa[j$1] + ((j$1 % 2) ? x : y); + for (var k = 1, kk = pa.length; k < kk; k++) { + r[k] = +pa[k] + ((k % 2) ? x : y); } } } else if (pa0 === "R") { dots = [x, y].concat(pa.slice(1)); - res.pop(); - res = res.concat(catmullRom2bezier(dots, crz)); + resultArray.pop(); + resultArray = resultArray.concat(catmullRom2bezier(dots, crz)); r = ["R"].concat(pa.slice(-2)); } else if (pa0 === "O") { - res.pop(); + resultArray.pop(); dots = ellipsePath(x, y, +pa[1], +pa[2]); dots.push(dots[0]); - res = res.concat(dots); + resultArray = resultArray.concat(dots); } else if (pa0 === "U") { - res.pop(); - res = res.concat(ellipsePath(x, y, +pa[1], +pa[2], +pa[3])); - r = ["U"].concat(res[res.length - 1].slice(-2)); + resultArray.pop(); + resultArray = resultArray.concat(ellipsePath(x, y, +pa[1], +pa[2], +pa[3])); + r = ["U"].concat(resultArray[resultArray.length - 1].slice(-2)); } else { pa.map(function (k){ return r.push(k); }); } @@ -1999,12 +2009,12 @@ } }; for (var i = start; i < ii; i++) loop( i ); - return roundPath(res) + return roundPath(resultArray) } function rotateVector(x, y, rad) { var X = x * Math.cos(rad) - y * Math.sin(rad), - Y = x * Math.sin(rad) + y * Math.cos(rad); + Y = x * Math.sin(rad) + y * Math.cos(rad); return {x: X, y: Y} } @@ -2030,10 +2040,10 @@ k = (large_arc_flag == sweep_flag ? -1 : 1) * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))); - cx = k * rx * y / ry + (x1 + x2) / 2, + cx = k * rx * y / ry + (x1 + x2) / 2; cy = k * -ry * x / rx + (y1 + y2) / 2; - f1 = Math.asin(((y1 - cy) / ry)), - f2 = Math.asin(((y2 - cy) / ry)); + f1 = Math.asin( ((y1 - cy) / ry).toFixed(9) ); + f2 = Math.asin( ((y2 - cy) / ry).toFixed(9) ); f1 = x1 < cx ? Math.PI - f1 : f1; f2 = x2 < cx ? Math.PI - f2 : f2; f1 < 0 && (f1 = Math.PI * 2 + f1); @@ -2087,83 +2097,82 @@ _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, - x2, - y2 - ] + x2, y2 ] } function l2c(x1, y1, x2, y2) { - return [x1, y1, x2, y2, x2, y2]; + return [x1, y1, x2, y2, x2, y2] } - function processPath(path, d, pcom) { + function processSegment(segment, params, pathCommand) { var nx, ny; - if (!path) { - return ["C", d.x, d.y, d.x, d.y, d.x, d.y]; + if (!segment) { + return ["C", params.x, params.y, params.x, params.y, params.x, params.y]; } - !(path[0] in {T: 1, Q: 1}) && (d.qx = d.qy = null); - switch (path[0]) { + !(segment[0] in {T: 1, Q: 1}) && (params.qx = params.qy = null); + switch (segment[0]) { case "M": - d.X = path[1]; - d.Y = path[2]; + params.X = segment[1]; + params.Y = segment[2]; break; case "A": - path = ["C"].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1)))); + segment = ["C"].concat(a2c.apply(0, [params.x, params.y].concat(segment.slice(1)))); break; case "S": - if (pcom == "C" || pcom == "S") { - nx = d.x * 2 - d.bx; - ny = d.y * 2 - d.by; + if (pathCommand === "C" || pathCommand === "S") { + nx = params.x * 2 - params.bx; + ny = params.y * 2 - params.by; } else { - nx = d.x; - ny = d.y; + nx = params.x; + ny = params.y; } - path = ["C", nx, ny].concat(path.slice(1)); + segment = ["C", nx, ny].concat(segment.slice(1)); break; case "T": - if (pcom == "Q" || pcom == "T") { - d.qx = d.x * 2 - d.qx; - d.qy = d.y * 2 - d.qy; + if (pathCommand === "Q" || pathCommand === "T") { + params.qx = params.x * 2 - params.qx; + params.qy = params.y * 2 - params.qy; } else { - d.qx = d.x; - d.qy = d.y; + params.qx = params.x; + params.qy = params.y; } - path = ["C"].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2])); + segment = ["C"].concat(q2c(params.x, params.y, params.qx, params.qy, segment[1], segment[2])); break; case "Q": - d.qx = path[1]; - d.qy = path[2]; - path = ["C"].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4])); + params.qx = segment[1]; + params.qy = segment[2]; + segment = ["C"].concat(q2c(params.x, params.y, segment[1], segment[2], segment[3], segment[4])); break; case "L": - path = ["C"].concat(l2c(d.x, d.y, path[1], path[2])); + segment = ["C"].concat(l2c(params.x, params.y, segment[1], segment[2])); break; case "H": - path = ["C"].concat(l2c(d.x, d.y, path[1], d.y)); + segment = ["C"].concat(l2c(params.x, params.y, segment[1], params.y)); break; case "V": - path = ["C"].concat(l2c(d.x, d.y, d.x, path[1])); + segment = ["C"].concat(l2c(params.x, params.y, params.x, segment[1])); break; case "Z": - path = ["C"].concat(l2c(d.x, d.y, d.X, d.Y)); + segment = ["C"].concat(l2c(params.x, params.y, params.X, params.Y)); break; } - return path; + return segment; } - function fixM(path1, path2, a1, a2, i) { + function fixM(path1, path2, a1, a2, i, count) { if (path1 && path2 && path1[i][0] === "M" && path2[i][0] !== "M") { path2.splice(i, 0, ["M", a2.x, a2.y]); a1.bx = 0; a1.by = 0; a1.x = path1[i][1]; a1.y = path1[i][2]; + count = Math.max(p.length, p2 && p2.length || 0); } } - function fixArc(p, p2, pc1, pc2, i) { + function fixArc(p, p2, pc1, pc2, i, count) { if (p[i].length > 7) { p[i].shift(); var pi = p[i]; @@ -2173,6 +2182,7 @@ p.splice(i++, 0, ["C"].concat(pi.splice(0, 6))); } p.splice(i, 1); + count = Math.max(p.length, p2 && p2.length || 0); } } @@ -2182,48 +2192,45 @@ attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null}, attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null}; var pcoms1 = [], pcoms2 = [], - pfirst = "", pcom = "", + pathCommand = "", pcom = "", ii = Math.max(p.length, p2 && p2.length || 0); - for (var i = 0; i < ii; i++) { - p[i] && (pfirst = p[i][0]); - if (pfirst !== "C") { - pcoms1[i] = pfirst; + for (var i = 0; i < (ii = Math.max(p.length, p2 && p2.length || 0)); i++) { + p[i] && (pathCommand = p[i][0]); + if (pathCommand !== "C") { + pcoms1[i] = pathCommand; i && ( pcom = pcoms1[i - 1]); } - p[i] = processPath(p[i], attrs, pcom); - if (pcoms1[i] !== "A" && pfirst === "C") { pcoms1[i] = "C"; } - fixArc(p, p2, pcoms1, pcoms2, i); - ii = Math.max(p.length, p2 && p2.length || 0); + p[i] = processSegment(p[i], attrs, pcom); + if (pcoms1[i] !== "A" && pathCommand === "C") { pcoms1[i] = "C"; } + fixArc(p,p2,pcoms1,pcoms2,i,ii); if (p2) { - p2[i] && (pfirst = p2[i][0]); - if (pfirst !== "C") { - pcoms2[i] = pfirst; + p2[i] && (pathCommand = p2[i][0]); + if (pathCommand !== "C") { + pcoms2[i] = pathCommand; i && (pcom = pcoms2[i - 1]); } - p2[i] = processPath(p2[i], attrs2, pcom); - if (pcoms2[i] !== "A" && pfirst === "C") { + p2[i] = processSegment(p2[i], attrs2, pcom); + if (pcoms2[i] !== "A" && pathCommand === "C") { pcoms2[i] = "C"; } - fixArc(p2, p, pcoms2, pcoms1, i); - ii = Math.max(p.length, p2 && p2.length || 0); + fixArc(p2,p,pcoms2,pcoms1,i,ii); } - fixM(p, p2, attrs, attrs2, i); - p2 && fixM(p2, p, attrs2, attrs, i); - ii = Math.max(p.length, p2 && p2.length || 0); + fixM(p, p2, attrs, attrs2, i, ii); + fixM(p2, p, attrs2, attrs, i, ii); var seg = p[i], seg2 = p2 && p2[i], seglen = seg.length, seg2len = p2 && seg2.length; - attrs.x = seg[seglen - 2]; - attrs.y = seg[seglen - 1]; - attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x; - attrs.by = parseFloat(seg[seglen - 3]) || attrs.y; - attrs2.bx = p2 && (parseFloat(seg2[seg2len - 4]) || attrs2.x); - attrs2.by = p2 && (parseFloat(seg2[seg2len - 3]) || attrs2.y); + attrs.x = +seg[seglen - 2]; + attrs.y = +seg[seglen - 1]; + attrs.bx = +(seg[seglen - 4]) || attrs.x; + attrs.by = +(seg[seglen - 3]) || attrs.y; + attrs2.bx = p2 && (+(seg2[seg2len - 4]) || attrs2.x); + attrs2.by = p2 && (+(seg2[seg2len - 3]) || attrs2.y); attrs2.x = p2 && seg2[seg2len - 2]; attrs2.y = p2 && seg2[seg2len - 1]; } - return p2 ? [roundPath(p), roundPath(p2)] : roundPath(p); + return p2 ? [roundPath(p), roundPath(p2)] : roundPath(p) } function reverseCurve(pathCurveArray){ @@ -2243,14 +2250,14 @@ y = nextSeg[nextSeg.length - 1]; x1 = currentSeg[3]; y1 = currentSeg[4]; x2 = currentSeg[1]; y2 = currentSeg[2]; - return [p[0],x1,y1,x2,y2,x,y] + return ['C',x1,y1,x2,y2,x,y] }); - return [['M',rotatedCurve[curveCount][5],rotatedCurve[curveCount][6]]].concat(rotatedCurve) + return [['M',x,y]].concat(rotatedCurve) } - function createPath (path) { + function createPath(path) { var np = document.createElementNS('http://www.w3.org/2000/svg','path'), - d = path instanceof SVGElement ? path.getAttribute('d') : path; + d = path instanceof SVGElement ? path.getAttribute('d') : path; np.setAttribute('d',d); return np } @@ -2323,8 +2330,8 @@ if ( !pathCurve1 || !pathCurve2 || ( pathCurve1 && pathCurve2 && pathCurve1[0][0] === 'M' && pathCurve1.length !== pathCurve2.length) ) { var path1 = this.valuesStart[tweenProp].original, path2 = this.valuesEnd[tweenProp].original, - curves = pathToCurve(path1,path2); - var curve0 = this._reverseFirstPath ? reverseCurve(curves[0]) : curves[0], + curves = pathToCurve(path1,path2), + curve0 = this._reverseFirstPath ? reverseCurve(curves[0]) : curves[0], curve1 = this._reverseSecondPath ? reverseCurve(curves[1]) : curves[1]; curve0 = getRotatedCurve.call(this,curve0,curve1); this.valuesStart[tweenProp].curve = curve0; @@ -2431,8 +2438,8 @@ function getStartSvgTransform (tweenProp,value) { var transformObject = {}; var currentTransform = parseTransformString(this.element.getAttribute('transform')); - for (var i in value) { - transformObject[i] = i in currentTransform ? currentTransform[i] : (i==='scale'?1:0); + for (var j in value) { + transformObject[j] = j in currentTransform ? currentTransform[j] : (j==='scale'?1:0); } return transformObject; } @@ -2442,8 +2449,8 @@ var valuesStart = this.valuesStart[prop]; var valuesEnd = this.valuesEnd[prop]; var currentTransform = parseTransformSVG.call(this, prop, parseTransformString(this.element.getAttribute('transform')) ); - for ( var i in currentTransform ) { - valuesStart[i] = currentTransform[i]; + for ( var tp in currentTransform ) { + valuesStart[tp] = currentTransform[tp]; } var parentSVG = this.element.ownerSVGElement; var startMatrix = parentSVG.createSVGTransformFromMatrix( @@ -2454,9 +2461,9 @@ .translate(+valuesStart.origin[0],+valuesStart.origin[1]) ); valuesStart.translate = [startMatrix.matrix.e,startMatrix.matrix.f]; - for ( var i$1 in valuesStart) { - if ( !(i$1 in valuesEnd) || i$1==='origin') { - valuesEnd[i$1] = valuesStart[i$1]; + for ( var s in valuesStart) { + if ( !(s in valuesEnd) || s==='origin') { + valuesEnd[s] = valuesStart[s]; } } } @@ -2892,7 +2899,8 @@ } function prepareTransform(tweenProp,value){ if ( typeof(value) === 'object' && !value.length) { - var transformObject = {}, + var pv, + transformObject = {}, translate3dObj = {}, rotate3dObj = {}, scale3dObj = {}, @@ -2900,7 +2908,7 @@ axis = [{translate3d:translate3dObj},{rotate3d:rotate3dObj},{skew:skewObj},{scale3d:scale3dObj}]; var loop = function ( prop ) { if ( /3d/.test(prop) && typeof(value[prop]) === 'object' && value[prop].length ){ - var pv = value[prop].map( function (v) { return prop === 'scale3d' ? parseFloat(v) : parseInt(v); } ); + pv = value[prop].map( function (v) { return prop === 'scale3d' ? parseFloat(v) : parseInt(v); } ); transformObject[prop] = prop === 'scale3d' ? [pv[0]||1, pv[1]||1, pv[2]||1] : [pv[0]||0, pv[1]||0, pv[2]||0]; } else if ( /[XYZ]/.test(prop) ) { var obj = /translate/.test(prop) ? translate3dObj @@ -2910,16 +2918,15 @@ var idx = prop.replace(/translate|rotate|scale|skew/,'').toLowerCase(); obj[idx] = /scale/.test(prop) ? parseFloat(value[prop]) : parseInt(value[prop]); } else if ('skew' === prop ) { - var pv$1 = value[prop].map(function (v) { return parseInt(v)||0; }); - transformObject[prop] = [pv$1[0]||0, pv$1[1]||0]; + pv = value[prop].map(function (v) { return parseInt(v)||0; }); + transformObject[prop] = [pv[0]||0, pv[1]||0]; } else { transformObject[prop] = parseInt(value[prop]); } }; for (var prop in value) loop( prop ); axis.map(function (o) { - var tp = Object.keys(o)[0]; - var tv = o[tp]; + var tp = Object.keys(o)[0], tv = o[tp]; if ( Object.keys(tv).length && !transformObject[tp]) { transformObject[tp] = tp === 'scale3d' ? [tv.x || 1, tv.y || 1, tv.z || 1] : tp === 'skew' ? [tv.x || 0, tv.y || 0] diff --git a/demo/src/kute-extra.min.js b/demo/src/kute-extra.min.js index e509781..54e46a0 100644 --- a/demo/src/kute-extra.min.js +++ b/demo/src/kute-extra.min.js @@ -1,2 +1,2 @@ // KUTE.js Extra v2.0.13 | thednp © 2020 | MIT-License -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).KUTE=e()}(this,(function(){"use strict";var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},a={},i={};i.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ea?e=r:n=r,r=.5*(n-e)+e}return r};var O={},L={linear:new P(0,0,1,1,"linear"),easingSinusoidalIn:new P(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new P(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new P(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new P(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new P(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new P(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new P(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new P(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new P(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new P(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new P(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new P(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new P(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new P(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new P(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new P(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new P(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new P(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new P(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new P(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new P(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new P(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new P(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new P(.68,-.55,.265,1.55,"easingBackInOut")};function V(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function U(){for(var t in a)if("function"==typeof a[t])a[t].call(this,t);else for(var e in a[t])a[t][e].call(this,e);T.call(this)}O.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof L[t])return L[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new P(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),L.linear};var F=function(e,n,r,i){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,i=i||{},this._resetStart=i.resetStart||0,this._easing="function"==typeof i.easing?i.easing:O.processEasing(i.easing),this._duration=i.duration||f.duration,this._delay=i.delay||f.delay,i){var o="_"+s;o in this||(this[o]=i[s])}var l=this._easing.name;return a[l]||(a[l]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};F.prototype.start=function(e){return S(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),U.call(this),this._startFired=!0),!s&&o(),this},F.prototype.stop=function(){return this.playing&&(M(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},F.prototype.close=function(){for(var t in m)for(var e in m[t])m[t][e].call(this,e);this._startFired=!1,l.call(this)},F.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},F.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},F.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},O.tween=F,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var j=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],a=t[2];if(k.call(this,a,"end"),this._resetStart?this.valuesStart=r:k.call(this,r,"start"),!this._resetStart)for(var i in g)for(var s in g[i])g[i][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||f.repeat,this._repeatDelay=o.repeatDelay||f.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||f.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,I.call(this),g)for(var r in g[n])g[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var a in this.valuesEnd)this.valuesRepeat[a]=this.valuesStart[a];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),U.call(this),this._startTime+=t.Time()-this._pauseTime,S(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(M(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(F);O.tween=j;var N=function(t){function e(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return t.apply(this,e),this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.to=function(t,e){},e.prototype.fromTo=function(t,e){},e.prototype.getTotalDuration=function(){},e.prototype.on=function(t,e){["start","stop","update","complete","pause","resume"].indexOf(t)>-1&&(this["_on"+(t.charAt(0).toUpperCase()+t.slice(1))]=e)},e.prototype.option=function(t,e){this["_"+t]=e},e}(j);O.tween=N;var R=function(t,e,n,r){var a=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var i=[];return Array.from(t).map((function(t,s){i[s]=r||{},i[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?a.tweens.push(new O.tween(t,e,n,i[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};R.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},R.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},R.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},R.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},R.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof R)e.chain(t.tweens);else{if(!(t instanceof O.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},R.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},R.prototype.removeTweens=function(){this.tweens=[]},R.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var H=function(t,e){if(this.element=V(t),this.element.tween=e,this.element.tween.toolbar=this.element,this.element.toolbar=this,this.element.output=this.element.parentNode.getElementsByTagName("OUTPUT")[0],!(this.element instanceof HTMLInputElement))throw TypeError("Target element is not [HTMLInputElement]");if("range"!==this.element.type)throw TypeError("Target element is not a range input");if(!(e instanceof O.tween))throw TypeError("tween parameter is not ["+O.tween+"]");this.element.setAttribute("value",0),this.element.setAttribute("min",0),this.element.setAttribute("max",1),this.element.setAttribute("step",1e-4),this.element.tween._onUpdate=this.updateBar,this.element.addEventListener("mousedown",this.downAction,!1)};H.prototype.updateBar=function(){var e=this.toolbar.output,n=this.paused?this.toolbar.value:(t.Time()-this._startTime)/this._duration;n=n>.9999?1:n<.01?0:n;var r=this._reversed?1-n:n;this.toolbar.value=r,e&&(e.value=(100*r).toFixed(2)+"%")},H.prototype.toggleEvents=function(t){this.element[t+"EventListener"]("mousemove",this.moveAction,!1),this.element[t+"EventListener"]("mouseup",this.upAction,!1)},H.prototype.updateTween=function(){var t=(this.tween._reversed?1-this.value:this.value)*this.tween._duration-1e-4;this.tween._startTime=0,this.tween.update(t)},H.prototype.moveAction=function(){this.toolbar.updateTween.call(this)},H.prototype.downAction=function(){this.tween.playing||this.tween.start(),this.tween.paused||(this.tween.pause(),this.toolbar.toggleEvents("add"),t.Tick=cancelAnimationFrame(t.Ticker))},H.prototype.upAction=function(){this.tween.paused&&(this.tween.paused&&this.tween.resume(),this.tween._startTime=t.Time()-(this.tween._reversed?1-this.value:this.value)*this.tween._duration,this.toolbar.toggleEvents("remove"),t.Tick=requestAnimationFrame(t.Ticker))};var D=function(t){try{t.component in c?console.error("KUTE.js - "+t.component+" already registered"):t.property in h?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};D.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:d,prepareStart:v,onStart:a,onComplete:m,crossCheck:g},i=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(c[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)h[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var l in t.defaultValues)h[l]=t.defaultValues[l];this.supports=(o||s)+" "+(s||i)+" properties"}if(t.defaultOptions)for(var u in t.defaultOptions)f[u]=t.defaultOptions[u];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][i||s]&&(n[p][e][i||s]=t.functions[p]);else for(var b in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][b]&&(n[p][e][b]=t.functions[p][b]);if(t.Interpolate){for(var x in t.Interpolate){var S=t.Interpolate[x];if("function"!=typeof S||r[x])for(var M in S)"function"!=typeof S[M]||r[x]||(r[x]=S[M]);else r[x]=S}y[e]=t.Interpolate}if(t.Util)for(var T in t.Util)!w[T]&&(w[T]=t.Util[T]);return this};var q=function(t){function e(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];t.apply(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setComponent=function(e){t.prototype.setComponent.call(this,e);var n={prepareProperty:d,prepareStart:v,onStart:a,onComplete:m,crossCheck:g},i=e.category,s=e.property,o=e.properties&&e.properties.length||e.subProperties&&e.subProperties.length;if("defaultValue"in e?(this.supports=s+" property",this.defaultValue=(e.defaultValue+"").length?"YES":"not set or incorrect"):e.defaultValues&&(this.supports=(o||s)+" "+(s||i)+" properties",this.defaultValues=Object.keys(e.defaultValues).length===o?"YES":"Not set or incomplete"),e.defaultOptions){for(var l in this.extends=[],e.defaultOptions)this.extends.push(l);this.extends.length?this.extends="with <"+this.extends.join(", ")+"> new option(s)":delete this.extends}if(e.functions){for(var u in this.interface=[],this.render=[],this.warning=[],n)u in e.functions?("prepareProperty"===u&&this.interface.push("fromTo()"),"prepareStart"===u&&this.interface.push("to()"),"onStart"===u&&(this.render="can render update")):("prepareProperty"===u&&this.warning.push("fromTo()"),"prepareStart"===u&&this.warning.push("to()"),"onStart"===u&&(this.render="no function to render update"));this.interface.length?this.interface=(i||s)+" can use ["+this.interface.join(", ")+"] method(s)":delete this.uses,this.warning.length?this.warning=(i||s)+" can't use ["+this.warning.join(", ")+"] method(s) because values aren't processed":delete this.warning}if(e.Interpolate){for(var p in this.uses=[],this.adds=[],e.Interpolate){var c=e.Interpolate[p];if("function"==typeof c)r[p]||this.adds.push(""+p),this.uses.push(""+p);else for(var h in c)"function"!=typeof c[h]||r[p]||this.adds.push(""+h),this.uses.push(""+h)}this.uses.length?this.uses="["+this.uses.join(", ")+"] interpolation function(s)":delete this.uses,this.adds.length?this.adds="new ["+this.adds.join(", ")+"] interpolation function(s)":delete this.adds}else this.critical="For "+(s||i)+" no interpolation function[s] is set";return e.Util&&(this.hasUtil=Object.keys(e.Util).join(",")),this},e}(D);function B(t,e,n){return(t=+t)+(e-=t)*n}function X(t,e){for(var n,r=parseInt(t)||0,a=["px","%","deg","rad","em","rem","vh","vw"],i=0;i>0)/100+"% "+(100*B(n[1],r[1],a)>>0)/100+"%"})}},Q={component:"backgroundPositionProp",property:"backgroundPosition",defaultValue:[50,50],Interpolate:{numbers:B},functions:Y,Util:{trueDimension:X}};function z(t,e,n,r){return(t=+t)+(e-=t)*r+n}function W(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=z(n.v,r.v,r.u,a)})}x.BackgroundPosition=Q;var K=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],G={};K.map((function(t){return G[t]=0}));var $={};K.forEach((function(t){$[t]=W}));var Z={component:"borderRadiusProperties",category:"borderRadius",properties:K,defaultValues:G,Interpolate:{units:z},functions:{prepareStart:function(t){return _(this.element,t)||h[t]},prepareProperty:function(t,e){return X(e)},onStart:$},Util:{trueDimension:X}};function J(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=(a>.99||a<.01?(10*B(n,r,a)>>0)/10:B(n,r,a)>>0)+"px"})}x.BorderRadiusProperties=Z;var tt=["top","left","width","height","right","bottom","minWidth","minHeight","maxWidth","maxHeight","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","margin","marginTop","marginBottom","marginLeft","marginRight","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","outlineWidth"],et={};tt.map((function(t){return et[t]=0}));var nt={};tt.map((function(t){return nt[t]=J}));var rt={component:"boxModelProperties",category:"boxModel",properties:tt,defaultValues:et,Interpolate:{numbers:B},functions:{prepareStart:function(t){return _(this.element,t)||h[t]},prepareProperty:function(t,e){var n=X(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:nt}};x.BoxModelProperties=rt;var at={prepareStart:function(t,e){var n=_(this.element,t),r=_(this.element,"width"),a=_(this.element,"height");return/rect/.test(n)?n:[0,r,a,0]},prepareProperty:function(t,e){if(e instanceof Array)return[X(e[0]),X(e[1]),X(e[2]),X(e[3])];var n=e.replace(/rect|\(|\)/g,"");return[X((n=/\,/g.test(n)?n.split(/\,/g):n.split(/\s/g))[0]),X(n[1]),X(n[2]),X(n[3])]},onStart:function(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,e,n,r){for(var a=0,i=[];a<4;a++){var s=e[a].v,o=n[a].v,l=n[a].u||"px";i[a]=(100*B(s,o,r)>>0)/100+l}t.style.clip="rect("+i+")"})}},it={component:"clipProperty",property:"clip",defaultValue:[0,0,0,0],Interpolate:{numbers:B},functions:at,Util:{trueDimension:X}};function st(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var a=document.getElementsByTagName("head")[0];a.style.color=t;var i=getComputedStyle(a,null).color;return i=/rgb/.test(i)?i.replace(/[^\d,]/g,"").split(","):[0,0,0],a.style.color="",{r:parseInt(i[0]),g:parseInt(i[1]),b:parseInt(i[2])}}}function ot(t,e,n){var r,a={};for(r in e)a[r]="a"!==r?B(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*B(t[r],e[r],n)>>0)/100:null;return a.a?"rgba("+a.r+","+a.g+","+a.b+","+a.a+")":"rgb("+a.r+","+a.g+","+a.b+")"}function lt(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=ot(n,r,a)})}x.ClipProperty=it;var ut=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],pt={};ut.map((function(t){pt[t]="#000"}));var ct={};ut.map((function(t){return ct[t]=lt}));var ht={component:"colorProperties",category:"colors",properties:ut,defaultValues:pt,Interpolate:{numbers:B,colors:ot},functions:{prepareStart:function(t,e){return _(this.element,t)||h[t]},prepareProperty:function(t,e){return st(e)},onStart:ct},Util:{trueColor:st}};x.ColorProperties=ht;var ft={},dt=["fill","stroke","stop-color"];function vt(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var gt={prepareStart:function(t,e){var n={};for(var r in e){var a=vt(r).replace(/_+[a-z]+/,""),i=this.element.getAttribute(a);n[a]=dt.includes(a)?i||"rgba(0,0,0,0)":i||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var i=vt(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(i.replace(/_+[a-z]+/,""));if(dt.includes(i))a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in ft)&&(ft[e]=function(t,e,n,r,a){t.setAttribute(e,ot(n,r,a))})},n[i]=st(e[r])||h.htmlAttributes[r];else if(null!==o&&s.test(o)){var l=X(o).u||X(e[r]).u,u=/%/.test(l)?"_percent":"_"+l;a.htmlAttributes[i+u]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in ft)&&(ft[e]=function(t,e,n,r,a){var i=e.replace(u,"");t.setAttribute(i,(1e3*B(n.v,r.v,a)>>0)/1e3+r.u)})},n[i+u]=X(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in ft)&&(ft[e]=function(t,e,n,r,a){t.setAttribute(e,(1e3*B(n,r,a)>>0)/1e3)})},n[i]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,a){for(var i in r)t.attributes[i](e,i,n[i],r[i],a)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=ft)}}},mt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:B,colors:ot},functions:gt,Util:{replaceUppercase:vt,trueColor:st,trueDimension:X}};function yt(t,e,n){for(var r=[],a=0;a<3;a++)r[a]=(100*B(t[a],e[a],n)>>0)/100+"px";return"drop-shadow("+r.concat(ot(t[3],e[3],n)).join(" ")+")"}function bt(t){return t.replace("-r","R").replace("-s","S")}function wt(t){var e;3===t.length?e=[t[0],t[1],0,t[2]]:4===t.length&&(e=[t[0],t[1],t[2],t[3]]);for(var n=0;n<3;n++)e[n]=parseFloat(e[n]);return e[3]=st(e[3]),e}function xt(t){var e={},n=t.match(/(([a-z].*?)\(.*?\))(?=\s([a-z].*?)\(.*?\)|\s*$)/g),r="none"!==t?n:"none";if(r instanceof Array)for(var a=0,i=r.length;a>0)/100+"%)":"")+(n.blur||r.blur?"blur("+(100*B(n.blur,r.blur,a)>>0)/100+"em)":"")+(n.saturate||r.saturate?"saturate("+(100*B(n.saturate,r.saturate,a)>>0)/100+"%)":"")+(n.invert||r.invert?"invert("+(100*B(n.invert,r.invert,a)>>0)/100+"%)":"")+(n.grayscale||r.grayscale?"grayscale("+(100*B(n.grayscale,r.grayscale,a)>>0)/100+"%)":"")+(n.hueRotate||r.hueRotate?"hue-rotate("+(100*B(n.hueRotate,r.hueRotate,a)>>0)/100+"deg)":"")+(n.sepia||r.sepia?"sepia("+(100*B(n.sepia,r.sepia,a)>>0)/100+"%)":"")+(n.brightness||r.brightness?"brightness("+(100*B(n.brightness,r.brightness,a)>>0)/100+"%)":"")+(n.contrast||r.contrast?"contrast("+(100*B(n.contrast,r.contrast,a)>>0)/100+"%)":"")+(n.dropShadow||r.dropShadow?yt(n.dropShadow,r.dropShadow,a):"")})},crossCheck:function(t){if(this.valuesEnd[t])for(var e in this.valuesStart[t])this.valuesEnd[t][e]||(this.valuesEnd[t][e]=this.valuesStart[t][e])}},Mt={component:"filterEffects",property:"filter",defaultValue:{opacity:100,blur:0,saturate:100,grayscale:0,brightness:100,contrast:100,sepia:0,invert:0,hueRotate:0,dropShadow:[0,0,0,{r:0,g:0,b:0}],url:""},Interpolate:{opacity:B,blur:B,saturate:B,grayscale:B,brightness:B,contrast:B,sepia:B,invert:B,hueRotate:B,dropShadow:{numbers:B,colors:ot,dropShadow:yt}},functions:St,Util:{parseDropShadow:wt,parseFilterString:xt,replaceDashNamespace:bt,trueColor:st}};x.FilterEffects=Mt;var Tt={prepareStart:function(t){return _(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=(1e3*B(n,r,a)>>0)/1e3})}},Ct={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:B},functions:Tt};function Et(t,e){return parseFloat(t)/100*e}function _t(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function kt(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},a=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var i=0;i>0)/100,i=0-(100*B(e.s,n.s,r)>>0)/100,s=(100*B(e.e,n.e,r)>>0)/100+i;t.style.strokeDashoffset=i+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+a+"px"})}},Ut={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:B},functions:Vt,Util:{getRectLength:_t,getPolyLength:kt,getLineLength:It,getCircleLength:At,getEllipseLength:Pt,getTotalLength:Ot,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:Lt,percent:Et}};function Ft(t){return t.map((function(t){return"string"==typeof t?t:t.shift()+t.join(",")})).join(" ")}function jt(t){return t.map((function(t){return Array.isArray(t)?jt(t):isNaN(+t)?t:+t}))}x.SVGDraw=Ut;var Nt=3;function Rt(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Nt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Ht(t){return this.segments=[],this.isClosed=0,this.isAbsolute=0,this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var Dt={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function qt(t){return t>=48&&t<=57}function Bt(t){return t>=48&&t<=57||43===t||45===t||46===t}function Xt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Yt(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="SvgPath: arc flag can be 0 or 1 only (at pos "+t.index+")")}function Qt(t){var e,n=t.index,r=n,a=t.max,i=!1,s=!1,o=!1,l=!1;if(r>=a)t.err="SvgPath: missed param (at pos "+r+")";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=Dt[n]&&(t.segments.push([e].concat(r.splice(0,Dt[n]))),Dt[n]););}function Wt(t){var e,n,r,a,i,s=t.max;if(t.segmentStart=t.index,e=t.pathValue.charCodeAt(t.index),n=97==(32|e),function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e)){if(a=Dt[t.pathValue[t.index].toLowerCase()],t.index++,Xt(t),t.data=[],!a)return t.isClosed=1,void zt(t);for(r=!1;;){for(i=a;i>0;i--){if(!n||3!==i&&4!==i?Qt(t):Yt(t),t.err.length)return;t.data.push(t.param),Xt(t),r=!1,t.index=t.max)break;if(!Bt(t.pathValue.charCodeAt(t.index)))break}}zt(t)}else t.err="SvgPath: bad command "+t.pathValue[t.index]+" (at pos "+t.index+")"}function Kt(t){if(Array.isArray(t))return jt(t);var e=new Ht(t),n=e.max;for(Xt(e);e.indexr;r+=2){var i=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?a-4==r?i[3]={x:+t[0],y:+t[1]}:a-2==r&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[a-2],y:+t[a-1]}:a-4==r?i[3]=i[2]:r||(i[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return n}function $t(t,e,n,r,a){var i;if(null==a&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=a){var s=Math.PI/180,o=t+n*Math.cos(-r*s),l=t+n*Math.cos(-a*s);i=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(a-r>180),0,l,e+n*Math.sin(-a*s)]]}else i=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return i}function Zt(t){if(!(t=Kt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,a=0,i=0,s=0,o=t.length,l=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],a=n,i=r,s++,e[0]=["M",n,r]);for(var u=function(s){var o=void 0,u=t[s],p=u[0];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=+u[6]+n,o[7]=+u[7]+r;break;case"V":o[1]=+u[1]+r;break;case"H":o[1]=+u[1]+n;break;case"R":for(var c=[n,r].concat(u.slice(1)),h=2,f=c.length;h1&&(n*=w=Math.sqrt(w),r*=w);var x=n*n,S=r*r,M=(i==s?-1:1)*Math.sqrt(Math.abs((x*S-x*b*b-S*y*y)/(x*b*b+S*y*y)));f=M*n*b/r+(t+o)/2,d=M*-r*y/n+(e+l)/2,c=Math.asin((e-d)/r),h=Math.asin((l-d)/r),c=th&&(c-=2*Math.PI),!s&&h>c&&(h-=2*Math.PI)}var T=h-c;if(Math.abs(T)>v){var C=h,E=o,_=l;h=c+v*(s&&h>c?1:-1),o=f+n*Math.cos(h),l=d+r*Math.sin(h),m=te(o,l,n,r,a,0,s,E,_,[h,C,f,d])}T=h-c;var k=Math.cos(c),I=Math.sin(c),A=Math.cos(h),P=Math.sin(h),O=Math.tan(T/4),L=4/3*n*O,V=4/3*r*O,U=[t,e],F=[t+L*I,e-V*k],j=[o+L*P,l-V*A],N=[o,l];return F[0]=2*U[0]-F[0],F[1]=2*U[1]-F[1],u?[F,j,N].concat(m):(m=[F,j,N].concat(m).join().split(",")).map((function(t,e){return e%2?Jt(m[e-1],t,g).y:Jt(t,m[e+1],g).x}))}function ee(t,e,n,r,a,i){return[1/3*t+2/3*n,1/3*e+2/3*r,1/3*a+2/3*n,1/3*i+2/3*r,a,i]}function ne(t,e,n,r){return[t,e,n,r,n,r]}function re(t,e,n){var r,a;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in{T:1,Q:1})&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"].concat(te.apply(0,[e.x,e.y].concat(t.slice(1))));break;case"S":"C"==n||"S"==n?(r=2*e.x-e.bx,a=2*e.y-e.by):(r=e.x,a=e.y),t=["C",r,a].concat(t.slice(1));break;case"T":"Q"==n||"T"==n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"].concat(ee(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"].concat(ee(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"].concat(ne(e.x,e.y,t[1],t[2]));break;case"H":t=["C"].concat(ne(e.x,e.y,t[1],e.y));break;case"V":t=["C"].concat(ne(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"].concat(ne(e.x,e.y,e.X,e.Y))}return t}function ae(t,e,n,r,a){t&&e&&"M"===t[a][0]&&"M"!==e[a][0]&&(e.splice(a,0,["M",r.x,r.y]),n.bx=0,n.by=0,n.x=t[a][1],n.y=t[a][2])}function ie(t,e,n,r,a){if(t[a].length>7){t[a].shift();for(var i=t[a];i.length;)n[a]="A",e&&(r[a]="A"),t.splice(a++,0,["C"].concat(i.splice(0,6)));t.splice(a,1)}}function se(t,e){for(var n=Zt(t),r=e&&Zt(e),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=[],o=[],l="",u="",p=Math.max(n.length,r&&r.length||0),c=0;c=n&&(o-=r),t[o])}))}function pe(t){return t.map((function(e,n){return ue(t,n)}))}function ce(t,e){var n=t.length-1,r=[],a=[],i=pe(t);return i.map((function(i,s){for(var o,l,u,p,c,h=0,f=le("M0,0L0,0"),d=0;d>0)/1e3)}t.setAttribute("d",1===r?n.original:Ft(a))})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].curve,n=this.valuesEnd[t].curve;if(!e||!n||e&&n&&"M"===e[0][0]&&e.length!==n.length){var r=se(this.valuesStart[t].original,this.valuesEnd[t].original),a=this._reverseFirstPath?oe(r[0]):r[0],i=this._reverseSecondPath?oe(r[1]):r[1];a=ce.call(this,a,i),this.valuesStart[t].curve=a,this.valuesEnd[t].curve=i}}}},fe={component:"svgCubicMorph",property:"path",defaultValue:[],Interpolate:{numbers:B,pathToString:Ft},functions:he,Util:{pathToCurve:se,pathToAbsolute:Zt,pathToString:Ft,parsePathString:Kt,getRotatedCurve:ce,getRotations:pe,getRotationSegments:ue,reverseCurve:oe,createPath:le}};function de(t,e){var n=e.x,r=e.width;return/[a-zA-Z]/.test(t)&&!/px/.test(t)?t.replace(/top|left/,0).replace(/right|bottom/,100).replace(/center|middle/,50):/%/.test(t)?n+parseFloat(t)*r/100:parseFloat(t)}function ve(t){var e=t&&/\)/.test(t)?t.substring(0,t.length-1).split(/\)\s|\)/):"none",n={};if(e instanceof Array)for(var r=0,a=e.length;r>0)/1e3+(s?","+(1e3*s>>0)/1e3:"")+")":"")+(u?"rotate("+(1e3*u>>0)/1e3+")":"")+(h?"skewX("+(1e3*h>>0)/1e3+")":"")+(f?"skewY("+(1e3*f>>0)/1e3+")":"")+(1!==l?"scale("+(1e3*l>>0)/1e3+")":""))})},crossCheck:function(t){if(this._resetStart&&this.valuesEnd[t]){var e=this.valuesStart[t],n=this.valuesEnd[t],r=ge.call(this,t,ve(this.element.getAttribute("transform")));for(var a in r)e[a]=r[a];var i=this.element.ownerSVGElement,s=i.createSVGTransformFromMatrix(i.createSVGMatrix().translate(-e.origin[0],-e.origin[1]).translate("translate"in e?e.translate[0]:0,"translate"in e?e.translate[1]:0).rotate(e.rotate||0).skewX(e.skewX||0).skewY(e.skewY||0).scale(e.scale||1).translate(+e.origin[0],+e.origin[1]));for(var o in e.translate=[s.matrix.e,s.matrix.f],e)o in n&&"origin"!==o||(n[o]=e[o])}}},ye={component:"svgTransformProperty",property:"svgTransform",defaultOptions:{transformOrigin:"50% 50%"},defaultValue:{translate:0,rotate:0,skewX:0,skewY:0,scale:1},Interpolate:{numbers:B},functions:me,Util:{parseStringOrigin:de,parseTransformString:ve,parseTransformSVG:ge}};x.SVGTransformProperty=ye;var be=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){}return t}(),we="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],xe="ontouchstart"in window||navigator.msMaxTouchPoints||!1?"touchstart":"mousewheel",Se=navigator&&/(EDGE|Mac)/i.test(navigator.userAgent)?document.body:document.documentElement,Me=!!be&&{passive:!1};function Te(t){this.scrolling&&t.preventDefault()}function Ce(){var t=this.element;return t===Se?{el:document,st:document.body}:{el:t,st:t}}function Ee(t,e){e[t](we[0],Te,Me),e[t](xe,Te,Me)}function _e(){var t=Ce.call(this);"scroll"in this.valuesEnd&&!t.el.scrolling&&(t.el.scrolling=1,Ee("addEventListener",t.el),t.st.style.pointerEvents="none")}function ke(){var t=Ce.call(this);"scroll"in this.valuesEnd&&t.el.scrolling&&(t.el.scrolling=0,Ee("removeEventListener",t.el),t.st.style.pointerEvents="")}var Ie={prepareStart:function(){return this.element=!("scroll"in this.valuesEnd)||this.element&&this.element!==window?this.element:Se,this.element===Se?window.pageYOffset||Se.scrollTop:this.element.scrollTop},prepareProperty:function(t,e){return parseInt(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(this.element=!("scroll"in this.valuesEnd)||this.element&&this.element!==window?this.element:Se,_e.call(this),t[e]=function(t,e,n,r){t.scrollTop=B(e,n,r)>>0})},onComplete:function(t){ke.call(this)}},Ae={component:"scrollProperty",property:"scroll",defaultValue:0,Interpolate:{numbers:B},functions:Ie,Util:{preventScroll:Te,scrollIn:_e,scrollOut:ke,getScrollTargets:Ce,toggleScrollEvents:Ee,supportPassive:be}};function Pe(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){for(var i=[],s="textShadow"===e?3:4,o=3===s?n[3]:n[4],l=3===s?r[3]:r[4],u=!!(n[5]&&"none"!==n[5]||r[5]&&"none"!==r[5])&&" inset",p=0;p>0)/1e3+"px");t.style[e]=u?ot(o,l,a)+i.join(" ")+u:ot(o,l,a)+i.join(" ")})}x.ScrollProperty=Ae;var Oe=["boxShadow","textShadow"];function Le(t,e){var n,r;for(3===t.length?n=[t[0],t[1],0,0,t[2],"none"]:4===t.length?n=/inset|none/.test(t[3])?[t[0],t[1],0,0,t[2],t[3]]:[t[0],t[1],t[2],0,t[3],"none"]:5===t.length?n=/inset|none/.test(t[4])?[t[0],t[1],t[2],0,t[3],t[4]]:[t[0],t[1],t[2],t[3],t[4],"none"]:6===t.length&&(n=t),r=0;r<4;r++)n[r]=parseFloat(n[r]);return n[4]=st(n[4]),n="boxShadow"===e?n:n.filter((function(t,e){return[0,1,2,4].indexOf(e)>-1}))}var Ve={};Oe.map((function(t){return Ve[t]=Pe}));var Ue={component:"shadowProperties",properties:Oe,defaultValues:{boxShadow:"0px 0px 0px 0px rgb(0,0,0)",textShadow:"0px 0px 0px rgb(0,0,0)"},Interpolate:{numbers:B,colors:ot},functions:{prepareStart:function(t,e){var n=_(this.element,t);return/^none$|^initial$|^inherit$|^inset$/.test(n)?h[t]:n},prepareProperty:function(t,e){if("string"==typeof e){var n,r="none";r=/inset/.test(e)?"inset":r,n=(e=/inset/.test(e)?e.replace(/(\s+inset|inset+\s)/g,""):e).match(/(\s?(?:#(?:[\da-f]{3}){1,2}|rgba?\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))\s?)/gi),e=Le(e=e.replace(n[0],"").split(" ").concat([n[0].replace(/\s/g,"")],[r]),t)}else e instanceof Array&&(e=Le(e,t));return e},onStart:Ve},Util:{processShadowArray:Le,trueColor:st}};function Fe(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=z(n.v,r.v,r.u,a)})}x.ShadowProperties=Ue;var je=["fontSize","lineHeight","letterSpacing","wordSpacing"],Ne={};je.forEach((function(t){Ne[t]=Fe}));var Re={component:"textProperties",category:"textProperties",properties:je,defaultValues:{fontSize:0,lineHeight:0,letterSpacing:0,wordSpacing:0},Interpolate:{units:z},functions:{prepareStart:function(t){return _(this.element,t)||h[t]},prepareProperty:function(t,e){return X(e)},onStart:Ne},Util:{trueDimension:X}};x.TextProperties=Re;var He=String("abcdefghijklmnopqrstuvwxyz").split(""),De=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),qe=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),Be=String("0123456789").split(""),Xe=He.concat(De,Be),Ye=Xe.concat(qe),Qe={alpha:He,upper:De,symbols:qe,numeric:Be,alphanumeric:Xe,all:Ye},ze={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in Qe?Qe[n]:n&&n.length?n:Qe[f.textChars];t[e]=function(t,e,n,a){var i="",s="",o=e.substring(0),l=n.substring(0),u=r[Math.random()*r.length>>0];" "===e?(s=l.substring(Math.min(a*l.length,l.length)>>0,0),t.innerHTML=a<1?s+u:""===n?" ":n):" "===n?(i=o.substring(0,Math.min((1-a)*o.length,o.length)>>0),t.innerHTML=a<1?i+u:""===n?" ":n):(i=o.substring(o.length,Math.min(a*o.length,o.length)>>0),s=l.substring(0,Math.min(a*l.length,l.length)>>0),t.innerHTML=a<1?s+u+i:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=B(e,n,r)>>0})}};function We(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var a=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=a,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function Ke(t,e){var n=[];if(t.children.length){for(var r,a=[],i=t.innerHTML,s=0,o=t.children.length,l=void 0,u=void 0,p=void 0;s>0)/1e3;return r}x.TextWriteProperties=Ge;var Ze="undefined"!=typeof DOMMatrix?DOMMatrix:"undefined"!=typeof WebKitCSSMatrix?WebKitCSSMatrix:"undefined"!=typeof CSSMatrix?CSSMatrix:"undefined"!=typeof MSCSSMatrix?MSCSSMatrix:null;var Je={component:"transformMatrix",property:"transform",defaultValue:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,skew:[0,0],skewX:0,skewY:0,scale3d:[1,1,1],scaleX:1,scaleY:1,scaleZ:1},functions:{prepareStart:function(t,e){var n={};if(this.element.transformMatrix){var r=this.element.transformMatrix;for(var a in r)n[a]=r[a]}else for(var i in e)n[i]="perspective"===i?e[i]:h.transform[i];return n},prepareProperty:function(t,e){if("object"==typeof e&&!e.length){var n={},r={},a={},i={},s={},o=[{translate3d:r},{rotate3d:a},{skew:s},{scale3d:i}],l=function(t){if(/3d/.test(t)&&"object"==typeof e[t]&&e[t].length){var o=e[t].map((function(e){return"scale3d"===t?parseFloat(e):parseInt(e)}));n[t]="scale3d"===t?[o[0]||1,o[1]||1,o[2]||1]:[o[0]||0,o[1]||0,o[2]||0]}else if(/[XYZ]/.test(t)){(/translate/.test(t)?r:/rotate/.test(t)?a:/scale/.test(t)?i:/skew/.test(t)?s:{})[t.replace(/translate|rotate|scale|skew/,"").toLowerCase()]=/scale/.test(t)?parseFloat(e[t]):parseInt(e[t])}else if("skew"===t){var l=e[t].map((function(t){return parseInt(t)||0}));n[t]=[l[0]||0,l[1]||0]}else n[t]=parseInt(e[t])};for(var u in e)l(u);return o.map((function(t){var e=Object.keys(t)[0],r=t[e];Object.keys(r).length&&!n[e]&&(n[e]="scale3d"===e?[r.x||1,r.y||1,r.z||1]:"skew"===e?[r.x||0,r.y||0]:[r.x||0,r.y||0,r.z||0])})),n}console.error('KUTE.js - "'+e+'" is not valid/supported transform function')},onStart:{transform:function(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){var i=new Ze,s={};for(var o in r)s[o]="perspective"===o?B(n[o],r[o],a):$e(n[o],r[o],a);s.perspective&&(i.m34=-1/s.perspective),i=s.translate3d?i.translate(s.translate3d[0],s.translate3d[1],s.translate3d[2]):i,i=s.rotate3d?i.rotate(s.rotate3d[0],s.rotate3d[1],s.rotate3d[2]):i,s.skew&&(i=s.skew[0]?i.skewX(s.skew[0]):i,i=s.skew[1]?i.skewY(s.skew[1]):i),i=s.scale3d?i.scale(s.scale3d[0],s.scale3d[1],s.scale3d[2]):i,t.style[e]=i.toString()})},CSS3Matrix:function(e){this.valuesEnd.transform&&!t[e]&&(t[e]=Ze)}},onComplete:function(t){if(this.valuesEnd[t])for(var e in this.element.transformMatrix={},this.valuesEnd[t])this.element.transformMatrix[e]=this.valuesEnd[t][e]},crossCheck:function(t){this.valuesEnd[t]&&this.valuesEnd[t].perspective&&!this.valuesStart[t].perspective&&(this.valuesStart[t].perspective=this.valuesEnd[t].perspective)}},Interpolate:{perspective:B,translate3d:$e,rotate3d:$e,skew:$e,scale3d:$e}};for(var tn in x.TransformMatrix=Je,x){var en=x[tn];x[tn]=new q(en)}return{Animation:q,Components:x,TweenExtra:N,fromTo:function(t,e,n,r){return r=r||{},new O.tween(V(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new O.tween(V(t),e,e,n)},TweenCollection:R,ProgressBar:H,allFromTo:function(t,e,n,r){return r=r||{},new R(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new R(V(t,!0),e,e,n)},Objects:b,Util:w,Easing:L,CubicBezier:P,Render:u,Interpolate:r,Process:A,Internals:C,Selector:V,Version:"2.0.13"}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).KUTE=e()}(this,(function(){"use strict";var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},a={},i={};i.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ea?e=r:n=r,r=.5*(n-e)+e}return r};var L={},V={linear:new O(0,0,1,1,"linear"),easingSinusoidalIn:new O(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new O(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new O(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new O(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new O(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new O(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new O(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new O(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new O(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new O(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new O(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new O(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new O(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new O(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new O(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new O(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new O(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new O(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new O(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new O(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new O(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new O(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new O(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new O(.68,-.55,.265,1.55,"easingBackInOut")};function U(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function j(){for(var t in a)if("function"==typeof a[t])a[t].call(this,t);else for(var e in a[t])a[t][e].call(this,e);C.call(this)}L.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof V[t])return V[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new O(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),V.linear};var F=function(e,n,r,i){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,i=i||{},this._resetStart=i.resetStart||0,this._easing="function"==typeof i.easing?i.easing:L.processEasing(i.easing),this._duration=i.duration||d.duration,this._delay=i.delay||d.delay,i){var o="_"+s;o in this||(this[o]=i[s])}var l=this._easing.name;return a[l]||(a[l]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};F.prototype.start=function(e){return M(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),j.call(this),this._startFired=!0),!s&&o(),this},F.prototype.stop=function(){return this.playing&&(T(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},F.prototype.close=function(){for(var t in y)for(var e in y[t])y[t][e].call(this,e);this._startFired=!1,l.call(this)},F.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},F.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},F.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},L.tween=F,d.repeat=0,d.repeatDelay=0,d.yoyo=!1,d.resetStart=!1;var N=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],a=t[2];if(k.call(this,a,"end"),this._resetStart?this.valuesStart=r:k.call(this,r,"start"),!this._resetStart)for(var i in m)for(var s in m[i])m[i][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||d.repeat,this._repeatDelay=o.repeatDelay||d.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||d.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,A.call(this),m)for(var r in m[n])m[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var a in this.valuesEnd)this.valuesRepeat[a]=this.valuesStart[a];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),j.call(this),this._startTime+=t.Time()-this._pauseTime,M(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(T(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(F);L.tween=N;var R=function(t){function e(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return t.apply(this,e),this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.to=function(t,e){},e.prototype.fromTo=function(t,e){},e.prototype.getTotalDuration=function(){},e.prototype.on=function(t,e){["start","stop","update","complete","pause","resume"].indexOf(t)>-1&&(this["_on"+(t.charAt(0).toUpperCase()+t.slice(1))]=e)},e.prototype.option=function(t,e){this["_"+t]=e},e}(N);L.tween=R;var H=function(t,e,n,r){var a=this;this.tweens=[],!("offset"in d)&&(d.offset=0),(r=r||{}).delay=r.delay||d.delay;var i=[];return Array.from(t).map((function(t,s){i[s]=r||{},i[s].delay=s>0?r.delay+(r.offset||d.offset):r.delay,t instanceof Element?a.tweens.push(new L.tween(t,e,n,i[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};H.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},H.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},H.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},H.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},H.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof H)e.chain(t.tweens);else{if(!(t instanceof L.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},H.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},H.prototype.removeTweens=function(){this.tweens=[]},H.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var D=function(t,e){if(this.element=U(t),this.element.tween=e,this.element.tween.toolbar=this.element,this.element.toolbar=this,this.element.output=this.element.parentNode.getElementsByTagName("OUTPUT")[0],!(this.element instanceof HTMLInputElement))throw TypeError("Target element is not [HTMLInputElement]");if("range"!==this.element.type)throw TypeError("Target element is not a range input");if(!(e instanceof L.tween))throw TypeError("tween parameter is not ["+L.tween+"]");this.element.setAttribute("value",0),this.element.setAttribute("min",0),this.element.setAttribute("max",1),this.element.setAttribute("step",1e-4),this.element.tween._onUpdate=this.updateBar,this.element.addEventListener("mousedown",this.downAction,!1)};D.prototype.updateBar=function(){var e=this.toolbar.output,n=this.paused?this.toolbar.value:(t.Time()-this._startTime)/this._duration;n=n>.9999?1:n<.01?0:n;var r=this._reversed?1-n:n;this.toolbar.value=r,e&&(e.value=(100*r).toFixed(2)+"%")},D.prototype.toggleEvents=function(t){this.element[t+"EventListener"]("mousemove",this.moveAction,!1),this.element[t+"EventListener"]("mouseup",this.upAction,!1)},D.prototype.updateTween=function(){var t=(this.tween._reversed?1-this.value:this.value)*this.tween._duration-1e-4;this.tween._startTime=0,this.tween.update(t)},D.prototype.moveAction=function(){this.toolbar.updateTween.call(this)},D.prototype.downAction=function(){this.tween.playing||this.tween.start(),this.tween.paused||(this.tween.pause(),this.toolbar.toggleEvents("add"),t.Tick=cancelAnimationFrame(t.Ticker))},D.prototype.upAction=function(){this.tween.paused&&(this.tween.paused&&this.tween.resume(),this.tween._startTime=t.Time()-(this.tween._reversed?1-this.value:this.value)*this.tween._duration,this.toolbar.toggleEvents("remove"),t.Tick=requestAnimationFrame(t.Ticker))};var q=function(t){try{t.component in h?console.error("KUTE.js - "+t.component+" already registered"):t.property in f?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};q.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:v,prepareStart:g,onStart:a,onComplete:y,crossCheck:m},i=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(h[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)f[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var l in t.defaultValues)f[l]=t.defaultValues[l];this.supports=(o||s)+" "+(s||i)+" properties"}if(t.defaultOptions)for(var u in t.defaultOptions)d[u]=t.defaultOptions[u];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][i||s]&&(n[p][e][i||s]=t.functions[p]);else for(var c in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][c]&&(n[p][e][c]=t.functions[p][c]);if(t.Interpolate){for(var w in t.Interpolate){var S=t.Interpolate[w];if("function"!=typeof S||r[w])for(var M in S)"function"!=typeof S[M]||r[w]||(r[w]=S[M]);else r[w]=S}b[e]=t.Interpolate}if(t.Util)for(var T in t.Util)!x[T]&&(x[T]=t.Util[T]);return this};var B=function(t){function e(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];t.apply(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setComponent=function(e){t.prototype.setComponent.call(this,e);var n={prepareProperty:v,prepareStart:g,onStart:a,onComplete:y,crossCheck:m},i=e.category,s=e.property,o=e.properties&&e.properties.length||e.subProperties&&e.subProperties.length;if("defaultValue"in e?(this.supports=s+" property",this.defaultValue=(e.defaultValue+"").length?"YES":"not set or incorrect"):e.defaultValues&&(this.supports=(o||s)+" "+(s||i)+" properties",this.defaultValues=Object.keys(e.defaultValues).length===o?"YES":"Not set or incomplete"),e.defaultOptions){for(var l in this.extends=[],e.defaultOptions)this.extends.push(l);this.extends.length?this.extends="with <"+this.extends.join(", ")+"> new option(s)":delete this.extends}if(e.functions){for(var u in this.interface=[],this.render=[],this.warning=[],n)u in e.functions?("prepareProperty"===u&&this.interface.push("fromTo()"),"prepareStart"===u&&this.interface.push("to()"),"onStart"===u&&(this.render="can render update")):("prepareProperty"===u&&this.warning.push("fromTo()"),"prepareStart"===u&&this.warning.push("to()"),"onStart"===u&&(this.render="no function to render update"));this.interface.length?this.interface=(i||s)+" can use ["+this.interface.join(", ")+"] method(s)":delete this.uses,this.warning.length?this.warning=(i||s)+" can't use ["+this.warning.join(", ")+"] method(s) because values aren't processed":delete this.warning}if(e.Interpolate){for(var p in this.uses=[],this.adds=[],e.Interpolate){var c=e.Interpolate[p];if("function"==typeof c)r[p]||this.adds.push(""+p),this.uses.push(""+p);else for(var h in c)"function"!=typeof c[h]||r[p]||this.adds.push(""+h),this.uses.push(""+h)}this.uses.length?this.uses="["+this.uses.join(", ")+"] interpolation function(s)":delete this.uses,this.adds.length?this.adds="new ["+this.adds.join(", ")+"] interpolation function(s)":delete this.adds}else this.critical="For "+(s||i)+" no interpolation function[s] is set";return e.Util&&(this.hasUtil=Object.keys(e.Util).join(",")),this},e}(q);function X(t,e,n){return(t=+t)+(e-=t)*n}function Y(t,e){for(var n,r=parseInt(t)||0,a=["px","%","deg","rad","em","rem","vh","vw"],i=0;i>0)/100+"% "+(100*X(n[1],r[1],a)>>0)/100+"%"})}},z={component:"backgroundPositionProp",property:"backgroundPosition",defaultValue:[50,50],Interpolate:{numbers:X},functions:Q,Util:{trueDimension:Y}};function W(t,e,n,r){return(t=+t)+(e-=t)*r+n}function K(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=W(n.v,r.v,r.u,a)})}S.BackgroundPosition=z;var G=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],$={};G.map((function(t){return $[t]=0}));var Z={};G.forEach((function(t){Z[t]=K}));var J={component:"borderRadiusProperties",category:"borderRadius",properties:G,defaultValues:$,Interpolate:{units:W},functions:{prepareStart:function(t){return I(this.element,t)||f[t]},prepareProperty:function(t,e){return Y(e)},onStart:Z},Util:{trueDimension:Y}};function tt(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=(a>.99||a<.01?(10*X(n,r,a)>>0)/10:X(n,r,a)>>0)+"px"})}S.BorderRadiusProperties=J;var et=["top","left","width","height","right","bottom","minWidth","minHeight","maxWidth","maxHeight","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","margin","marginTop","marginBottom","marginLeft","marginRight","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","outlineWidth"],nt={};et.map((function(t){return nt[t]=0}));var rt={};et.map((function(t){return rt[t]=tt}));var at={component:"boxModelProperties",category:"boxModel",properties:et,defaultValues:nt,Interpolate:{numbers:X},functions:{prepareStart:function(t){return I(this.element,t)||f[t]},prepareProperty:function(t,e){var n=Y(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:rt}};S.BoxModelProperties=at;var it={prepareStart:function(t,e){var n=I(this.element,t),r=I(this.element,"width"),a=I(this.element,"height");return/rect/.test(n)?n:[0,r,a,0]},prepareProperty:function(t,e){if(e instanceof Array)return[Y(e[0]),Y(e[1]),Y(e[2]),Y(e[3])];var n=e.replace(/rect|\(|\)/g,"");return[Y((n=/\,/g.test(n)?n.split(/\,/g):n.split(/\s/g))[0]),Y(n[1]),Y(n[2]),Y(n[3])]},onStart:function(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,e,n,r){for(var a=0,i=[];a<4;a++){var s=e[a].v,o=n[a].v,l=n[a].u||"px";i[a]=(100*X(s,o,r)>>0)/100+l}t.style.clip="rect("+i+")"})}},st={component:"clipProperty",property:"clip",defaultValue:[0,0,0,0],Interpolate:{numbers:X},functions:it,Util:{trueDimension:Y}};function ot(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var a=document.getElementsByTagName("head")[0];a.style.color=t;var i=getComputedStyle(a,null).color;return i=/rgb/.test(i)?i.replace(/[^\d,]/g,"").split(","):[0,0,0],a.style.color="",{r:parseInt(i[0]),g:parseInt(i[1]),b:parseInt(i[2])}}}function lt(t,e,n){var r,a={};for(r in e)a[r]="a"!==r?X(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*X(t[r],e[r],n)>>0)/100:null;return a.a?"rgba("+a.r+","+a.g+","+a.b+","+a.a+")":"rgb("+a.r+","+a.g+","+a.b+")"}function ut(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=lt(n,r,a)})}S.ClipProperty=st;var pt=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],ct={};pt.map((function(t){ct[t]="#000"}));var ht={};pt.map((function(t){return ht[t]=ut}));var ft={component:"colorProperties",category:"colors",properties:pt,defaultValues:ct,Interpolate:{numbers:X,colors:lt},functions:{prepareStart:function(t,e){return I(this.element,t)||f[t]},prepareProperty:function(t,e){return ot(e)},onStart:ht},Util:{trueColor:ot}};S.ColorProperties=ft;var dt={},vt=["fill","stroke","stop-color"];function gt(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var mt={prepareStart:function(t,e){var n={};for(var r in e){var a=gt(r).replace(/_+[a-z]+/,""),i=this.element.getAttribute(a);n[a]=vt.includes(a)?i||"rgba(0,0,0,0)":i||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var i=gt(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(i.replace(/_+[a-z]+/,""));if(vt.includes(i))a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in dt)&&(dt[e]=function(t,e,n,r,a){t.setAttribute(e,lt(n,r,a))})},n[i]=ot(e[r])||f.htmlAttributes[r];else if(null!==o&&s.test(o)){var l=Y(o).u||Y(e[r]).u,u=/%/.test(l)?"_percent":"_"+l;a.htmlAttributes[i+u]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in dt)&&(dt[e]=function(t,e,n,r,a){var i=e.replace(u,"");t.setAttribute(i,(1e3*X(n.v,r.v,a)>>0)/1e3+r.u)})},n[i+u]=Y(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in dt)&&(dt[e]=function(t,e,n,r,a){t.setAttribute(e,(1e3*X(n,r,a)>>0)/1e3)})},n[i]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,a){for(var i in r)t.attributes[i](e,i,n[i],r[i],a)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=dt)}}},yt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:X,colors:lt},functions:mt,Util:{replaceUppercase:gt,trueColor:ot,trueDimension:Y}};function bt(t,e,n){for(var r=[],a=0;a<3;a++)r[a]=(100*X(t[a],e[a],n)>>0)/100+"px";return"drop-shadow("+r.concat(lt(t[3],e[3],n)).join(" ")+")"}function wt(t){return t.replace("-r","R").replace("-s","S")}function xt(t){var e;3===t.length?e=[t[0],t[1],0,t[2]]:4===t.length&&(e=[t[0],t[1],t[2],t[3]]);for(var n=0;n<3;n++)e[n]=parseFloat(e[n]);return e[3]=ot(e[3]),e}function St(t){var e={},n=t.match(/(([a-z].*?)\(.*?\))(?=\s([a-z].*?)\(.*?\)|\s*$)/g),r="none"!==t?n:"none";if(r instanceof Array)for(var a=0,i=r.length;a>0)/100+"%)":"")+(n.blur||r.blur?"blur("+(100*X(n.blur,r.blur,a)>>0)/100+"em)":"")+(n.saturate||r.saturate?"saturate("+(100*X(n.saturate,r.saturate,a)>>0)/100+"%)":"")+(n.invert||r.invert?"invert("+(100*X(n.invert,r.invert,a)>>0)/100+"%)":"")+(n.grayscale||r.grayscale?"grayscale("+(100*X(n.grayscale,r.grayscale,a)>>0)/100+"%)":"")+(n.hueRotate||r.hueRotate?"hue-rotate("+(100*X(n.hueRotate,r.hueRotate,a)>>0)/100+"deg)":"")+(n.sepia||r.sepia?"sepia("+(100*X(n.sepia,r.sepia,a)>>0)/100+"%)":"")+(n.brightness||r.brightness?"brightness("+(100*X(n.brightness,r.brightness,a)>>0)/100+"%)":"")+(n.contrast||r.contrast?"contrast("+(100*X(n.contrast,r.contrast,a)>>0)/100+"%)":"")+(n.dropShadow||r.dropShadow?bt(n.dropShadow,r.dropShadow,a):"")})},crossCheck:function(t){if(this.valuesEnd[t])for(var e in this.valuesStart[t])this.valuesEnd[t][e]||(this.valuesEnd[t][e]=this.valuesStart[t][e])}},Tt={component:"filterEffects",property:"filter",defaultValue:{opacity:100,blur:0,saturate:100,grayscale:0,brightness:100,contrast:100,sepia:0,invert:0,hueRotate:0,dropShadow:[0,0,0,{r:0,g:0,b:0}],url:""},Interpolate:{opacity:X,blur:X,saturate:X,grayscale:X,brightness:X,contrast:X,sepia:X,invert:X,hueRotate:X,dropShadow:{numbers:X,colors:lt,dropShadow:bt}},functions:Mt,Util:{parseDropShadow:xt,parseFilterString:St,replaceDashNamespace:wt,trueColor:ot}};S.FilterEffects=Tt;var Ct={prepareStart:function(t){return I(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=(1e3*X(n,r,a)>>0)/1e3})}},Et={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:X},functions:Ct};function _t(t,e){return parseFloat(t)/100*e}function It(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function kt(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},a=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var i=0;i>0)/100,i=0-(100*X(e.s,n.s,r)>>0)/100,s=(100*X(e.e,n.e,r)>>0)/100+i;t.style.strokeDashoffset=i+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+a+"px"})}},jt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:X},functions:Ut,Util:{getRectLength:It,getPolyLength:kt,getLineLength:At,getCircleLength:Pt,getEllipseLength:Ot,getTotalLength:Lt,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:Vt,percent:_t}};function Ft(t){return t.map((function(t){return"string"==typeof t?t:t.shift()+t.join(" ")})).join("")}function Nt(t){return t.map((function(t){return Array.isArray(t)?Nt(t):isNaN(+t)?t:+t}))}S.SVGDraw=jt;var Rt=3;function Ht(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Rt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Dt(t){return this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var qt={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function Bt(t){var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;if("m"===n&&r.length>2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=qt[n]&&(t.segments.push([e].concat(r.splice(0,qt[n]))),qt[n]););}function Xt(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="Invalid path value")}function Yt(t){return t>=48&&t<=57}function Qt(t){var e,n=t.index,r=n,a=t.max,i=!1,s=!1,o=!1,l=!1;if(r>=a)t.err="Invalid path value";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r=48&&t<=57||43===t||45===t||46===t}function Wt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Kt(t){var e,n,r,a,i=t.max;if(t.segmentStart=t.index,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e=t.pathValue.charCodeAt(t.index)))if(r=qt[t.pathValue[t.index].toLowerCase()],t.index++,Wt(t),t.data=[],r){for(n=!1;;){for(a=r;a>0;a--){if(97!=(32|e)||3!==a&&4!==a?Qt(t):Xt(t),t.err.length)return;t.data.push(t.param),Wt(t),n=!1,t.index=t.max)break;if(!zt(t.pathValue.charCodeAt(t.index)))break}}Bt(t)}else Bt(t);else t.err="Invalid path value"}function Gt(t){if(Array.isArray(t)&&Array.isArray(t[0]))return Nt(t);var e=new Dt(t),n=e.max;for(Wt(e);e.indexr;r+=2){var i=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?a-4==r?i[3]={x:+t[0],y:+t[1]}:a-2==r&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[a-2],y:+t[a-1]}:a-4==r?i[3]=i[2]:r||(i[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return n}function Zt(t,e,n,r,a){var i;if(null==a&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=a){var s=Math.PI/180,o=t+n*Math.cos(-r*s),l=t+n*Math.cos(-a*s);i=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(a-r>180),0,l,e+n*Math.sin(-a*s)]]}else i=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return i}function Jt(t){if(!(t=Gt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,a=0,i=0,s=0,o=t.length,l=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],a=n,i=r,s++,e[0]=["M",n,r]);for(var u=function(s){var o=[],u=t[s],p=u[0],c=[];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=+u[6]+n,o[7]=+u[7]+r;break;case"V":o[1]=+u[1]+r;break;case"H":o[1]=+u[1]+n;break;case"R":for(var h=2,f=(c=[n,r].concat(u.slice(1))).length;h1&&(n*=w=Math.sqrt(w),r*=w);var x=n*n,S=r*r,M=(i==s?-1:1)*Math.sqrt(Math.abs((x*S-x*b*b-S*y*y)/(x*b*b+S*y*y)));f=M*n*b/r+(t+o)/2,d=M*-r*y/n+(e+l)/2,c=Math.asin(((e-d)/r).toFixed(9)),h=Math.asin(((l-d)/r).toFixed(9)),c=th&&(c-=2*Math.PI),!s&&h>c&&(h-=2*Math.PI)}var T=h-c;if(Math.abs(T)>v){var C=h,E=o,_=l;h=c+v*(s&&h>c?1:-1),o=f+n*Math.cos(h),l=d+r*Math.sin(h),m=ee(o,l,n,r,a,0,s,E,_,[h,C,f,d])}T=h-c;var I=Math.cos(c),k=Math.sin(c),A=Math.cos(h),P=Math.sin(h),O=Math.tan(T/4),L=4/3*n*O,V=4/3*r*O,U=[t,e],j=[t+L*k,e-V*I],F=[o+L*P,l-V*A],N=[o,l];return j[0]=2*U[0]-j[0],j[1]=2*U[1]-j[1],u?[j,F,N].concat(m):(m=[j,F,N].concat(m).join().split(",")).map((function(t,e){return e%2?te(m[e-1],t,g).y:te(t,m[e+1],g).x}))}function ne(t,e,n,r,a,i){var s=1/3,o=2/3;return[s*t+o*n,s*e+o*r,s*a+o*n,s*i+o*r,a,i]}function re(t,e,n,r){return[t,e,n,r,n,r]}function ae(t,e,n){var r,a;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in{T:1,Q:1})&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"].concat(ee.apply(0,[e.x,e.y].concat(t.slice(1))));break;case"S":"C"===n||"S"===n?(r=2*e.x-e.bx,a=2*e.y-e.by):(r=e.x,a=e.y),t=["C",r,a].concat(t.slice(1));break;case"T":"Q"===n||"T"===n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"].concat(ne(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"].concat(ne(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"].concat(re(e.x,e.y,t[1],t[2]));break;case"H":t=["C"].concat(re(e.x,e.y,t[1],e.y));break;case"V":t=["C"].concat(re(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"].concat(re(e.x,e.y,e.X,e.Y))}return t}function ie(t,e,n,r,a,i){t&&e&&"M"===t[a][0]&&"M"!==e[a][0]&&(e.splice(a,0,["M",r.x,r.y]),n.bx=0,n.by=0,n.x=t[a][1],n.y=t[a][2],Math.max(p.length,p2&&p2.length||0))}function se(t,e,n,r,a,i){if(t[a].length>7){t[a].shift();for(var s=t[a];s.length;)n[a]="A",e&&(r[a]="A"),t.splice(a++,0,["C"].concat(s.splice(0,6)));t.splice(a,1),Math.max(t.length,e&&e.length||0)}}function oe(t,e){for(var n=Jt(t),r=e&&Jt(e),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=[],o=[],l="",u="",p=(Math.max(n.length,r&&r.length||0),0);p=n&&(o-=r),t[o])}))}function ce(t){return t.map((function(e,n){return pe(t,n)}))}function he(t,e){var n=t.length-1,r=[],a=[],i=ce(t);return i.map((function(i,s){for(var o,l,u,p,c,h=0,f=ue("M0,0L0,0"),d=0;d>0)/1e3)}t.setAttribute("d",1===r?n.original:Ft(a))})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].curve,n=this.valuesEnd[t].curve;if(!e||!n||e&&n&&"M"===e[0][0]&&e.length!==n.length){var r=oe(this.valuesStart[t].original,this.valuesEnd[t].original),a=this._reverseFirstPath?le(r[0]):r[0],i=this._reverseSecondPath?le(r[1]):r[1];a=he.call(this,a,i),this.valuesStart[t].curve=a,this.valuesEnd[t].curve=i}}}},de={component:"svgCubicMorph",property:"path",defaultValue:[],Interpolate:{numbers:X,pathToString:Ft},functions:fe,Util:{pathToCurve:oe,pathToAbsolute:Jt,pathToString:Ft,parsePathString:Gt,getRotatedCurve:he,getRotations:ce,getRotationSegments:pe,reverseCurve:le,createPath:ue}};function ve(t,e){var n=e.x,r=e.width;return/[a-zA-Z]/.test(t)&&!/px/.test(t)?t.replace(/top|left/,0).replace(/right|bottom/,100).replace(/center|middle/,50):/%/.test(t)?n+parseFloat(t)*r/100:parseFloat(t)}function ge(t){var e=t&&/\)/.test(t)?t.substring(0,t.length-1).split(/\)\s|\)/):"none",n={};if(e instanceof Array)for(var r=0,a=e.length;r>0)/1e3+(s?","+(1e3*s>>0)/1e3:"")+")":"")+(u?"rotate("+(1e3*u>>0)/1e3+")":"")+(h?"skewX("+(1e3*h>>0)/1e3+")":"")+(f?"skewY("+(1e3*f>>0)/1e3+")":"")+(1!==l?"scale("+(1e3*l>>0)/1e3+")":""))})},crossCheck:function(t){if(this._resetStart&&this.valuesEnd[t]){var e=this.valuesStart[t],n=this.valuesEnd[t],r=me.call(this,t,ge(this.element.getAttribute("transform")));for(var a in r)e[a]=r[a];var i=this.element.ownerSVGElement,s=i.createSVGTransformFromMatrix(i.createSVGMatrix().translate(-e.origin[0],-e.origin[1]).translate("translate"in e?e.translate[0]:0,"translate"in e?e.translate[1]:0).rotate(e.rotate||0).skewX(e.skewX||0).skewY(e.skewY||0).scale(e.scale||1).translate(+e.origin[0],+e.origin[1]));for(var o in e.translate=[s.matrix.e,s.matrix.f],e)o in n&&"origin"!==o||(n[o]=e[o])}}},be={component:"svgTransformProperty",property:"svgTransform",defaultOptions:{transformOrigin:"50% 50%"},defaultValue:{translate:0,rotate:0,skewX:0,skewY:0,scale:1},Interpolate:{numbers:X},functions:ye,Util:{parseStringOrigin:ve,parseTransformString:ge,parseTransformSVG:me}};S.SVGTransformProperty=be;var we=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){}return t}(),xe="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],Se="ontouchstart"in window||navigator.msMaxTouchPoints||!1?"touchstart":"mousewheel",Me=navigator&&/(EDGE|Mac)/i.test(navigator.userAgent)?document.body:document.documentElement,Te=!!we&&{passive:!1};function Ce(t){this.scrolling&&t.preventDefault()}function Ee(){var t=this.element;return t===Me?{el:document,st:document.body}:{el:t,st:t}}function _e(t,e){e[t](xe[0],Ce,Te),e[t](Se,Ce,Te)}function Ie(){var t=Ee.call(this);"scroll"in this.valuesEnd&&!t.el.scrolling&&(t.el.scrolling=1,_e("addEventListener",t.el),t.st.style.pointerEvents="none")}function ke(){var t=Ee.call(this);"scroll"in this.valuesEnd&&t.el.scrolling&&(t.el.scrolling=0,_e("removeEventListener",t.el),t.st.style.pointerEvents="")}var Ae={prepareStart:function(){return this.element=!("scroll"in this.valuesEnd)||this.element&&this.element!==window?this.element:Me,this.element===Me?window.pageYOffset||Me.scrollTop:this.element.scrollTop},prepareProperty:function(t,e){return parseInt(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(this.element=!("scroll"in this.valuesEnd)||this.element&&this.element!==window?this.element:Me,Ie.call(this),t[e]=function(t,e,n,r){t.scrollTop=X(e,n,r)>>0})},onComplete:function(t){ke.call(this)}},Pe={component:"scrollProperty",property:"scroll",defaultValue:0,Interpolate:{numbers:X},functions:Ae,Util:{preventScroll:Ce,scrollIn:Ie,scrollOut:ke,getScrollTargets:Ee,toggleScrollEvents:_e,supportPassive:we}};function Oe(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){for(var i=[],s="textShadow"===e?3:4,o=3===s?n[3]:n[4],l=3===s?r[3]:r[4],u=!!(n[5]&&"none"!==n[5]||r[5]&&"none"!==r[5])&&" inset",p=0;p>0)/1e3+"px");t.style[e]=u?lt(o,l,a)+i.join(" ")+u:lt(o,l,a)+i.join(" ")})}S.ScrollProperty=Pe;var Le=["boxShadow","textShadow"];function Ve(t,e){var n,r;for(3===t.length?n=[t[0],t[1],0,0,t[2],"none"]:4===t.length?n=/inset|none/.test(t[3])?[t[0],t[1],0,0,t[2],t[3]]:[t[0],t[1],t[2],0,t[3],"none"]:5===t.length?n=/inset|none/.test(t[4])?[t[0],t[1],t[2],0,t[3],t[4]]:[t[0],t[1],t[2],t[3],t[4],"none"]:6===t.length&&(n=t),r=0;r<4;r++)n[r]=parseFloat(n[r]);return n[4]=ot(n[4]),n="boxShadow"===e?n:n.filter((function(t,e){return[0,1,2,4].indexOf(e)>-1}))}var Ue={};Le.map((function(t){return Ue[t]=Oe}));var je={component:"shadowProperties",properties:Le,defaultValues:{boxShadow:"0px 0px 0px 0px rgb(0,0,0)",textShadow:"0px 0px 0px rgb(0,0,0)"},Interpolate:{numbers:X,colors:lt},functions:{prepareStart:function(t,e){var n=I(this.element,t);return/^none$|^initial$|^inherit$|^inset$/.test(n)?f[t]:n},prepareProperty:function(t,e){if("string"==typeof e){var n,r="none";r=/inset/.test(e)?"inset":r,n=(e=/inset/.test(e)?e.replace(/(\s+inset|inset+\s)/g,""):e).match(/(\s?(?:#(?:[\da-f]{3}){1,2}|rgba?\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))\s?)/gi),e=Ve(e=e.replace(n[0],"").split(" ").concat([n[0].replace(/\s/g,"")],[r]),t)}else e instanceof Array&&(e=Ve(e,t));return e},onStart:Ue},Util:{processShadowArray:Ve,trueColor:ot}};function Fe(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=W(n.v,r.v,r.u,a)})}S.ShadowProperties=je;var Ne=["fontSize","lineHeight","letterSpacing","wordSpacing"],Re={};Ne.forEach((function(t){Re[t]=Fe}));var He={component:"textProperties",category:"textProperties",properties:Ne,defaultValues:{fontSize:0,lineHeight:0,letterSpacing:0,wordSpacing:0},Interpolate:{units:W},functions:{prepareStart:function(t){return I(this.element,t)||f[t]},prepareProperty:function(t,e){return Y(e)},onStart:Re},Util:{trueDimension:Y}};S.TextProperties=He;var De=String("abcdefghijklmnopqrstuvwxyz").split(""),qe=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),Be=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),Xe=String("0123456789").split(""),Ye=De.concat(qe,Xe),Qe=Ye.concat(Be),ze={alpha:De,upper:qe,symbols:Be,numeric:Xe,alphanumeric:Ye,all:Qe},We={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ze?ze[n]:n&&n.length?n:ze[d.textChars];t[e]=function(t,e,n,a){var i="",s="",o=e.substring(0),l=n.substring(0),u=r[Math.random()*r.length>>0];" "===e?(s=l.substring(Math.min(a*l.length,l.length)>>0,0),t.innerHTML=a<1?s+u:""===n?" ":n):" "===n?(i=o.substring(0,Math.min((1-a)*o.length,o.length)>>0),t.innerHTML=a<1?i+u:""===n?" ":n):(i=o.substring(o.length,Math.min(a*o.length,o.length)>>0),s=l.substring(0,Math.min(a*l.length,l.length)>>0),t.innerHTML=a<1?s+u+i:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=X(e,n,r)>>0})}};function Ke(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var a=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=a,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function Ge(t,e){var n=[];if(t.children.length){for(var r,a=[],i=t.innerHTML,s=0,o=t.children.length,l=void 0,u=void 0,p=void 0;s>0)/1e3;return r}S.TextWriteProperties=$e;var Je="undefined"!=typeof DOMMatrix?DOMMatrix:"undefined"!=typeof WebKitCSSMatrix?WebKitCSSMatrix:"undefined"!=typeof CSSMatrix?CSSMatrix:"undefined"!=typeof MSCSSMatrix?MSCSSMatrix:null;var tn={component:"transformMatrix",property:"transform",defaultValue:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,skew:[0,0],skewX:0,skewY:0,scale3d:[1,1,1],scaleX:1,scaleY:1,scaleZ:1},functions:{prepareStart:function(t,e){var n={};if(this.element.transformMatrix){var r=this.element.transformMatrix;for(var a in r)n[a]=r[a]}else for(var i in e)n[i]="perspective"===i?e[i]:f.transform[i];return n},prepareProperty:function(t,e){if("object"==typeof e&&!e.length){var n,r={},a={},i={},s={},o={},l=[{translate3d:a},{rotate3d:i},{skew:o},{scale3d:s}],u=function(t){if(/3d/.test(t)&&"object"==typeof e[t]&&e[t].length)n=e[t].map((function(e){return"scale3d"===t?parseFloat(e):parseInt(e)})),r[t]="scale3d"===t?[n[0]||1,n[1]||1,n[2]||1]:[n[0]||0,n[1]||0,n[2]||0];else if(/[XYZ]/.test(t)){(/translate/.test(t)?a:/rotate/.test(t)?i:/scale/.test(t)?s:/skew/.test(t)?o:{})[t.replace(/translate|rotate|scale|skew/,"").toLowerCase()]=/scale/.test(t)?parseFloat(e[t]):parseInt(e[t])}else"skew"===t?(n=e[t].map((function(t){return parseInt(t)||0})),r[t]=[n[0]||0,n[1]||0]):r[t]=parseInt(e[t])};for(var p in e)u(p);return l.map((function(t){var e=Object.keys(t)[0],n=t[e];Object.keys(n).length&&!r[e]&&(r[e]="scale3d"===e?[n.x||1,n.y||1,n.z||1]:"skew"===e?[n.x||0,n.y||0]:[n.x||0,n.y||0,n.z||0])})),r}console.error('KUTE.js - "'+e+'" is not valid/supported transform function')},onStart:{transform:function(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){var i=new Je,s={};for(var o in r)s[o]="perspective"===o?X(n[o],r[o],a):Ze(n[o],r[o],a);s.perspective&&(i.m34=-1/s.perspective),i=s.translate3d?i.translate(s.translate3d[0],s.translate3d[1],s.translate3d[2]):i,i=s.rotate3d?i.rotate(s.rotate3d[0],s.rotate3d[1],s.rotate3d[2]):i,s.skew&&(i=s.skew[0]?i.skewX(s.skew[0]):i,i=s.skew[1]?i.skewY(s.skew[1]):i),i=s.scale3d?i.scale(s.scale3d[0],s.scale3d[1],s.scale3d[2]):i,t.style[e]=i.toString()})},CSS3Matrix:function(e){this.valuesEnd.transform&&!t[e]&&(t[e]=Je)}},onComplete:function(t){if(this.valuesEnd[t])for(var e in this.element.transformMatrix={},this.valuesEnd[t])this.element.transformMatrix[e]=this.valuesEnd[t][e]},crossCheck:function(t){this.valuesEnd[t]&&this.valuesEnd[t].perspective&&!this.valuesStart[t].perspective&&(this.valuesStart[t].perspective=this.valuesEnd[t].perspective)}},Interpolate:{perspective:X,translate3d:Ze,rotate3d:Ze,skew:Ze,scale3d:Ze}};for(var en in S.TransformMatrix=tn,S){var nn=S[en];S[en]=new B(nn)}return{Animation:B,Components:S,TweenExtra:R,fromTo:function(t,e,n,r){return r=r||{},new L.tween(U(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new L.tween(U(t),e,e,n)},TweenCollection:H,ProgressBar:D,allFromTo:function(t,e,n,r){return r=r||{},new H(U(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new H(U(t,!0),e,e,n)},Objects:w,Util:x,Easing:V,CubicBezier:O,Render:u,Interpolate:r,Process:P,Internals:E,Selector:U,Version:"2.0.13"}})); diff --git a/demo/src/kute.min.js b/demo/src/kute.min.js index 437a1a4..97230a5 100644 --- a/demo/src/kute.min.js +++ b/demo/src/kute.min.js @@ -1,2 +1,2 @@ // KUTE.js Standard v2.0.13 | thednp © 2020 | MIT-License -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).KUTE=e()}(this,(function(){"use strict";var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},i={},a={};a.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ei?e=r:n=r,r=.5*(n-e)+e}return r};var P={},L={linear:new O(0,0,1,1,"linear"),easingSinusoidalIn:new O(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new O(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new O(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new O(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new O(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new O(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new O(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new O(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new O(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new O(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new O(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new O(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new O(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new O(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new O(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new O(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new O(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new O(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new O(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new O(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new O(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new O(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new O(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new O(.68,-.55,.265,1.55,"easingBackInOut")};function V(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function U(){for(var t in i)if("function"==typeof i[t])i[t].call(this,t);else for(var e in i[t])i[t][e].call(this,e);C.call(this)}P.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof L[t])return L[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new O(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),L.linear};var N=function(e,n,r,a){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,a=a||{},this._resetStart=a.resetStart||0,this._easing="function"==typeof a.easing?a.easing:P.processEasing(a.easing),this._duration=a.duration||f.duration,this._delay=a.delay||f.delay,a){var o="_"+s;o in this||(this[o]=a[s])}var u=this._easing.name;return i[u]||(i[u]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};N.prototype.start=function(e){return _(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),U.call(this),this._startFired=!0),!s&&o(),this},N.prototype.stop=function(){return this.playing&&(S(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},N.prototype.close=function(){for(var t in m)for(var e in m[t])m[t][e].call(this,e);this._startFired=!1,u.call(this)},N.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},N.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},N.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},P.tween=N,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var H=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],i=t[2];if(M.call(this,i,"end"),this._resetStart?this.valuesStart=r:M.call(this,r,"start"),!this._resetStart)for(var a in g)for(var s in g[a])g[a][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||f.repeat,this._repeatDelay=o.repeatDelay||f.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||f.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,A.call(this),g)for(var r in g[n])g[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var i in this.valuesEnd)this.valuesRepeat[i]=this.valuesStart[i];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),U.call(this),this._startTime+=t.Time()-this._pauseTime,_(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(S(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(N);P.tween=H;var j=function(t,e,n,r){var i=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var a=[];return Array.from(t).map((function(t,s){a[s]=r||{},a[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?i.tweens.push(new P.tween(t,e,n,a[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};j.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},j.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},j.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},j.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},j.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof j)e.chain(t.tweens);else{if(!(t instanceof P.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},j.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},j.prototype.removeTweens=function(){this.tweens=[]},j.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var F=function(t){try{t.component in c?console.error("KUTE.js - "+t.component+" already registered"):t.property in h?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};function R(t,e){for(var n,r=parseInt(t)||0,i=["px","%","deg","rad","em","rem","vh","vw"],a=0;a.99||i<.01?(10*D(n,r,i)>>0)/10:D(n,r,i)>>0)+"px"})}F.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:d,prepareStart:v,onStart:i,onComplete:m,crossCheck:g},a=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(c[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)h[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var u in t.defaultValues)h[u]=t.defaultValues[u];this.supports=(o||s)+" "+(s||a)+" properties"}if(t.defaultOptions)for(var l in t.defaultOptions)f[l]=t.defaultOptions[l];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][a||s]&&(n[p][e][a||s]=t.functions[p]);else for(var b in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][b]&&(n[p][e][b]=t.functions[p][b]);if(t.Interpolate){for(var x in t.Interpolate){var _=t.Interpolate[x];if("function"!=typeof _||r[x])for(var S in _)"function"!=typeof _[S]||r[x]||(r[x]=_[S]);else r[x]=_}y[e]=t.Interpolate}if(t.Util)for(var C in t.Util)!w[C]&&(w[C]=t.Util[C]);return this};var X=["top","left","width","height"],B={};X.map((function(t){return B[t]=Q}));var z={component:"essentialBoxModel",category:"boxModel",properties:X,defaultValues:{top:0,left:0,width:0,height:0},Interpolate:{numbers:D},functions:{prepareStart:function(t){return I(this.element,t)||h[t]},prepareProperty:function(t,e){var n=R(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:B},Util:{trueDimension:R}};function Z(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var i=document.getElementsByTagName("head")[0];i.style.color=t;var a=getComputedStyle(i,null).color;return a=/rgb/.test(a)?a.replace(/[^\d,]/g,"").split(","):[0,0,0],i.style.color="",{r:parseInt(a[0]),g:parseInt(a[1]),b:parseInt(a[2])}}}function Y(t,e,n){var r,i={};for(r in e)i[r]="a"!==r?D(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*D(t[r],e[r],n)>>0)/100:null;return i.a?"rgba("+i.r+","+i.g+","+i.b+","+i.a+")":"rgb("+i.r+","+i.g+","+i.b+")"}function q(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=Y(n,r,i)})}x.BoxModelEssential=z;var K=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],$={};K.map((function(t){$[t]="#000"}));var W={};K.map((function(t){return W[t]=q}));var G={component:"colorProperties",category:"colors",properties:K,defaultValues:$,Interpolate:{numbers:D,colors:Y},functions:{prepareStart:function(t,e){return I(this.element,t)||h[t]},prepareProperty:function(t,e){return Z(e)},onStart:W},Util:{trueColor:Z}};x.ColorProperties=G;var J={},tt=["fill","stroke","stop-color"];function et(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var nt={prepareStart:function(t,e){var n={};for(var r in e){var i=et(r).replace(/_+[a-z]+/,""),a=this.element.getAttribute(i);n[i]=tt.includes(i)?a||"rgba(0,0,0,0)":a||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var a=et(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(a.replace(/_+[a-z]+/,""));if(tt.includes(a))i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,Y(n,r,i))})},n[a]=Z(e[r])||h.htmlAttributes[r];else if(null!==o&&s.test(o)){var u=R(o).u||R(e[r]).u,l=/%/.test(u)?"_percent":"_"+u;i.htmlAttributes[a+l]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){var a=e.replace(l,"");t.setAttribute(a,(1e3*D(n.v,r.v,i)>>0)/1e3+r.u)})},n[a+l]=R(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,(1e3*D(n,r,i)>>0)/1e3)})},n[a]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,i){for(var a in r)t.attributes[a](e,a,n[a],r[a],i)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=J)}}},rt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:D,colors:Y},functions:nt,Util:{replaceUppercase:et,trueColor:Z,trueDimension:R}};x.HTMLAttributes=rt;var it={prepareStart:function(t){return I(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=(1e3*D(n,r,i)>>0)/1e3})}},at={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:D},functions:it};x.OpacityProperty=at;var st=String("abcdefghijklmnopqrstuvwxyz").split(""),ot=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),ut=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),lt=String("0123456789").split(""),pt=st.concat(ot,lt),ct=pt.concat(ut),ht={alpha:st,upper:ot,symbols:ut,numeric:lt,alphanumeric:pt,all:ct},ft={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ht?ht[n]:n&&n.length?n:ht[f.textChars];t[e]=function(t,e,n,i){var a="",s="",o=e.substring(0),u=n.substring(0),l=r[Math.random()*r.length>>0];" "===e?(s=u.substring(Math.min(i*u.length,u.length)>>0,0),t.innerHTML=i<1?s+l:""===n?" ":n):" "===n?(a=o.substring(0,Math.min((1-i)*o.length,o.length)>>0),t.innerHTML=i<1?a+l:""===n?" ":n):(a=o.substring(o.length,Math.min(i*o.length,o.length)>>0),s=u.substring(0,Math.min(i*u.length,u.length)>>0),t.innerHTML=i<1?s+l+a:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=D(e,n,r)>>0})}};function dt(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var i=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=i,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function vt(t,e){var n=[];if(t.children.length){for(var r,i=[],a=t.innerHTML,s=0,o=t.children.length,u=void 0,l=void 0,p=void 0;s>0)/1e3+n+")"}function yt(t,e,n,r){for(var i=[],a=0;a<3;a++)i[a]=(t[a]||e[a]?(1e3*(t[a]+(e[a]-t[a])*r)>>0)/1e3:0)+n;return"translate3d("+i.join(",")+")"}function bt(t,e,n,r){var i="";return i+=t[0]||e[0]?"rotateX("+(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3+n+")":"",i+=t[1]||e[1]?"rotateY("+(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3+n+")":"",i+=t[2]||e[2]?"rotateZ("+(1e3*(t[2]+(e[2]-t[2])*r)>>0)/1e3+n+")":""}function wt(t,e,n){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}function xt(t,e,n,r){var i=[];return i[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","skew("+i.join(",")+")"}x.TextWriteProperties=gt;var _t={component:"transformFunctions",property:"transform",subProperties:["perspective","translate3d","translateX","translateY","translateZ","translate","rotate3d","rotateX","rotateY","rotateZ","rotate","skewX","skewY","skew","scale"],defaultValues:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,translate:[0,0],rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,rotate:0,skewX:0,skewY:0,skew:[0,0],scale:1},functions:{prepareStart:function(t,e){var n=E(this.element);return n[t]?n[t]:h[t]},prepareProperty:function(t,e){var n=["X","Y","Z"],r={},i=[],a=[],s=[],o=["translate3d","translate","rotate3d","skew"];for(var u in e){var l="object"==typeof e[u]&&e[u].length?e[u].map((function(t){return parseInt(t)})):parseInt(e[u]);if(o.includes(u))r["translate"===u||"rotate"===u?u+"3d":u]="skew"===u?l.length?[l[0]||0,l[1]||0]:[l||0,0]:"translate"===u?l.length?[l[0]||0,l[1]||0,l[2]||0]:[l||0,0,0]:[l[0]||0,l[1]||0,l[2]||0];else if(/[XYZ]/.test(u)){for(var p=u.replace(/[XYZ]/,""),c="skew"===p?p:p+"3d",h="skew"===p?2:3,f="translate"===p?i:"rotate"===p?a:"skew"===p?s:{},d=0;d>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","translate("+i.join(",")+")"},rotate:function(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"},scale:wt,skew:xt}};function St(t,e){return parseFloat(t)/100*e}function Ct(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function Tt(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},i=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var a=0;a>0)/100,a=0-(100*D(e.s,n.s,r)>>0)/100,s=(100*D(e.e,n.e,r)>>0)/100+a;t.style.strokeDashoffset=a+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+i+"px"})}},Pt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:D},functions:Ot,Util:{getRectLength:Ct,getPolyLength:Tt,getLineLength:Et,getCircleLength:It,getEllipseLength:Mt,getTotalLength:At,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:kt,percent:St}};function Lt(t,e,n,r){for(var i=[],a=0;a>0)/1e3)}return i}x.SVGDraw=Pt;var Vt=3;function Ut(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Vt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Nt(t){return this.segments=[],this.isClosed=0,this.isAbsolute=0,this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var Ht={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function jt(t){return t>=48&&t<=57}function Ft(t){return t>=48&&t<=57||43===t||45===t||46===t}function Rt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Dt(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="SvgPath: arc flag can be 0 or 1 only (at pos "+t.index+")")}function Qt(t){var e,n=t.index,r=n,i=t.max,a=!1,s=!1,o=!1,u=!1;if(r>=i)t.err="SvgPath: missed param (at pos "+r+")";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=Ht[n]&&(t.segments.push([e].concat(r.splice(0,Ht[n]))),Ht[n]););}function Bt(t){var e,n,r,i,a,s=t.max;if(t.segmentStart=t.index,e=t.pathValue.charCodeAt(t.index),n=97==(32|e),function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e)){if(i=Ht[t.pathValue[t.index].toLowerCase()],t.index++,Rt(t),t.data=[],!i)return t.isClosed=1,void Xt(t);for(r=!1;;){for(a=i;a>0;a--){if(!n||3!==a&&4!==a?Qt(t):Dt(t),t.err.length)return;t.data.push(t.param),Rt(t),r=!1,t.index=t.max)break;if(!Ft(t.pathValue.charCodeAt(t.index)))break}}Xt(t)}else t.err="SvgPath: bad command "+t.pathValue[t.index]+" (at pos "+t.index+")"}function zt(t){if(Array.isArray(t))return function t(e){return e.map((function(e){return Array.isArray(e)?t(e):isNaN(+e)?e:+e}))}(t);var e=new Nt(t),n=e.max;for(Rt(e);e.indexr;r+=2){var a=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4==r?a[3]={x:+t[0],y:+t[1]}:i-2==r&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[i-2],y:+t[i-1]}:i-4==r?a[3]=a[2]:r||(a[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return n}function Yt(t,e,n,r,i){var a;if(null==i&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=i){var s=Math.PI/180,o=t+n*Math.cos(-r*s),u=t+n*Math.cos(-i*s);a=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(i-r>180),0,u,e+n*Math.sin(-i*s)]]}else a=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return a}function qt(t){if(!(t=zt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,i=0,a=0,s=0,o=t.length,u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],i=n,a=r,s++,e[0]=["M",n,r]);for(var l=function(s){var o=void 0,l=t[s],p=l[0];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=+l[6]+n,o[7]=+l[7]+r;break;case"V":o[1]=+l[1]+r;break;case"H":o[1]=+l[1]+n;break;case"R":for(var c=[n,r].concat(l.slice(1)),h=2,f=c.length;h0&&(o=Math.max(o,Math.ceil(n/e)));for(var u=0;ue;)i=Gt(r,i,.5),t.splice(n+1,0,i)}function le(t,e){var n,r;if("string"==typeof t){var i=te(t,e);t=i.ring,r=i.skipBisect}else if(!Array.isArray(t))throw new TypeError("Invalid path value");if(!pe(n=t.slice(0)))throw new TypeError("Invalid path value");return n.length>1&&Jt(n[0],n[n.length-1])&&n.pop(),se(n)>0&&n.reverse(),!r&&e&&$t(e)&&e>0&&ue(n,e),n}function pe(t){return t.every((function(t){return Array.isArray(t)&&t.length>=2&&$t(t[0])&&$t(t[1])}))}function ce(t,e,n){var r=le(t,n=n||f.morphPrecision),i=le(e,n),a=r.length-i.length;return oe(r,a<0?-1*a:0),oe(i,a>0?a:0),ie(r,i),[r,i]}var he={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof Element?e:/^\.|^\#/.test(e)?V(e):null,i=new RegExp("\\n","ig");return"object"==typeof e&&e.pathArray?e:(r&&/path|glyph/.test(r.tagName)?n.original=r.getAttribute("d").replace(i,""):!r&&/[a-z][^a-z]*/gi.test(e)&&(n.original=e.replace(i,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var i=e.pathArray,a=n.pathArray,s=a.length;t.setAttribute("d",1===r?n.original:"M"+Lt(i,a,s,r).join("L")+"Z")})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].pathArray,n=this.valuesEnd[t].pathArray;if(!e||!n||e&&n&&e.length!==n.length){var r=ce(this.valuesStart[t].original,this.valuesEnd[t].original,this._morphPrecision?parseInt(this._morphPrecision):f.morphPrecision);this.valuesStart[t].pathArray=r[0],this.valuesEnd[t].pathArray=r[1]}}}},fe={component:"svgMorph",property:"path",defaultValue:[],Interpolate:Lt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:he,Util:{INVALID_INPUT:"Invalid path value",isFiniteNumber:$t,distance:Wt,pointAlong:Gt,samePoint:Jt,pathToAbsolute:qt,pathToString:Kt,pathStringToRing:te,exactRing:ee,approximateRing:ne,measure:re,rotateRing:ie,polygonLength:ae,polygonArea:se,addPoints:oe,bisect:ue,normalizeRing:le,validRing:pe,getInterpolationPoints:ce}};for(var de in x.SVGMorph=fe,x){var ve=x[de];x[de]=new F(ve)}return{Animation:F,Components:x,Tween:H,fromTo:function(t,e,n,r){return r=r||{},new P.tween(V(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new P.tween(V(t),e,e,n)},TweenCollection:j,allFromTo:function(t,e,n,r){return r=r||{},new j(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new j(V(t,!0),e,e,n)},Objects:b,Util:w,Easing:L,CubicBezier:O,Render:l,Interpolate:r,Process:k,Internals:T,Selector:V,Version:"2.0.13"}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).KUTE=e()}(this,(function(){"use strict";var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},i={},a={};a.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ei?e=r:n=r,r=.5*(n-e)+e}return r};var L={},P={linear:new O(0,0,1,1,"linear"),easingSinusoidalIn:new O(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new O(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new O(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new O(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new O(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new O(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new O(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new O(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new O(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new O(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new O(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new O(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new O(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new O(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new O(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new O(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new O(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new O(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new O(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new O(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new O(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new O(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new O(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new O(.68,-.55,.265,1.55,"easingBackInOut")};function V(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function U(){for(var t in i)if("function"==typeof i[t])i[t].call(this,t);else for(var e in i[t])i[t][e].call(this,e);C.call(this)}L.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof P[t])return P[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new O(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),P.linear};var N=function(e,n,r,a){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,a=a||{},this._resetStart=a.resetStart||0,this._easing="function"==typeof a.easing?a.easing:L.processEasing(a.easing),this._duration=a.duration||f.duration,this._delay=a.delay||f.delay,a){var o="_"+s;o in this||(this[o]=a[s])}var u=this._easing.name;return i[u]||(i[u]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};N.prototype.start=function(e){return _(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),U.call(this),this._startFired=!0),!s&&o(),this},N.prototype.stop=function(){return this.playing&&(T(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},N.prototype.close=function(){for(var t in y)for(var e in y[t])y[t][e].call(this,e);this._startFired=!1,u.call(this)},N.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},N.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},N.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},L.tween=N,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var H=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],i=t[2];if(A.call(this,i,"end"),this._resetStart?this.valuesStart=r:A.call(this,r,"start"),!this._resetStart)for(var a in g)for(var s in g[a])g[a][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||f.repeat,this._repeatDelay=o.repeatDelay||f.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||f.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,M.call(this),g)for(var r in g[n])g[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var i in this.valuesEnd)this.valuesRepeat[i]=this.valuesStart[i];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),U.call(this),this._startTime+=t.Time()-this._pauseTime,_(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(T(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(N);L.tween=H;var j=function(t,e,n,r){var i=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var a=[];return Array.from(t).map((function(t,s){a[s]=r||{},a[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?i.tweens.push(new L.tween(t,e,n,a[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};j.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},j.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},j.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},j.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},j.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof j)e.chain(t.tweens);else{if(!(t instanceof L.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},j.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},j.prototype.removeTweens=function(){this.tweens=[]},j.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var F=function(t){try{t.component in c?console.error("KUTE.js - "+t.component+" already registered"):t.property in h?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};function R(t,e){for(var n,r=parseInt(t)||0,i=["px","%","deg","rad","em","rem","vh","vw"],a=0;a.99||i<.01?(10*D(n,r,i)>>0)/10:D(n,r,i)>>0)+"px"})}F.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:v,prepareStart:d,onStart:i,onComplete:y,crossCheck:g},a=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(c[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)h[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var u in t.defaultValues)h[u]=t.defaultValues[u];this.supports=(o||s)+" "+(s||a)+" properties"}if(t.defaultOptions)for(var l in t.defaultOptions)f[l]=t.defaultOptions[l];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][a||s]&&(n[p][e][a||s]=t.functions[p]);else for(var b in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][b]&&(n[p][e][b]=t.functions[p][b]);if(t.Interpolate){for(var x in t.Interpolate){var _=t.Interpolate[x];if("function"!=typeof _||r[x])for(var T in _)"function"!=typeof _[T]||r[x]||(r[x]=_[T]);else r[x]=_}m[e]=t.Interpolate}if(t.Util)for(var C in t.Util)!w[C]&&(w[C]=t.Util[C]);return this};var X=["top","left","width","height"],B={};X.map((function(t){return B[t]=Q}));var z={component:"essentialBoxModel",category:"boxModel",properties:X,defaultValues:{top:0,left:0,width:0,height:0},Interpolate:{numbers:D},functions:{prepareStart:function(t){return E(this.element,t)||h[t]},prepareProperty:function(t,e){var n=R(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:B},Util:{trueDimension:R}};function Z(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var i=document.getElementsByTagName("head")[0];i.style.color=t;var a=getComputedStyle(i,null).color;return a=/rgb/.test(a)?a.replace(/[^\d,]/g,"").split(","):[0,0,0],i.style.color="",{r:parseInt(a[0]),g:parseInt(a[1]),b:parseInt(a[2])}}}function Y(t,e,n){var r,i={};for(r in e)i[r]="a"!==r?D(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*D(t[r],e[r],n)>>0)/100:null;return i.a?"rgba("+i.r+","+i.g+","+i.b+","+i.a+")":"rgb("+i.r+","+i.g+","+i.b+")"}function q(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=Y(n,r,i)})}x.BoxModelEssential=z;var K=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],$={};K.map((function(t){$[t]="#000"}));var W={};K.map((function(t){return W[t]=q}));var G={component:"colorProperties",category:"colors",properties:K,defaultValues:$,Interpolate:{numbers:D,colors:Y},functions:{prepareStart:function(t,e){return E(this.element,t)||h[t]},prepareProperty:function(t,e){return Z(e)},onStart:W},Util:{trueColor:Z}};x.ColorProperties=G;var J={},tt=["fill","stroke","stop-color"];function et(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var nt={prepareStart:function(t,e){var n={};for(var r in e){var i=et(r).replace(/_+[a-z]+/,""),a=this.element.getAttribute(i);n[i]=tt.includes(i)?a||"rgba(0,0,0,0)":a||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var a=et(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(a.replace(/_+[a-z]+/,""));if(tt.includes(a))i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,Y(n,r,i))})},n[a]=Z(e[r])||h.htmlAttributes[r];else if(null!==o&&s.test(o)){var u=R(o).u||R(e[r]).u,l=/%/.test(u)?"_percent":"_"+u;i.htmlAttributes[a+l]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){var a=e.replace(l,"");t.setAttribute(a,(1e3*D(n.v,r.v,i)>>0)/1e3+r.u)})},n[a+l]=R(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,(1e3*D(n,r,i)>>0)/1e3)})},n[a]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,i){for(var a in r)t.attributes[a](e,a,n[a],r[a],i)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=J)}}},rt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:D,colors:Y},functions:nt,Util:{replaceUppercase:et,trueColor:Z,trueDimension:R}};x.HTMLAttributes=rt;var it={prepareStart:function(t){return E(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=(1e3*D(n,r,i)>>0)/1e3})}},at={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:D},functions:it};x.OpacityProperty=at;var st=String("abcdefghijklmnopqrstuvwxyz").split(""),ot=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),ut=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),lt=String("0123456789").split(""),pt=st.concat(ot,lt),ct=pt.concat(ut),ht={alpha:st,upper:ot,symbols:ut,numeric:lt,alphanumeric:pt,all:ct},ft={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ht?ht[n]:n&&n.length?n:ht[f.textChars];t[e]=function(t,e,n,i){var a="",s="",o=e.substring(0),u=n.substring(0),l=r[Math.random()*r.length>>0];" "===e?(s=u.substring(Math.min(i*u.length,u.length)>>0,0),t.innerHTML=i<1?s+l:""===n?" ":n):" "===n?(a=o.substring(0,Math.min((1-i)*o.length,o.length)>>0),t.innerHTML=i<1?a+l:""===n?" ":n):(a=o.substring(o.length,Math.min(i*o.length,o.length)>>0),s=u.substring(0,Math.min(i*u.length,u.length)>>0),t.innerHTML=i<1?s+l+a:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=D(e,n,r)>>0})}};function vt(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var i=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=i,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function dt(t,e){var n=[];if(t.children.length){for(var r,i=[],a=t.innerHTML,s=0,o=t.children.length,u=void 0,l=void 0,p=void 0;s>0)/1e3+n+")"}function mt(t,e,n,r){for(var i=[],a=0;a<3;a++)i[a]=(t[a]||e[a]?(1e3*(t[a]+(e[a]-t[a])*r)>>0)/1e3:0)+n;return"translate3d("+i.join(",")+")"}function bt(t,e,n,r){var i="";return i+=t[0]||e[0]?"rotateX("+(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3+n+")":"",i+=t[1]||e[1]?"rotateY("+(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3+n+")":"",i+=t[2]||e[2]?"rotateZ("+(1e3*(t[2]+(e[2]-t[2])*r)>>0)/1e3+n+")":""}function wt(t,e,n){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}function xt(t,e,n,r){var i=[];return i[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","skew("+i.join(",")+")"}x.TextWriteProperties=gt;var _t={component:"transformFunctions",property:"transform",subProperties:["perspective","translate3d","translateX","translateY","translateZ","translate","rotate3d","rotateX","rotateY","rotateZ","rotate","skewX","skewY","skew","scale"],defaultValues:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,translate:[0,0],rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,rotate:0,skewX:0,skewY:0,skew:[0,0],scale:1},functions:{prepareStart:function(t,e){var n=S(this.element);return n[t]?n[t]:h[t]},prepareProperty:function(t,e){var n=["X","Y","Z"],r={},i=[],a=[],s=[],o=["translate3d","translate","rotate3d","skew"];for(var u in e){var l="object"==typeof e[u]&&e[u].length?e[u].map((function(t){return parseInt(t)})):parseInt(e[u]);if(o.includes(u))r["translate"===u||"rotate"===u?u+"3d":u]="skew"===u?l.length?[l[0]||0,l[1]||0]:[l||0,0]:"translate"===u?l.length?[l[0]||0,l[1]||0,l[2]||0]:[l||0,0,0]:[l[0]||0,l[1]||0,l[2]||0];else if(/[XYZ]/.test(u)){for(var p=u.replace(/[XYZ]/,""),c="skew"===p?p:p+"3d",h="skew"===p?2:3,f="translate"===p?i:"rotate"===p?a:"skew"===p?s:{},v=0;v>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","translate("+i.join(",")+")"},rotate:function(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"},scale:wt,skew:xt}};function Tt(t,e){return parseFloat(t)/100*e}function Ct(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function It(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},i=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var a=0;a>0)/100,a=0-(100*D(e.s,n.s,r)>>0)/100,s=(100*D(e.e,n.e,r)>>0)/100+a;t.style.strokeDashoffset=a+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+i+"px"})}},Lt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:D},functions:Ot,Util:{getRectLength:Ct,getPolyLength:It,getLineLength:St,getCircleLength:Et,getEllipseLength:At,getTotalLength:Mt,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:kt,percent:Tt}};function Pt(t,e,n,r){for(var i=[],a=0;a>0)/1e3)}return i}x.SVGDraw=Lt;var Vt=3;function Ut(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Vt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Nt(t){return this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var Ht={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function jt(t){var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;if("m"===n&&r.length>2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=Ht[n]&&(t.segments.push([e].concat(r.splice(0,Ht[n]))),Ht[n]););}function Ft(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="Invalid path value")}function Rt(t){return t>=48&&t<=57}function Dt(t){var e,n=t.index,r=n,i=t.max,a=!1,s=!1,o=!1,u=!1;if(r>=i)t.err="Invalid path value";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r=48&&t<=57||43===t||45===t||46===t}function Xt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Bt(t){var e,n,r,i,a=t.max;if(t.segmentStart=t.index,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e=t.pathValue.charCodeAt(t.index)))if(r=Ht[t.pathValue[t.index].toLowerCase()],t.index++,Xt(t),t.data=[],r){for(n=!1;;){for(i=r;i>0;i--){if(97!=(32|e)||3!==i&&4!==i?Dt(t):Ft(t),t.err.length)return;t.data.push(t.param),Xt(t),n=!1,t.index=t.max)break;if(!Qt(t.pathValue.charCodeAt(t.index)))break}}jt(t)}else jt(t);else t.err="Invalid path value"}function zt(t){if(Array.isArray(t)&&Array.isArray(t[0]))return function t(e){return e.map((function(e){return Array.isArray(e)?t(e):isNaN(+e)?e:+e}))}(t);var e=new Nt(t),n=e.max;for(Xt(e);e.indexr;r+=2){var a=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4==r?a[3]={x:+t[0],y:+t[1]}:i-2==r&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[i-2],y:+t[i-1]}:i-4==r?a[3]=a[2]:r||(a[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return n}function Yt(t,e,n,r,i){var a;if(null==i&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=i){var s=Math.PI/180,o=t+n*Math.cos(-r*s),u=t+n*Math.cos(-i*s);a=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(i-r>180),0,u,e+n*Math.sin(-i*s)]]}else a=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return a}function qt(t){if(!(t=zt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,i=0,a=0,s=0,o=t.length,u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],i=n,a=r,s++,e[0]=["M",n,r]);for(var l=function(s){var o=[],l=t[s],p=l[0],c=[];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=+l[6]+n,o[7]=+l[7]+r;break;case"V":o[1]=+l[1]+r;break;case"H":o[1]=+l[1]+n;break;case"R":for(var h=2,f=(c=[n,r].concat(l.slice(1))).length;h0&&(o=Math.max(o,Math.ceil(n/e)));for(var u=0;ue;)i=Gt(r,i,.5),t.splice(n+1,0,i)}function le(t,e){var n,r;if("string"==typeof t){var i=te(t,e);t=i.ring,r=i.skipBisect}else if(!Array.isArray(t))throw new TypeError("Invalid path value");if(!pe(n=t.slice(0)))throw new TypeError("Invalid path value");return n.length>1&&Jt(n[0],n[n.length-1])&&n.pop(),se(n)>0&&n.reverse(),!r&&e&&$t(e)&&e>0&&ue(n,e),n}function pe(t){return t.every((function(t){return Array.isArray(t)&&t.length>=2&&$t(t[0])&&$t(t[1])}))}function ce(t,e,n){var r=le(t,n=n||f.morphPrecision),i=le(e,n),a=r.length-i.length;return oe(r,a<0?-1*a:0),oe(i,a>0?a:0),ie(r,i),[r,i]}var he={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof Element?e:/^\.|^\#/.test(e)?V(e):null,i=new RegExp("\\n","ig");return"object"==typeof e&&e.pathArray?e:(r&&/path|glyph/.test(r.tagName)?n.original=r.getAttribute("d").replace(i,""):!r&&/[a-z][^a-z]*/gi.test(e)&&(n.original=e.replace(i,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var i=e.pathArray,a=n.pathArray,s=a.length;t.setAttribute("d",1===r?n.original:"M"+Pt(i,a,s,r).join("L")+"Z")})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].pathArray,n=this.valuesEnd[t].pathArray;if(!e||!n||e&&n&&e.length!==n.length){var r=ce(this.valuesStart[t].original,this.valuesEnd[t].original,this._morphPrecision?parseInt(this._morphPrecision):f.morphPrecision);this.valuesStart[t].pathArray=r[0],this.valuesEnd[t].pathArray=r[1]}}}},fe={component:"svgMorph",property:"path",defaultValue:[],Interpolate:Pt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:he,Util:{INVALID_INPUT:"Invalid path value",isFiniteNumber:$t,distance:Wt,pointAlong:Gt,samePoint:Jt,pathToAbsolute:qt,pathToString:Kt,pathStringToRing:te,exactRing:ee,approximateRing:ne,measure:re,rotateRing:ie,polygonLength:ae,polygonArea:se,addPoints:oe,bisect:ue,normalizeRing:le,validRing:pe,getInterpolationPoints:ce}};for(var ve in x.SVGMorph=fe,x){var de=x[ve];x[ve]=new F(de)}return{Animation:F,Components:x,Tween:H,fromTo:function(t,e,n,r){return r=r||{},new L.tween(V(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new L.tween(V(t),e,e,n)},TweenCollection:j,allFromTo:function(t,e,n,r){return r=r||{},new j(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new j(V(t,!0),e,e,n)},Objects:b,Util:w,Easing:P,CubicBezier:O,Render:l,Interpolate:r,Process:k,Internals:I,Selector:V,Version:"2.0.13"}})); diff --git a/demo/svgMorph.html b/demo/svgMorph.html index af61087..bd35328 100644 --- a/demo/svgMorph.html +++ b/demo/svgMorph.html @@ -382,7 +382,5 @@ var tween2 = KUTE.to('#triangle', { path: '#square' }).start(); - - diff --git a/dist/kute.esm.js b/dist/kute.esm.js index 0d2bcdd..b9a9d59 100644 --- a/dist/kute.esm.js +++ b/dist/kute.esm.js @@ -738,14 +738,14 @@ Animation.prototype.setComponent = function setComponent (Component){ } } if (Component.Interpolate) { - for (var fn$1 in Component.Interpolate) { - var compIntObj = Component.Interpolate[fn$1]; - if ( typeof(compIntObj) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj; + for (var fni in Component.Interpolate) { + var compIntObj = Component.Interpolate[fni]; + if ( typeof(compIntObj) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj; } else { for ( var sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj[sfn]; + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj[sfn]; } } } @@ -753,8 +753,8 @@ Animation.prototype.setComponent = function setComponent (Component){ linkProperty[ComponentName] = Component.Interpolate; } if (Component.Util) { - for (var fn$2 in Component.Util){ - !Util[fn$2] && (Util[fn$2] = Component.Util[fn$2]); + for (var fnu in Component.Util){ + !Util[fnu] && (Util[fnu] = Component.Util[fnu]); } } return propertyInfo @@ -1461,23 +1461,21 @@ function clonePath(pathArray){ return pathArray.map(function (x) { return Array.isArray(x) ? clonePath(x) : !isNaN(+x) ? +x : x; } ) } -var SVGPCOps = { +var SVGPathCommanderOptions = { decimals:3, round:1 }; function roundPath(pathArray) { - return pathArray.map( function (seg) { return seg.map(function (c,i) { - var nr = +c, dc = Math.pow(10,SVGPCOps.decimals); - return i ? (nr % 1 === 0 ? nr : (nr*dc>>0)/dc) : c - } - ); }) + return pathArray.map( function (seg) { return seg.map(function (c,i) { + var nr = +c, dc = Math.pow(10,SVGPathCommanderOptions.decimals); + return i ? (nr % 1 === 0 ? nr : (nr*dc>>0)/dc) : c + } + ); }) } function SVGPathArray(pathString){ this.segments = []; - this.isClosed = 0; - this.isAbsolute = 0; this.pathValue = pathString; this.max = pathString.length; this.index = 0; @@ -1489,48 +1487,29 @@ function SVGPathArray(pathString){ } var paramCounts = { a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0 }; -function isSpace(ch) { - var specialSpaces = [ - 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, - 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF ]; - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029) || - (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && specialSpaces.indexOf(ch) >= 0); -} -function isCommand(code) { - switch (code | 0x20) { - case 0x6D: - case 0x7A: - case 0x6C: - case 0x68: - case 0x76: - case 0x63: - case 0x73: - case 0x71: - case 0x74: - case 0x61: - case 0x72: - return true; + +function finalizeSegment(state) { + var cmd = state.pathValue[state.segmentStart], cmdLC = cmd.toLowerCase(), params = state.data; + if (cmdLC === 'm' && params.length > 2) { + state.segments.push([ cmd, params[0], params[1] ]); + params = params.slice(2); + cmdLC = 'l'; + cmd = (cmd === 'm') ? 'l' : 'L'; } - return false; -} -function isArc(code) { - return (code | 0x20) === 0x61; -} -function isDigit(code) { - return (code >= 48 && code <= 57); -} -function isDigitStart(code) { - return (code >= 48 && code <= 57) || - code === 0x2B || - code === 0x2D || - code === 0x2E; -} -function skipSpaces(state) { - while (state.index < state.max && isSpace(state.pathValue.charCodeAt(state.index))) { - state.index++; + if (cmdLC === 'r') { + state.segments.push([ cmd ].concat(params)); + } else { + while (params.length >= paramCounts[cmdLC]) { + state.segments.push([ cmd ].concat(params.splice(0, paramCounts[cmdLC]))); + if (!paramCounts[cmdLC]) { + break; + } + } } } + +var invalidPathValue = 'Invalid path value'; + function scanFlag(state) { var ch = state.pathValue.charCodeAt(state.index); if (ch === 0x30) { @@ -1543,8 +1522,13 @@ function scanFlag(state) { state.index++; return; } - state.err = 'SvgPath: arc flag can be 0 or 1 only (at pos ' + state.index + ')'; + state.err = invalidPathValue; } + +function isDigit(code) { + return (code >= 48 && code <= 57); +} + function scanParam(state) { var start = state.index, index = start, @@ -1555,7 +1539,7 @@ function scanParam(state) { hasDot = false, ch; if (index >= max) { - state.err = 'SvgPath: missed param (at pos ' + index + ')'; + state.err = invalidPathValue; return; } ch = state.pathValue.charCodeAt(index); @@ -1564,7 +1548,7 @@ function scanParam(state) { ch = (index < max) ? state.pathValue.charCodeAt(index) : 0; } if (!isDigit(ch) && ch !== 0x2E) { - state.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')'; + state.err = invalidPathValue; return; } if (ch !== 0x2E) { @@ -1573,7 +1557,7 @@ function scanParam(state) { ch = (index < max) ? state.pathValue.charCodeAt(index) : 0; if (zeroFirst && index < max) { if (ch && isDigit(ch)) { - state.err = 'SvgPath: numbers started with `0` such as `09` are illegal (at pos ' + start + ')'; + state.err = invalidPathValue; return; } } @@ -1594,7 +1578,7 @@ function scanParam(state) { } if (ch === 0x65 || ch === 0x45) { if (hasDot && !hasCeiling && !hasDecimal) { - state.err = 'SvgPath: invalid float exponent (at pos ' + index + ')'; + state.err = invalidPathValue; return; } index++; @@ -1607,39 +1591,64 @@ function scanParam(state) { index++; } } else { - state.err = 'SvgPath: invalid float exponent (at pos ' + index + ')'; + state.err = invalidPathValue; return; } } state.index = index; - state.param = parseFloat(state.pathValue.slice(start, index)) + 0.0; + state.param = +state.pathValue.slice(start, index); } -function finalizeSegment(state) { - var cmd = state.pathValue[state.segmentStart], cmdLC = cmd.toLowerCase(), params = state.data; - if (cmdLC === 'm' && params.length > 2) { - state.segments.push([ cmd, params[0], params[1] ]); - params = params.slice(2); - cmdLC = 'l'; - cmd = (cmd === 'm') ? 'l' : 'L'; + +function isCommand(code) { + switch (code | 0x20) { + case 0x6D: + case 0x7A: + case 0x6C: + case 0x68: + case 0x76: + case 0x63: + case 0x73: + case 0x71: + case 0x74: + case 0x61: + case 0x72: + return true; } - if (cmdLC === 'r') { - state.segments.push([ cmd ].concat(params)); - } else { - while (params.length >= paramCounts[cmdLC]) { - state.segments.push([ cmd ].concat(params.splice(0, paramCounts[cmdLC]))); - if (!paramCounts[cmdLC]) { - break; - } - } + return false; +} + +function isDigitStart(code) { + return (code >= 48 && code <= 57) || + code === 0x2B || + code === 0x2D || + code === 0x2E; +} + +function isArc(code) { + return (code | 0x20) === 0x61; +} + +function isSpace(ch) { + var specialSpaces = [ + 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, + 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF ]; + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029) || + (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && specialSpaces.indexOf(ch) >= 0); +} + +function skipSpaces(state) { + while (state.index < state.max && isSpace(state.pathValue.charCodeAt(state.index))) { + state.index++; } } + function scanSegment(state) { - var max = state.max, cmdCode, is_arc, comma_found, need_params, i; + var max = state.max, cmdCode, comma_found, need_params, i; state.segmentStart = state.index; cmdCode = state.pathValue.charCodeAt(state.index); - is_arc = isArc(cmdCode); if (!isCommand(cmdCode)) { - state.err = 'SvgPath: bad command ' + state.pathValue[state.index] + ' (at pos ' + state.index + ')'; + state.err = invalidPathValue; return; } need_params = paramCounts[state.pathValue[state.index].toLowerCase()]; @@ -1647,14 +1656,13 @@ function scanSegment(state) { skipSpaces(state); state.data = []; if (!need_params) { - state.isClosed = 1; finalizeSegment(state); return; } comma_found = false; for (;;) { for (i = need_params; i > 0; i--) { - if (is_arc && (i === 3 || i === 4)) { scanFlag(state); } + if (isArc(cmdCode) && (i === 3 || i === 4)) { scanFlag(state); } else { scanParam(state); } if (state.err.length) { return; @@ -1680,8 +1688,9 @@ function scanSegment(state) { } finalizeSegment(state); } + function parsePathString(pathString) { - if ( Array.isArray(pathString) ) { + if ( Array.isArray(pathString) && Array.isArray(pathString[0])) { return clonePath(pathString) } var state = new SVGPathArray(pathString), max = state.max; @@ -1693,7 +1702,7 @@ function parsePathString(pathString) { state.segments = []; } else if (state.segments.length) { if ('mM'.indexOf(state.segments[0][0]) < 0) { - state.err = 'SvgPath: string should start with `M` or `m`'; + state.err = invalidPathValue; state.segments = []; } else { state.segments[0][0] = 'M'; @@ -1773,8 +1782,9 @@ function pathToAbsolute(pathArray) { if (!pathArray || !pathArray.length) { return [["M", 0, 0]]; } - var res = [], x = 0, y = 0, mx = 0, my = 0, start = 0, - ii = pathArray.length, + var resultArray = [], + x = 0, y = 0, mx = 0, my = 0, + start = 0, ii = pathArray.length, crz = pathArray.length === 3 && pathArray[0][0] === "M" && pathArray[1][0].toUpperCase() === "R" && @@ -1785,11 +1795,11 @@ function pathToAbsolute(pathArray) { mx = x; my = y; start++; - res[0] = ["M", x, y]; + resultArray[0] = ["M", x, y]; } var loop = function ( i ) { - var r = (void 0), pa = pathArray[i], pa0 = pa[0]; - res.push(r = []); + var r = [], pa = pathArray[i], pa0 = pa[0], dots = []; + resultArray.push(r = []); if (pa0 !== pa0.toUpperCase()) { r[0] = pa0.toUpperCase(); switch (r[0]) { @@ -1809,47 +1819,47 @@ function pathToAbsolute(pathArray) { r[1] = +pa[1] + x; break; case "R": - var dots$1 = [x, y].concat(pa.slice(1)); - for (var j = 2, jj = dots$1.length; j < jj; j++) { - dots$1[j] = +dots$1[j] + x; - dots$1[++j] = +dots$1[j] + y; + dots = [x, y].concat(pa.slice(1)); + for (var j = 2, jj = dots.length; j < jj; j++) { + dots[j] = +dots[j] + x; + dots[++j] = +dots[j] + y; } - res.pop(); - res = res.concat(catmullRom2bezier(dots$1, crz)); + resultArray.pop(); + resultArray = resultArray.concat(catmullRom2bezier(dots, crz)); break; case "O": - res.pop(); - dots$1 = ellipsePath(x, y, +pa[1], +pa[2]); - dots$1.push(dots$1[0]); - res = res.concat(dots$1); + resultArray.pop(); + dots = ellipsePath(x, y, +pa[1], +pa[2]); + dots.push(dots[0]); + resultArray = resultArray.concat(dots); break; case "U": - res.pop(); - res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); - r = ["U"].concat(res[res.length - 1].slice(-2)); + resultArray.pop(); + resultArray = resultArray.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); + r = ["U"].concat(resultArray[resultArray.length - 1].slice(-2)); break; case "M": mx = +pa[1] + x; my = +pa[2] + y; default: - for (var j$1 = 1, jj$1 = pa.length; j$1 < jj$1; j$1++) { - r[j$1] = +pa[j$1] + ((j$1 % 2) ? x : y); + for (var k = 1, kk = pa.length; k < kk; k++) { + r[k] = +pa[k] + ((k % 2) ? x : y); } } } else if (pa0 === "R") { dots = [x, y].concat(pa.slice(1)); - res.pop(); - res = res.concat(catmullRom2bezier(dots, crz)); + resultArray.pop(); + resultArray = resultArray.concat(catmullRom2bezier(dots, crz)); r = ["R"].concat(pa.slice(-2)); } else if (pa0 === "O") { - res.pop(); + resultArray.pop(); dots = ellipsePath(x, y, +pa[1], +pa[2]); dots.push(dots[0]); - res = res.concat(dots); + resultArray = resultArray.concat(dots); } else if (pa0 === "U") { - res.pop(); - res = res.concat(ellipsePath(x, y, +pa[1], +pa[2], +pa[3])); - r = ["U"].concat(res[res.length - 1].slice(-2)); + resultArray.pop(); + resultArray = resultArray.concat(ellipsePath(x, y, +pa[1], +pa[2], +pa[3])); + r = ["U"].concat(resultArray[resultArray.length - 1].slice(-2)); } else { pa.map(function (k){ return r.push(k); }); } @@ -1876,7 +1886,7 @@ function pathToAbsolute(pathArray) { } }; for (var i = start; i < ii; i++) loop( i ); - return roundPath(res) + return roundPath(resultArray) } function pathToString(pathArray) { @@ -1884,9 +1894,9 @@ function pathToString(pathArray) { if (typeof c === 'string') { return c } else { - return c.shift() + c.join(',') + return c.shift() + c.join(' ') } - }).join(' ') + }).join('') } function splitPath(pathString) { diff --git a/dist/kute.esm.min.js b/dist/kute.esm.min.js index e95fe20..03b5117 100644 --- a/dist/kute.esm.min.js +++ b/dist/kute.esm.min.js @@ -1,2 +1,2 @@ // KUTE.js Standard v2.0.13 | thednp © 2020 | MIT-License -var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},a={},i={};i.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ea?e=r:n=r,r=.5*(n-e)+e}return r};var P={},L={linear:new O(0,0,1,1,"linear"),easingSinusoidalIn:new O(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new O(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new O(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new O(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new O(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new O(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new O(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new O(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new O(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new O(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new O(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new O(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new O(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new O(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new O(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new O(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new O(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new O(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new O(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new O(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new O(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new O(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new O(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new O(.68,-.55,.265,1.55,"easingBackInOut")};function V(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function U(){for(var t in a)if("function"==typeof a[t])a[t].call(this,t);else for(var e in a[t])a[t][e].call(this,e);C.call(this)}P.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof L[t])return L[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new O(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),L.linear};var N=function(e,n,r,i){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,i=i||{},this._resetStart=i.resetStart||0,this._easing="function"==typeof i.easing?i.easing:P.processEasing(i.easing),this._duration=i.duration||f.duration,this._delay=i.delay||f.delay,i){var o="_"+s;o in this||(this[o]=i[s])}var u=this._easing.name;return a[u]||(a[u]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};N.prototype.start=function(e){return _(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),U.call(this),this._startFired=!0),!s&&o(),this},N.prototype.stop=function(){return this.playing&&(S(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},N.prototype.close=function(){for(var t in m)for(var e in m[t])m[t][e].call(this,e);this._startFired=!1,u.call(this)},N.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},N.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},N.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},P.tween=N,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var H=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],a=t[2];if(M.call(this,a,"end"),this._resetStart?this.valuesStart=r:M.call(this,r,"start"),!this._resetStart)for(var i in g)for(var s in g[i])g[i][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||f.repeat,this._repeatDelay=o.repeatDelay||f.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||f.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,A.call(this),g)for(var r in g[n])g[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var a in this.valuesEnd)this.valuesRepeat[a]=this.valuesStart[a];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),U.call(this),this._startTime+=t.Time()-this._pauseTime,_(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(S(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(N);P.tween=H;var F=function(t,e,n,r){var a=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var i=[];return Array.from(t).map((function(t,s){i[s]=r||{},i[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?a.tweens.push(new P.tween(t,e,n,i[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};F.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},F.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},F.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},F.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},F.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof F)e.chain(t.tweens);else{if(!(t instanceof P.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},F.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},F.prototype.removeTweens=function(){this.tweens=[]},F.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var j=function(t){try{t.component in c?console.error("KUTE.js - "+t.component+" already registered"):t.property in h?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};function R(t,e){for(var n,r=parseInt(t)||0,a=["px","%","deg","rad","em","rem","vh","vw"],i=0;i.99||a<.01?(10*D(n,r,a)>>0)/10:D(n,r,a)>>0)+"px"})}j.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:d,prepareStart:v,onStart:a,onComplete:m,crossCheck:g},i=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(c[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)h[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var u in t.defaultValues)h[u]=t.defaultValues[u];this.supports=(o||s)+" "+(s||i)+" properties"}if(t.defaultOptions)for(var l in t.defaultOptions)f[l]=t.defaultOptions[l];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][i||s]&&(n[p][e][i||s]=t.functions[p]);else for(var b in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][b]&&(n[p][e][b]=t.functions[p][b]);if(t.Interpolate){for(var x in t.Interpolate){var _=t.Interpolate[x];if("function"!=typeof _||r[x])for(var S in _)"function"!=typeof _[S]||r[x]||(r[x]=_[S]);else r[x]=_}y[e]=t.Interpolate}if(t.Util)for(var C in t.Util)!w[C]&&(w[C]=t.Util[C]);return this};var X=["top","left","width","height"],B={};X.map((function(t){return B[t]=Q}));var z={component:"essentialBoxModel",category:"boxModel",properties:X,defaultValues:{top:0,left:0,width:0,height:0},Interpolate:{numbers:D},functions:{prepareStart:function(t){return E(this.element,t)||h[t]},prepareProperty:function(t,e){var n=R(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:B},Util:{trueDimension:R}};function Z(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var a=document.getElementsByTagName("head")[0];a.style.color=t;var i=getComputedStyle(a,null).color;return i=/rgb/.test(i)?i.replace(/[^\d,]/g,"").split(","):[0,0,0],a.style.color="",{r:parseInt(i[0]),g:parseInt(i[1]),b:parseInt(i[2])}}}function Y(t,e,n){var r,a={};for(r in e)a[r]="a"!==r?D(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*D(t[r],e[r],n)>>0)/100:null;return a.a?"rgba("+a.r+","+a.g+","+a.b+","+a.a+")":"rgb("+a.r+","+a.g+","+a.b+")"}function q(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=Y(n,r,a)})}x.BoxModelEssential=z;var K=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],$={};K.map((function(t){$[t]="#000"}));var W={};K.map((function(t){return W[t]=q}));var G={component:"colorProperties",category:"colors",properties:K,defaultValues:$,Interpolate:{numbers:D,colors:Y},functions:{prepareStart:function(t,e){return E(this.element,t)||h[t]},prepareProperty:function(t,e){return Z(e)},onStart:W},Util:{trueColor:Z}};x.ColorProperties=G;var J={},tt=["fill","stroke","stop-color"];function et(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var nt={prepareStart:function(t,e){var n={};for(var r in e){var a=et(r).replace(/_+[a-z]+/,""),i=this.element.getAttribute(a);n[a]=tt.includes(a)?i||"rgba(0,0,0,0)":i||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var i=et(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(i.replace(/_+[a-z]+/,""));if(tt.includes(i))a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,a){t.setAttribute(e,Y(n,r,a))})},n[i]=Z(e[r])||h.htmlAttributes[r];else if(null!==o&&s.test(o)){var u=R(o).u||R(e[r]).u,l=/%/.test(u)?"_percent":"_"+u;a.htmlAttributes[i+l]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,a){var i=e.replace(l,"");t.setAttribute(i,(1e3*D(n.v,r.v,a)>>0)/1e3+r.u)})},n[i+l]=R(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,a){t.setAttribute(e,(1e3*D(n,r,a)>>0)/1e3)})},n[i]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,a){for(var i in r)t.attributes[i](e,i,n[i],r[i],a)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=J)}}},rt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:D,colors:Y},functions:nt,Util:{replaceUppercase:et,trueColor:Z,trueDimension:R}};x.HTMLAttributes=rt;var at={prepareStart:function(t){return E(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=(1e3*D(n,r,a)>>0)/1e3})}},it={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:D},functions:at};x.OpacityProperty=it;var st=String("abcdefghijklmnopqrstuvwxyz").split(""),ot=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),ut=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),lt=String("0123456789").split(""),pt=st.concat(ot,lt),ct=pt.concat(ut),ht={alpha:st,upper:ot,symbols:ut,numeric:lt,alphanumeric:pt,all:ct},ft={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ht?ht[n]:n&&n.length?n:ht[f.textChars];t[e]=function(t,e,n,a){var i="",s="",o=e.substring(0),u=n.substring(0),l=r[Math.random()*r.length>>0];" "===e?(s=u.substring(Math.min(a*u.length,u.length)>>0,0),t.innerHTML=a<1?s+l:""===n?" ":n):" "===n?(i=o.substring(0,Math.min((1-a)*o.length,o.length)>>0),t.innerHTML=a<1?i+l:""===n?" ":n):(i=o.substring(o.length,Math.min(a*o.length,o.length)>>0),s=u.substring(0,Math.min(a*u.length,u.length)>>0),t.innerHTML=a<1?s+l+i:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=D(e,n,r)>>0})}};function dt(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var a=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=a,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function vt(t,e){var n=[];if(t.children.length){for(var r,a=[],i=t.innerHTML,s=0,o=t.children.length,u=void 0,l=void 0,p=void 0;s>0)/1e3+n+")"}function yt(t,e,n,r){for(var a=[],i=0;i<3;i++)a[i]=(t[i]||e[i]?(1e3*(t[i]+(e[i]-t[i])*r)>>0)/1e3:0)+n;return"translate3d("+a.join(",")+")"}function bt(t,e,n,r){var a="";return a+=t[0]||e[0]?"rotateX("+(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3+n+")":"",a+=t[1]||e[1]?"rotateY("+(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3+n+")":"",a+=t[2]||e[2]?"rotateZ("+(1e3*(t[2]+(e[2]-t[2])*r)>>0)/1e3+n+")":""}function wt(t,e,n){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}function xt(t,e,n,r){var a=[];return a[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,a[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","skew("+a.join(",")+")"}x.TextWriteProperties=gt;var _t={component:"transformFunctions",property:"transform",subProperties:["perspective","translate3d","translateX","translateY","translateZ","translate","rotate3d","rotateX","rotateY","rotateZ","rotate","skewX","skewY","skew","scale"],defaultValues:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,translate:[0,0],rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,rotate:0,skewX:0,skewY:0,skew:[0,0],scale:1},functions:{prepareStart:function(t,e){var n=I(this.element);return n[t]?n[t]:h[t]},prepareProperty:function(t,e){var n=["X","Y","Z"],r={},a=[],i=[],s=[],o=["translate3d","translate","rotate3d","skew"];for(var u in e){var l="object"==typeof e[u]&&e[u].length?e[u].map((function(t){return parseInt(t)})):parseInt(e[u]);if(o.includes(u))r["translate"===u||"rotate"===u?u+"3d":u]="skew"===u?l.length?[l[0]||0,l[1]||0]:[l||0,0]:"translate"===u?l.length?[l[0]||0,l[1]||0,l[2]||0]:[l||0,0,0]:[l[0]||0,l[1]||0,l[2]||0];else if(/[XYZ]/.test(u)){for(var p=u.replace(/[XYZ]/,""),c="skew"===p?p:p+"3d",h="skew"===p?2:3,f="translate"===p?a:"rotate"===p?i:"skew"===p?s:{},d=0;d>0)/1e3)+n,a[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","translate("+a.join(",")+")"},rotate:function(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"},scale:wt,skew:xt}};function St(t,e){return parseFloat(t)/100*e}function Ct(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function Tt(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},a=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var i=0;i>0)/100,i=0-(100*D(e.s,n.s,r)>>0)/100,s=(100*D(e.e,n.e,r)>>0)/100+i;t.style.strokeDashoffset=i+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+a+"px"})}},Pt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:D},functions:Ot,Util:{getRectLength:Ct,getPolyLength:Tt,getLineLength:It,getCircleLength:Et,getEllipseLength:Mt,getTotalLength:At,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:kt,percent:St}};function Lt(t,e,n,r){for(var a=[],i=0;i>0)/1e3)}return a}x.SVGDraw=Pt;var Vt=3;function Ut(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Vt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Nt(t){return this.segments=[],this.isClosed=0,this.isAbsolute=0,this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var Ht={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function Ft(t){return t>=48&&t<=57}function jt(t){return t>=48&&t<=57||43===t||45===t||46===t}function Rt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Dt(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="SvgPath: arc flag can be 0 or 1 only (at pos "+t.index+")")}function Qt(t){var e,n=t.index,r=n,a=t.max,i=!1,s=!1,o=!1,u=!1;if(r>=a)t.err="SvgPath: missed param (at pos "+r+")";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=Ht[n]&&(t.segments.push([e].concat(r.splice(0,Ht[n]))),Ht[n]););}function Bt(t){var e,n,r,a,i,s=t.max;if(t.segmentStart=t.index,e=t.pathValue.charCodeAt(t.index),n=97==(32|e),function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e)){if(a=Ht[t.pathValue[t.index].toLowerCase()],t.index++,Rt(t),t.data=[],!a)return t.isClosed=1,void Xt(t);for(r=!1;;){for(i=a;i>0;i--){if(!n||3!==i&&4!==i?Qt(t):Dt(t),t.err.length)return;t.data.push(t.param),Rt(t),r=!1,t.index=t.max)break;if(!jt(t.pathValue.charCodeAt(t.index)))break}}Xt(t)}else t.err="SvgPath: bad command "+t.pathValue[t.index]+" (at pos "+t.index+")"}function zt(t){if(Array.isArray(t))return function t(e){return e.map((function(e){return Array.isArray(e)?t(e):isNaN(+e)?e:+e}))}(t);var e=new Nt(t),n=e.max;for(Rt(e);e.indexr;r+=2){var i=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?a-4==r?i[3]={x:+t[0],y:+t[1]}:a-2==r&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[a-2],y:+t[a-1]}:a-4==r?i[3]=i[2]:r||(i[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return n}function Yt(t,e,n,r,a){var i;if(null==a&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=a){var s=Math.PI/180,o=t+n*Math.cos(-r*s),u=t+n*Math.cos(-a*s);i=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(a-r>180),0,u,e+n*Math.sin(-a*s)]]}else i=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return i}function qt(t){if(!(t=zt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,a=0,i=0,s=0,o=t.length,u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],a=n,i=r,s++,e[0]=["M",n,r]);for(var l=function(s){var o=void 0,l=t[s],p=l[0];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=+l[6]+n,o[7]=+l[7]+r;break;case"V":o[1]=+l[1]+r;break;case"H":o[1]=+l[1]+n;break;case"R":for(var c=[n,r].concat(l.slice(1)),h=2,f=c.length;h0&&(o=Math.max(o,Math.ceil(n/e)));for(var u=0;ue;)a=Gt(r,a,.5),t.splice(n+1,0,a)}function le(t,e){var n,r;if("string"==typeof t){var a=te(t,e);t=a.ring,r=a.skipBisect}else if(!Array.isArray(t))throw new TypeError("Invalid path value");if(!pe(n=t.slice(0)))throw new TypeError("Invalid path value");return n.length>1&&Jt(n[0],n[n.length-1])&&n.pop(),se(n)>0&&n.reverse(),!r&&e&&$t(e)&&e>0&&ue(n,e),n}function pe(t){return t.every((function(t){return Array.isArray(t)&&t.length>=2&&$t(t[0])&&$t(t[1])}))}function ce(t,e,n){var r=le(t,n=n||f.morphPrecision),a=le(e,n),i=r.length-a.length;return oe(r,i<0?-1*i:0),oe(a,i>0?i:0),ae(r,a),[r,a]}var he={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof Element?e:/^\.|^\#/.test(e)?V(e):null,a=new RegExp("\\n","ig");return"object"==typeof e&&e.pathArray?e:(r&&/path|glyph/.test(r.tagName)?n.original=r.getAttribute("d").replace(a,""):!r&&/[a-z][^a-z]*/gi.test(e)&&(n.original=e.replace(a,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var a=e.pathArray,i=n.pathArray,s=i.length;t.setAttribute("d",1===r?n.original:"M"+Lt(a,i,s,r).join("L")+"Z")})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].pathArray,n=this.valuesEnd[t].pathArray;if(!e||!n||e&&n&&e.length!==n.length){var r=ce(this.valuesStart[t].original,this.valuesEnd[t].original,this._morphPrecision?parseInt(this._morphPrecision):f.morphPrecision);this.valuesStart[t].pathArray=r[0],this.valuesEnd[t].pathArray=r[1]}}}},fe={component:"svgMorph",property:"path",defaultValue:[],Interpolate:Lt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:he,Util:{INVALID_INPUT:"Invalid path value",isFiniteNumber:$t,distance:Wt,pointAlong:Gt,samePoint:Jt,pathToAbsolute:qt,pathToString:Kt,pathStringToRing:te,exactRing:ee,approximateRing:ne,measure:re,rotateRing:ae,polygonLength:ie,polygonArea:se,addPoints:oe,bisect:ue,normalizeRing:le,validRing:pe,getInterpolationPoints:ce}};for(var de in x.SVGMorph=fe,x){var ve=x[de];x[de]=new j(ve)}var ge={Animation:j,Components:x,Tween:H,fromTo:function(t,e,n,r){return r=r||{},new P.tween(V(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new P.tween(V(t),e,e,n)},TweenCollection:F,allFromTo:function(t,e,n,r){return r=r||{},new F(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new F(V(t,!0),e,e,n)},Objects:b,Util:w,Easing:L,CubicBezier:O,Render:l,Interpolate:r,Process:k,Internals:T,Selector:V,Version:"2.0.13"};export default ge; +var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},a={},i={};i.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ea?e=r:n=r,r=.5*(n-e)+e}return r};var L={},P={linear:new O(0,0,1,1,"linear"),easingSinusoidalIn:new O(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new O(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new O(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new O(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new O(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new O(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new O(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new O(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new O(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new O(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new O(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new O(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new O(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new O(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new O(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new O(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new O(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new O(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new O(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new O(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new O(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new O(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new O(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new O(.68,-.55,.265,1.55,"easingBackInOut")};function V(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function U(){for(var t in a)if("function"==typeof a[t])a[t].call(this,t);else for(var e in a[t])a[t][e].call(this,e);T.call(this)}L.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof P[t])return P[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new O(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),P.linear};var N=function(e,n,r,i){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,i=i||{},this._resetStart=i.resetStart||0,this._easing="function"==typeof i.easing?i.easing:L.processEasing(i.easing),this._duration=i.duration||f.duration,this._delay=i.delay||f.delay,i){var o="_"+s;o in this||(this[o]=i[s])}var u=this._easing.name;return a[u]||(a[u]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};N.prototype.start=function(e){return _(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),U.call(this),this._startFired=!0),!s&&o(),this},N.prototype.stop=function(){return this.playing&&(C(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},N.prototype.close=function(){for(var t in y)for(var e in y[t])y[t][e].call(this,e);this._startFired=!1,u.call(this)},N.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},N.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},N.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},L.tween=N,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var H=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],a=t[2];if(A.call(this,a,"end"),this._resetStart?this.valuesStart=r:A.call(this,r,"start"),!this._resetStart)for(var i in g)for(var s in g[i])g[i][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||f.repeat,this._repeatDelay=o.repeatDelay||f.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||f.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,M.call(this),g)for(var r in g[n])g[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var a in this.valuesEnd)this.valuesRepeat[a]=this.valuesStart[a];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),U.call(this),this._startTime+=t.Time()-this._pauseTime,_(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(C(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[a](this.element,this.valuesStart[a],this.valuesEnd[a],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(N);L.tween=H;var j=function(t,e,n,r){var a=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var i=[];return Array.from(t).map((function(t,s){i[s]=r||{},i[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?a.tweens.push(new L.tween(t,e,n,i[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};j.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},j.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},j.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},j.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},j.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof j)e.chain(t.tweens);else{if(!(t instanceof L.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},j.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},j.prototype.removeTweens=function(){this.tweens=[]},j.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var F=function(t){try{t.component in c?console.error("KUTE.js - "+t.component+" already registered"):t.property in h?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};function R(t,e){for(var n,r=parseInt(t)||0,a=["px","%","deg","rad","em","rem","vh","vw"],i=0;i.99||a<.01?(10*D(n,r,a)>>0)/10:D(n,r,a)>>0)+"px"})}F.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:v,prepareStart:d,onStart:a,onComplete:y,crossCheck:g},i=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(c[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)h[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var u in t.defaultValues)h[u]=t.defaultValues[u];this.supports=(o||s)+" "+(s||i)+" properties"}if(t.defaultOptions)for(var l in t.defaultOptions)f[l]=t.defaultOptions[l];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][i||s]&&(n[p][e][i||s]=t.functions[p]);else for(var b in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][b]&&(n[p][e][b]=t.functions[p][b]);if(t.Interpolate){for(var x in t.Interpolate){var _=t.Interpolate[x];if("function"!=typeof _||r[x])for(var C in _)"function"!=typeof _[C]||r[x]||(r[x]=_[C]);else r[x]=_}m[e]=t.Interpolate}if(t.Util)for(var T in t.Util)!w[T]&&(w[T]=t.Util[T]);return this};var X=["top","left","width","height"],B={};X.map((function(t){return B[t]=Q}));var z={component:"essentialBoxModel",category:"boxModel",properties:X,defaultValues:{top:0,left:0,width:0,height:0},Interpolate:{numbers:D},functions:{prepareStart:function(t){return E(this.element,t)||h[t]},prepareProperty:function(t,e){var n=R(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:B},Util:{trueDimension:R}};function Z(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var a=document.getElementsByTagName("head")[0];a.style.color=t;var i=getComputedStyle(a,null).color;return i=/rgb/.test(i)?i.replace(/[^\d,]/g,"").split(","):[0,0,0],a.style.color="",{r:parseInt(i[0]),g:parseInt(i[1]),b:parseInt(i[2])}}}function Y(t,e,n){var r,a={};for(r in e)a[r]="a"!==r?D(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*D(t[r],e[r],n)>>0)/100:null;return a.a?"rgba("+a.r+","+a.g+","+a.b+","+a.a+")":"rgb("+a.r+","+a.g+","+a.b+")"}function q(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=Y(n,r,a)})}x.BoxModelEssential=z;var K=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],$={};K.map((function(t){$[t]="#000"}));var W={};K.map((function(t){return W[t]=q}));var G={component:"colorProperties",category:"colors",properties:K,defaultValues:$,Interpolate:{numbers:D,colors:Y},functions:{prepareStart:function(t,e){return E(this.element,t)||h[t]},prepareProperty:function(t,e){return Z(e)},onStart:W},Util:{trueColor:Z}};x.ColorProperties=G;var J={},tt=["fill","stroke","stop-color"];function et(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var nt={prepareStart:function(t,e){var n={};for(var r in e){var a=et(r).replace(/_+[a-z]+/,""),i=this.element.getAttribute(a);n[a]=tt.includes(a)?i||"rgba(0,0,0,0)":i||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var i=et(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(i.replace(/_+[a-z]+/,""));if(tt.includes(i))a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,a){t.setAttribute(e,Y(n,r,a))})},n[i]=Z(e[r])||h.htmlAttributes[r];else if(null!==o&&s.test(o)){var u=R(o).u||R(e[r]).u,l=/%/.test(u)?"_percent":"_"+u;a.htmlAttributes[i+l]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,a){var i=e.replace(l,"");t.setAttribute(i,(1e3*D(n.v,r.v,a)>>0)/1e3+r.u)})},n[i+l]=R(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(a.htmlAttributes[i]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,a){t.setAttribute(e,(1e3*D(n,r,a)>>0)/1e3)})},n[i]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,a){for(var i in r)t.attributes[i](e,i,n[i],r[i],a)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=J)}}},rt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:D,colors:Y},functions:nt,Util:{replaceUppercase:et,trueColor:Z,trueDimension:R}};x.HTMLAttributes=rt;var at={prepareStart:function(t){return E(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,a){t.style[e]=(1e3*D(n,r,a)>>0)/1e3})}},it={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:D},functions:at};x.OpacityProperty=it;var st=String("abcdefghijklmnopqrstuvwxyz").split(""),ot=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),ut=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),lt=String("0123456789").split(""),pt=st.concat(ot,lt),ct=pt.concat(ut),ht={alpha:st,upper:ot,symbols:ut,numeric:lt,alphanumeric:pt,all:ct},ft={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ht?ht[n]:n&&n.length?n:ht[f.textChars];t[e]=function(t,e,n,a){var i="",s="",o=e.substring(0),u=n.substring(0),l=r[Math.random()*r.length>>0];" "===e?(s=u.substring(Math.min(a*u.length,u.length)>>0,0),t.innerHTML=a<1?s+l:""===n?" ":n):" "===n?(i=o.substring(0,Math.min((1-a)*o.length,o.length)>>0),t.innerHTML=a<1?i+l:""===n?" ":n):(i=o.substring(o.length,Math.min(a*o.length,o.length)>>0),s=u.substring(0,Math.min(a*u.length,u.length)>>0),t.innerHTML=a<1?s+l+i:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=D(e,n,r)>>0})}};function vt(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var a=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=a,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function dt(t,e){var n=[];if(t.children.length){for(var r,a=[],i=t.innerHTML,s=0,o=t.children.length,u=void 0,l=void 0,p=void 0;s>0)/1e3+n+")"}function mt(t,e,n,r){for(var a=[],i=0;i<3;i++)a[i]=(t[i]||e[i]?(1e3*(t[i]+(e[i]-t[i])*r)>>0)/1e3:0)+n;return"translate3d("+a.join(",")+")"}function bt(t,e,n,r){var a="";return a+=t[0]||e[0]?"rotateX("+(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3+n+")":"",a+=t[1]||e[1]?"rotateY("+(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3+n+")":"",a+=t[2]||e[2]?"rotateZ("+(1e3*(t[2]+(e[2]-t[2])*r)>>0)/1e3+n+")":""}function wt(t,e,n){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}function xt(t,e,n,r){var a=[];return a[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,a[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","skew("+a.join(",")+")"}x.TextWriteProperties=gt;var _t={component:"transformFunctions",property:"transform",subProperties:["perspective","translate3d","translateX","translateY","translateZ","translate","rotate3d","rotateX","rotateY","rotateZ","rotate","skewX","skewY","skew","scale"],defaultValues:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,translate:[0,0],rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,rotate:0,skewX:0,skewY:0,skew:[0,0],scale:1},functions:{prepareStart:function(t,e){var n=S(this.element);return n[t]?n[t]:h[t]},prepareProperty:function(t,e){var n=["X","Y","Z"],r={},a=[],i=[],s=[],o=["translate3d","translate","rotate3d","skew"];for(var u in e){var l="object"==typeof e[u]&&e[u].length?e[u].map((function(t){return parseInt(t)})):parseInt(e[u]);if(o.includes(u))r["translate"===u||"rotate"===u?u+"3d":u]="skew"===u?l.length?[l[0]||0,l[1]||0]:[l||0,0]:"translate"===u?l.length?[l[0]||0,l[1]||0,l[2]||0]:[l||0,0,0]:[l[0]||0,l[1]||0,l[2]||0];else if(/[XYZ]/.test(u)){for(var p=u.replace(/[XYZ]/,""),c="skew"===p?p:p+"3d",h="skew"===p?2:3,f="translate"===p?a:"rotate"===p?i:"skew"===p?s:{},v=0;v>0)/1e3)+n,a[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","translate("+a.join(",")+")"},rotate:function(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"},scale:wt,skew:xt}};function Ct(t,e){return parseFloat(t)/100*e}function Tt(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function It(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},a=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var i=0;i>0)/100,i=0-(100*D(e.s,n.s,r)>>0)/100,s=(100*D(e.e,n.e,r)>>0)/100+i;t.style.strokeDashoffset=i+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+a+"px"})}},Lt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:D},functions:Ot,Util:{getRectLength:Tt,getPolyLength:It,getLineLength:St,getCircleLength:Et,getEllipseLength:At,getTotalLength:Mt,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:kt,percent:Ct}};function Pt(t,e,n,r){for(var a=[],i=0;i>0)/1e3)}return a}x.SVGDraw=Lt;var Vt=3;function Ut(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Vt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Nt(t){return this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var Ht={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function jt(t){var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;if("m"===n&&r.length>2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=Ht[n]&&(t.segments.push([e].concat(r.splice(0,Ht[n]))),Ht[n]););}function Ft(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="Invalid path value")}function Rt(t){return t>=48&&t<=57}function Dt(t){var e,n=t.index,r=n,a=t.max,i=!1,s=!1,o=!1,u=!1;if(r>=a)t.err="Invalid path value";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r=48&&t<=57||43===t||45===t||46===t}function Xt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Bt(t){var e,n,r,a,i=t.max;if(t.segmentStart=t.index,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e=t.pathValue.charCodeAt(t.index)))if(r=Ht[t.pathValue[t.index].toLowerCase()],t.index++,Xt(t),t.data=[],r){for(n=!1;;){for(a=r;a>0;a--){if(97!=(32|e)||3!==a&&4!==a?Dt(t):Ft(t),t.err.length)return;t.data.push(t.param),Xt(t),n=!1,t.index=t.max)break;if(!Qt(t.pathValue.charCodeAt(t.index)))break}}jt(t)}else jt(t);else t.err="Invalid path value"}function zt(t){if(Array.isArray(t)&&Array.isArray(t[0]))return function t(e){return e.map((function(e){return Array.isArray(e)?t(e):isNaN(+e)?e:+e}))}(t);var e=new Nt(t),n=e.max;for(Xt(e);e.indexr;r+=2){var i=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?a-4==r?i[3]={x:+t[0],y:+t[1]}:a-2==r&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[a-2],y:+t[a-1]}:a-4==r?i[3]=i[2]:r||(i[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return n}function Yt(t,e,n,r,a){var i;if(null==a&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=a){var s=Math.PI/180,o=t+n*Math.cos(-r*s),u=t+n*Math.cos(-a*s);i=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(a-r>180),0,u,e+n*Math.sin(-a*s)]]}else i=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return i}function qt(t){if(!(t=zt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,a=0,i=0,s=0,o=t.length,u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],a=n,i=r,s++,e[0]=["M",n,r]);for(var l=function(s){var o=[],l=t[s],p=l[0],c=[];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=+l[6]+n,o[7]=+l[7]+r;break;case"V":o[1]=+l[1]+r;break;case"H":o[1]=+l[1]+n;break;case"R":for(var h=2,f=(c=[n,r].concat(l.slice(1))).length;h0&&(o=Math.max(o,Math.ceil(n/e)));for(var u=0;ue;)a=Gt(r,a,.5),t.splice(n+1,0,a)}function le(t,e){var n,r;if("string"==typeof t){var a=te(t,e);t=a.ring,r=a.skipBisect}else if(!Array.isArray(t))throw new TypeError("Invalid path value");if(!pe(n=t.slice(0)))throw new TypeError("Invalid path value");return n.length>1&&Jt(n[0],n[n.length-1])&&n.pop(),se(n)>0&&n.reverse(),!r&&e&&$t(e)&&e>0&&ue(n,e),n}function pe(t){return t.every((function(t){return Array.isArray(t)&&t.length>=2&&$t(t[0])&&$t(t[1])}))}function ce(t,e,n){var r=le(t,n=n||f.morphPrecision),a=le(e,n),i=r.length-a.length;return oe(r,i<0?-1*i:0),oe(a,i>0?i:0),ae(r,a),[r,a]}var he={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof Element?e:/^\.|^\#/.test(e)?V(e):null,a=new RegExp("\\n","ig");return"object"==typeof e&&e.pathArray?e:(r&&/path|glyph/.test(r.tagName)?n.original=r.getAttribute("d").replace(a,""):!r&&/[a-z][^a-z]*/gi.test(e)&&(n.original=e.replace(a,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var a=e.pathArray,i=n.pathArray,s=i.length;t.setAttribute("d",1===r?n.original:"M"+Pt(a,i,s,r).join("L")+"Z")})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].pathArray,n=this.valuesEnd[t].pathArray;if(!e||!n||e&&n&&e.length!==n.length){var r=ce(this.valuesStart[t].original,this.valuesEnd[t].original,this._morphPrecision?parseInt(this._morphPrecision):f.morphPrecision);this.valuesStart[t].pathArray=r[0],this.valuesEnd[t].pathArray=r[1]}}}},fe={component:"svgMorph",property:"path",defaultValue:[],Interpolate:Pt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:he,Util:{INVALID_INPUT:"Invalid path value",isFiniteNumber:$t,distance:Wt,pointAlong:Gt,samePoint:Jt,pathToAbsolute:qt,pathToString:Kt,pathStringToRing:te,exactRing:ee,approximateRing:ne,measure:re,rotateRing:ae,polygonLength:ie,polygonArea:se,addPoints:oe,bisect:ue,normalizeRing:le,validRing:pe,getInterpolationPoints:ce}};for(var ve in x.SVGMorph=fe,x){var de=x[ve];x[ve]=new F(de)}var ge={Animation:F,Components:x,Tween:H,fromTo:function(t,e,n,r){return r=r||{},new L.tween(V(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new L.tween(V(t),e,e,n)},TweenCollection:j,allFromTo:function(t,e,n,r){return r=r||{},new j(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new j(V(t,!0),e,e,n)},Objects:b,Util:w,Easing:P,CubicBezier:O,Render:l,Interpolate:r,Process:k,Internals:I,Selector:V,Version:"2.0.13"};export default ge; diff --git a/dist/kute.js b/dist/kute.js index 95da196..244b524 100644 --- a/dist/kute.js +++ b/dist/kute.js @@ -6,7 +6,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.KUTE = factory()); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.KUTE = factory()); }(this, (function () { 'use strict'; var version = "2.0.13"; @@ -744,14 +744,14 @@ } } if (Component.Interpolate) { - for (var fn$1 in Component.Interpolate) { - var compIntObj = Component.Interpolate[fn$1]; - if ( typeof(compIntObj) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj; + for (var fni in Component.Interpolate) { + var compIntObj = Component.Interpolate[fni]; + if ( typeof(compIntObj) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj; } else { for ( var sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn$1] ) { - Interpolate[fn$1] = compIntObj[sfn]; + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj[sfn]; } } } @@ -759,8 +759,8 @@ linkProperty[ComponentName] = Component.Interpolate; } if (Component.Util) { - for (var fn$2 in Component.Util){ - !Util[fn$2] && (Util[fn$2] = Component.Util[fn$2]); + for (var fnu in Component.Util){ + !Util[fnu] && (Util[fnu] = Component.Util[fnu]); } } return propertyInfo @@ -1467,23 +1467,21 @@ return pathArray.map(function (x) { return Array.isArray(x) ? clonePath(x) : !isNaN(+x) ? +x : x; } ) } - var SVGPCOps = { + var SVGPathCommanderOptions = { decimals:3, round:1 }; function roundPath(pathArray) { - return pathArray.map( function (seg) { return seg.map(function (c,i) { - var nr = +c, dc = Math.pow(10,SVGPCOps.decimals); - return i ? (nr % 1 === 0 ? nr : (nr*dc>>0)/dc) : c - } - ); }) + return pathArray.map( function (seg) { return seg.map(function (c,i) { + var nr = +c, dc = Math.pow(10,SVGPathCommanderOptions.decimals); + return i ? (nr % 1 === 0 ? nr : (nr*dc>>0)/dc) : c + } + ); }) } function SVGPathArray(pathString){ this.segments = []; - this.isClosed = 0; - this.isAbsolute = 0; this.pathValue = pathString; this.max = pathString.length; this.index = 0; @@ -1495,48 +1493,29 @@ } var paramCounts = { a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0 }; - function isSpace(ch) { - var specialSpaces = [ - 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, - 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF ]; - return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029) || - (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || - (ch >= 0x1680 && specialSpaces.indexOf(ch) >= 0); - } - function isCommand(code) { - switch (code | 0x20) { - case 0x6D: - case 0x7A: - case 0x6C: - case 0x68: - case 0x76: - case 0x63: - case 0x73: - case 0x71: - case 0x74: - case 0x61: - case 0x72: - return true; + + function finalizeSegment(state) { + var cmd = state.pathValue[state.segmentStart], cmdLC = cmd.toLowerCase(), params = state.data; + if (cmdLC === 'm' && params.length > 2) { + state.segments.push([ cmd, params[0], params[1] ]); + params = params.slice(2); + cmdLC = 'l'; + cmd = (cmd === 'm') ? 'l' : 'L'; } - return false; - } - function isArc(code) { - return (code | 0x20) === 0x61; - } - function isDigit(code) { - return (code >= 48 && code <= 57); - } - function isDigitStart(code) { - return (code >= 48 && code <= 57) || - code === 0x2B || - code === 0x2D || - code === 0x2E; - } - function skipSpaces(state) { - while (state.index < state.max && isSpace(state.pathValue.charCodeAt(state.index))) { - state.index++; + if (cmdLC === 'r') { + state.segments.push([ cmd ].concat(params)); + } else { + while (params.length >= paramCounts[cmdLC]) { + state.segments.push([ cmd ].concat(params.splice(0, paramCounts[cmdLC]))); + if (!paramCounts[cmdLC]) { + break; + } + } } } + + var invalidPathValue = 'Invalid path value'; + function scanFlag(state) { var ch = state.pathValue.charCodeAt(state.index); if (ch === 0x30) { @@ -1549,8 +1528,13 @@ state.index++; return; } - state.err = 'SvgPath: arc flag can be 0 or 1 only (at pos ' + state.index + ')'; + state.err = invalidPathValue; } + + function isDigit(code) { + return (code >= 48 && code <= 57); + } + function scanParam(state) { var start = state.index, index = start, @@ -1561,7 +1545,7 @@ hasDot = false, ch; if (index >= max) { - state.err = 'SvgPath: missed param (at pos ' + index + ')'; + state.err = invalidPathValue; return; } ch = state.pathValue.charCodeAt(index); @@ -1570,7 +1554,7 @@ ch = (index < max) ? state.pathValue.charCodeAt(index) : 0; } if (!isDigit(ch) && ch !== 0x2E) { - state.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')'; + state.err = invalidPathValue; return; } if (ch !== 0x2E) { @@ -1579,7 +1563,7 @@ ch = (index < max) ? state.pathValue.charCodeAt(index) : 0; if (zeroFirst && index < max) { if (ch && isDigit(ch)) { - state.err = 'SvgPath: numbers started with `0` such as `09` are illegal (at pos ' + start + ')'; + state.err = invalidPathValue; return; } } @@ -1600,7 +1584,7 @@ } if (ch === 0x65 || ch === 0x45) { if (hasDot && !hasCeiling && !hasDecimal) { - state.err = 'SvgPath: invalid float exponent (at pos ' + index + ')'; + state.err = invalidPathValue; return; } index++; @@ -1613,39 +1597,64 @@ index++; } } else { - state.err = 'SvgPath: invalid float exponent (at pos ' + index + ')'; + state.err = invalidPathValue; return; } } state.index = index; - state.param = parseFloat(state.pathValue.slice(start, index)) + 0.0; + state.param = +state.pathValue.slice(start, index); } - function finalizeSegment(state) { - var cmd = state.pathValue[state.segmentStart], cmdLC = cmd.toLowerCase(), params = state.data; - if (cmdLC === 'm' && params.length > 2) { - state.segments.push([ cmd, params[0], params[1] ]); - params = params.slice(2); - cmdLC = 'l'; - cmd = (cmd === 'm') ? 'l' : 'L'; + + function isCommand(code) { + switch (code | 0x20) { + case 0x6D: + case 0x7A: + case 0x6C: + case 0x68: + case 0x76: + case 0x63: + case 0x73: + case 0x71: + case 0x74: + case 0x61: + case 0x72: + return true; } - if (cmdLC === 'r') { - state.segments.push([ cmd ].concat(params)); - } else { - while (params.length >= paramCounts[cmdLC]) { - state.segments.push([ cmd ].concat(params.splice(0, paramCounts[cmdLC]))); - if (!paramCounts[cmdLC]) { - break; - } - } + return false; + } + + function isDigitStart(code) { + return (code >= 48 && code <= 57) || + code === 0x2B || + code === 0x2D || + code === 0x2E; + } + + function isArc(code) { + return (code | 0x20) === 0x61; + } + + function isSpace(ch) { + var specialSpaces = [ + 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, + 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF ]; + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029) || + (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && specialSpaces.indexOf(ch) >= 0); + } + + function skipSpaces(state) { + while (state.index < state.max && isSpace(state.pathValue.charCodeAt(state.index))) { + state.index++; } } + function scanSegment(state) { - var max = state.max, cmdCode, is_arc, comma_found, need_params, i; + var max = state.max, cmdCode, comma_found, need_params, i; state.segmentStart = state.index; cmdCode = state.pathValue.charCodeAt(state.index); - is_arc = isArc(cmdCode); if (!isCommand(cmdCode)) { - state.err = 'SvgPath: bad command ' + state.pathValue[state.index] + ' (at pos ' + state.index + ')'; + state.err = invalidPathValue; return; } need_params = paramCounts[state.pathValue[state.index].toLowerCase()]; @@ -1653,14 +1662,13 @@ skipSpaces(state); state.data = []; if (!need_params) { - state.isClosed = 1; finalizeSegment(state); return; } comma_found = false; for (;;) { for (i = need_params; i > 0; i--) { - if (is_arc && (i === 3 || i === 4)) { scanFlag(state); } + if (isArc(cmdCode) && (i === 3 || i === 4)) { scanFlag(state); } else { scanParam(state); } if (state.err.length) { return; @@ -1686,8 +1694,9 @@ } finalizeSegment(state); } + function parsePathString(pathString) { - if ( Array.isArray(pathString) ) { + if ( Array.isArray(pathString) && Array.isArray(pathString[0])) { return clonePath(pathString) } var state = new SVGPathArray(pathString), max = state.max; @@ -1699,7 +1708,7 @@ state.segments = []; } else if (state.segments.length) { if ('mM'.indexOf(state.segments[0][0]) < 0) { - state.err = 'SvgPath: string should start with `M` or `m`'; + state.err = invalidPathValue; state.segments = []; } else { state.segments[0][0] = 'M'; @@ -1779,8 +1788,9 @@ if (!pathArray || !pathArray.length) { return [["M", 0, 0]]; } - var res = [], x = 0, y = 0, mx = 0, my = 0, start = 0, - ii = pathArray.length, + var resultArray = [], + x = 0, y = 0, mx = 0, my = 0, + start = 0, ii = pathArray.length, crz = pathArray.length === 3 && pathArray[0][0] === "M" && pathArray[1][0].toUpperCase() === "R" && @@ -1791,11 +1801,11 @@ mx = x; my = y; start++; - res[0] = ["M", x, y]; + resultArray[0] = ["M", x, y]; } var loop = function ( i ) { - var r = (void 0), pa = pathArray[i], pa0 = pa[0]; - res.push(r = []); + var r = [], pa = pathArray[i], pa0 = pa[0], dots = []; + resultArray.push(r = []); if (pa0 !== pa0.toUpperCase()) { r[0] = pa0.toUpperCase(); switch (r[0]) { @@ -1815,47 +1825,47 @@ r[1] = +pa[1] + x; break; case "R": - var dots$1 = [x, y].concat(pa.slice(1)); - for (var j = 2, jj = dots$1.length; j < jj; j++) { - dots$1[j] = +dots$1[j] + x; - dots$1[++j] = +dots$1[j] + y; + dots = [x, y].concat(pa.slice(1)); + for (var j = 2, jj = dots.length; j < jj; j++) { + dots[j] = +dots[j] + x; + dots[++j] = +dots[j] + y; } - res.pop(); - res = res.concat(catmullRom2bezier(dots$1, crz)); + resultArray.pop(); + resultArray = resultArray.concat(catmullRom2bezier(dots, crz)); break; case "O": - res.pop(); - dots$1 = ellipsePath(x, y, +pa[1], +pa[2]); - dots$1.push(dots$1[0]); - res = res.concat(dots$1); + resultArray.pop(); + dots = ellipsePath(x, y, +pa[1], +pa[2]); + dots.push(dots[0]); + resultArray = resultArray.concat(dots); break; case "U": - res.pop(); - res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); - r = ["U"].concat(res[res.length - 1].slice(-2)); + resultArray.pop(); + resultArray = resultArray.concat(ellipsePath(x, y, pa[1], pa[2], pa[3])); + r = ["U"].concat(resultArray[resultArray.length - 1].slice(-2)); break; case "M": mx = +pa[1] + x; my = +pa[2] + y; default: - for (var j$1 = 1, jj$1 = pa.length; j$1 < jj$1; j$1++) { - r[j$1] = +pa[j$1] + ((j$1 % 2) ? x : y); + for (var k = 1, kk = pa.length; k < kk; k++) { + r[k] = +pa[k] + ((k % 2) ? x : y); } } } else if (pa0 === "R") { dots = [x, y].concat(pa.slice(1)); - res.pop(); - res = res.concat(catmullRom2bezier(dots, crz)); + resultArray.pop(); + resultArray = resultArray.concat(catmullRom2bezier(dots, crz)); r = ["R"].concat(pa.slice(-2)); } else if (pa0 === "O") { - res.pop(); + resultArray.pop(); dots = ellipsePath(x, y, +pa[1], +pa[2]); dots.push(dots[0]); - res = res.concat(dots); + resultArray = resultArray.concat(dots); } else if (pa0 === "U") { - res.pop(); - res = res.concat(ellipsePath(x, y, +pa[1], +pa[2], +pa[3])); - r = ["U"].concat(res[res.length - 1].slice(-2)); + resultArray.pop(); + resultArray = resultArray.concat(ellipsePath(x, y, +pa[1], +pa[2], +pa[3])); + r = ["U"].concat(resultArray[resultArray.length - 1].slice(-2)); } else { pa.map(function (k){ return r.push(k); }); } @@ -1882,7 +1892,7 @@ } }; for (var i = start; i < ii; i++) loop( i ); - return roundPath(res) + return roundPath(resultArray) } function pathToString(pathArray) { @@ -1890,9 +1900,9 @@ if (typeof c === 'string') { return c } else { - return c.shift() + c.join(',') + return c.shift() + c.join(' ') } - }).join(' ') + }).join('') } function splitPath(pathString) { diff --git a/dist/kute.min.js b/dist/kute.min.js index 437a1a4..97230a5 100644 --- a/dist/kute.min.js +++ b/dist/kute.min.js @@ -1,2 +1,2 @@ // KUTE.js Standard v2.0.13 | thednp © 2020 | MIT-License -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).KUTE=e()}(this,(function(){"use strict";var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},i={},a={};a.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ei?e=r:n=r,r=.5*(n-e)+e}return r};var P={},L={linear:new O(0,0,1,1,"linear"),easingSinusoidalIn:new O(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new O(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new O(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new O(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new O(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new O(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new O(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new O(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new O(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new O(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new O(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new O(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new O(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new O(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new O(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new O(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new O(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new O(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new O(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new O(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new O(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new O(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new O(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new O(.68,-.55,.265,1.55,"easingBackInOut")};function V(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function U(){for(var t in i)if("function"==typeof i[t])i[t].call(this,t);else for(var e in i[t])i[t][e].call(this,e);C.call(this)}P.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof L[t])return L[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new O(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),L.linear};var N=function(e,n,r,a){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,a=a||{},this._resetStart=a.resetStart||0,this._easing="function"==typeof a.easing?a.easing:P.processEasing(a.easing),this._duration=a.duration||f.duration,this._delay=a.delay||f.delay,a){var o="_"+s;o in this||(this[o]=a[s])}var u=this._easing.name;return i[u]||(i[u]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};N.prototype.start=function(e){return _(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),U.call(this),this._startFired=!0),!s&&o(),this},N.prototype.stop=function(){return this.playing&&(S(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},N.prototype.close=function(){for(var t in m)for(var e in m[t])m[t][e].call(this,e);this._startFired=!1,u.call(this)},N.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},N.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},N.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},P.tween=N,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var H=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],i=t[2];if(M.call(this,i,"end"),this._resetStart?this.valuesStart=r:M.call(this,r,"start"),!this._resetStart)for(var a in g)for(var s in g[a])g[a][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||f.repeat,this._repeatDelay=o.repeatDelay||f.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||f.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,A.call(this),g)for(var r in g[n])g[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var i in this.valuesEnd)this.valuesRepeat[i]=this.valuesStart[i];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),U.call(this),this._startTime+=t.Time()-this._pauseTime,_(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(S(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(N);P.tween=H;var j=function(t,e,n,r){var i=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var a=[];return Array.from(t).map((function(t,s){a[s]=r||{},a[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?i.tweens.push(new P.tween(t,e,n,a[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};j.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},j.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},j.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},j.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},j.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof j)e.chain(t.tweens);else{if(!(t instanceof P.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},j.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},j.prototype.removeTweens=function(){this.tweens=[]},j.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var F=function(t){try{t.component in c?console.error("KUTE.js - "+t.component+" already registered"):t.property in h?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};function R(t,e){for(var n,r=parseInt(t)||0,i=["px","%","deg","rad","em","rem","vh","vw"],a=0;a.99||i<.01?(10*D(n,r,i)>>0)/10:D(n,r,i)>>0)+"px"})}F.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:d,prepareStart:v,onStart:i,onComplete:m,crossCheck:g},a=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(c[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)h[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var u in t.defaultValues)h[u]=t.defaultValues[u];this.supports=(o||s)+" "+(s||a)+" properties"}if(t.defaultOptions)for(var l in t.defaultOptions)f[l]=t.defaultOptions[l];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][a||s]&&(n[p][e][a||s]=t.functions[p]);else for(var b in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][b]&&(n[p][e][b]=t.functions[p][b]);if(t.Interpolate){for(var x in t.Interpolate){var _=t.Interpolate[x];if("function"!=typeof _||r[x])for(var S in _)"function"!=typeof _[S]||r[x]||(r[x]=_[S]);else r[x]=_}y[e]=t.Interpolate}if(t.Util)for(var C in t.Util)!w[C]&&(w[C]=t.Util[C]);return this};var X=["top","left","width","height"],B={};X.map((function(t){return B[t]=Q}));var z={component:"essentialBoxModel",category:"boxModel",properties:X,defaultValues:{top:0,left:0,width:0,height:0},Interpolate:{numbers:D},functions:{prepareStart:function(t){return I(this.element,t)||h[t]},prepareProperty:function(t,e){var n=R(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:B},Util:{trueDimension:R}};function Z(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var i=document.getElementsByTagName("head")[0];i.style.color=t;var a=getComputedStyle(i,null).color;return a=/rgb/.test(a)?a.replace(/[^\d,]/g,"").split(","):[0,0,0],i.style.color="",{r:parseInt(a[0]),g:parseInt(a[1]),b:parseInt(a[2])}}}function Y(t,e,n){var r,i={};for(r in e)i[r]="a"!==r?D(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*D(t[r],e[r],n)>>0)/100:null;return i.a?"rgba("+i.r+","+i.g+","+i.b+","+i.a+")":"rgb("+i.r+","+i.g+","+i.b+")"}function q(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=Y(n,r,i)})}x.BoxModelEssential=z;var K=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],$={};K.map((function(t){$[t]="#000"}));var W={};K.map((function(t){return W[t]=q}));var G={component:"colorProperties",category:"colors",properties:K,defaultValues:$,Interpolate:{numbers:D,colors:Y},functions:{prepareStart:function(t,e){return I(this.element,t)||h[t]},prepareProperty:function(t,e){return Z(e)},onStart:W},Util:{trueColor:Z}};x.ColorProperties=G;var J={},tt=["fill","stroke","stop-color"];function et(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var nt={prepareStart:function(t,e){var n={};for(var r in e){var i=et(r).replace(/_+[a-z]+/,""),a=this.element.getAttribute(i);n[i]=tt.includes(i)?a||"rgba(0,0,0,0)":a||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var a=et(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(a.replace(/_+[a-z]+/,""));if(tt.includes(a))i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,Y(n,r,i))})},n[a]=Z(e[r])||h.htmlAttributes[r];else if(null!==o&&s.test(o)){var u=R(o).u||R(e[r]).u,l=/%/.test(u)?"_percent":"_"+u;i.htmlAttributes[a+l]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){var a=e.replace(l,"");t.setAttribute(a,(1e3*D(n.v,r.v,i)>>0)/1e3+r.u)})},n[a+l]=R(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,(1e3*D(n,r,i)>>0)/1e3)})},n[a]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,i){for(var a in r)t.attributes[a](e,a,n[a],r[a],i)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=J)}}},rt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:D,colors:Y},functions:nt,Util:{replaceUppercase:et,trueColor:Z,trueDimension:R}};x.HTMLAttributes=rt;var it={prepareStart:function(t){return I(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=(1e3*D(n,r,i)>>0)/1e3})}},at={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:D},functions:it};x.OpacityProperty=at;var st=String("abcdefghijklmnopqrstuvwxyz").split(""),ot=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),ut=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),lt=String("0123456789").split(""),pt=st.concat(ot,lt),ct=pt.concat(ut),ht={alpha:st,upper:ot,symbols:ut,numeric:lt,alphanumeric:pt,all:ct},ft={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ht?ht[n]:n&&n.length?n:ht[f.textChars];t[e]=function(t,e,n,i){var a="",s="",o=e.substring(0),u=n.substring(0),l=r[Math.random()*r.length>>0];" "===e?(s=u.substring(Math.min(i*u.length,u.length)>>0,0),t.innerHTML=i<1?s+l:""===n?" ":n):" "===n?(a=o.substring(0,Math.min((1-i)*o.length,o.length)>>0),t.innerHTML=i<1?a+l:""===n?" ":n):(a=o.substring(o.length,Math.min(i*o.length,o.length)>>0),s=u.substring(0,Math.min(i*u.length,u.length)>>0),t.innerHTML=i<1?s+l+a:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=D(e,n,r)>>0})}};function dt(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var i=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=i,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function vt(t,e){var n=[];if(t.children.length){for(var r,i=[],a=t.innerHTML,s=0,o=t.children.length,u=void 0,l=void 0,p=void 0;s>0)/1e3+n+")"}function yt(t,e,n,r){for(var i=[],a=0;a<3;a++)i[a]=(t[a]||e[a]?(1e3*(t[a]+(e[a]-t[a])*r)>>0)/1e3:0)+n;return"translate3d("+i.join(",")+")"}function bt(t,e,n,r){var i="";return i+=t[0]||e[0]?"rotateX("+(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3+n+")":"",i+=t[1]||e[1]?"rotateY("+(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3+n+")":"",i+=t[2]||e[2]?"rotateZ("+(1e3*(t[2]+(e[2]-t[2])*r)>>0)/1e3+n+")":""}function wt(t,e,n){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}function xt(t,e,n,r){var i=[];return i[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","skew("+i.join(",")+")"}x.TextWriteProperties=gt;var _t={component:"transformFunctions",property:"transform",subProperties:["perspective","translate3d","translateX","translateY","translateZ","translate","rotate3d","rotateX","rotateY","rotateZ","rotate","skewX","skewY","skew","scale"],defaultValues:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,translate:[0,0],rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,rotate:0,skewX:0,skewY:0,skew:[0,0],scale:1},functions:{prepareStart:function(t,e){var n=E(this.element);return n[t]?n[t]:h[t]},prepareProperty:function(t,e){var n=["X","Y","Z"],r={},i=[],a=[],s=[],o=["translate3d","translate","rotate3d","skew"];for(var u in e){var l="object"==typeof e[u]&&e[u].length?e[u].map((function(t){return parseInt(t)})):parseInt(e[u]);if(o.includes(u))r["translate"===u||"rotate"===u?u+"3d":u]="skew"===u?l.length?[l[0]||0,l[1]||0]:[l||0,0]:"translate"===u?l.length?[l[0]||0,l[1]||0,l[2]||0]:[l||0,0,0]:[l[0]||0,l[1]||0,l[2]||0];else if(/[XYZ]/.test(u)){for(var p=u.replace(/[XYZ]/,""),c="skew"===p?p:p+"3d",h="skew"===p?2:3,f="translate"===p?i:"rotate"===p?a:"skew"===p?s:{},d=0;d>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","translate("+i.join(",")+")"},rotate:function(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"},scale:wt,skew:xt}};function St(t,e){return parseFloat(t)/100*e}function Ct(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function Tt(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},i=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var a=0;a>0)/100,a=0-(100*D(e.s,n.s,r)>>0)/100,s=(100*D(e.e,n.e,r)>>0)/100+a;t.style.strokeDashoffset=a+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+i+"px"})}},Pt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:D},functions:Ot,Util:{getRectLength:Ct,getPolyLength:Tt,getLineLength:Et,getCircleLength:It,getEllipseLength:Mt,getTotalLength:At,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:kt,percent:St}};function Lt(t,e,n,r){for(var i=[],a=0;a>0)/1e3)}return i}x.SVGDraw=Pt;var Vt=3;function Ut(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Vt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Nt(t){return this.segments=[],this.isClosed=0,this.isAbsolute=0,this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var Ht={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function jt(t){return t>=48&&t<=57}function Ft(t){return t>=48&&t<=57||43===t||45===t||46===t}function Rt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Dt(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="SvgPath: arc flag can be 0 or 1 only (at pos "+t.index+")")}function Qt(t){var e,n=t.index,r=n,i=t.max,a=!1,s=!1,o=!1,u=!1;if(r>=i)t.err="SvgPath: missed param (at pos "+r+")";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=Ht[n]&&(t.segments.push([e].concat(r.splice(0,Ht[n]))),Ht[n]););}function Bt(t){var e,n,r,i,a,s=t.max;if(t.segmentStart=t.index,e=t.pathValue.charCodeAt(t.index),n=97==(32|e),function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e)){if(i=Ht[t.pathValue[t.index].toLowerCase()],t.index++,Rt(t),t.data=[],!i)return t.isClosed=1,void Xt(t);for(r=!1;;){for(a=i;a>0;a--){if(!n||3!==a&&4!==a?Qt(t):Dt(t),t.err.length)return;t.data.push(t.param),Rt(t),r=!1,t.index=t.max)break;if(!Ft(t.pathValue.charCodeAt(t.index)))break}}Xt(t)}else t.err="SvgPath: bad command "+t.pathValue[t.index]+" (at pos "+t.index+")"}function zt(t){if(Array.isArray(t))return function t(e){return e.map((function(e){return Array.isArray(e)?t(e):isNaN(+e)?e:+e}))}(t);var e=new Nt(t),n=e.max;for(Rt(e);e.indexr;r+=2){var a=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4==r?a[3]={x:+t[0],y:+t[1]}:i-2==r&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[i-2],y:+t[i-1]}:i-4==r?a[3]=a[2]:r||(a[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return n}function Yt(t,e,n,r,i){var a;if(null==i&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=i){var s=Math.PI/180,o=t+n*Math.cos(-r*s),u=t+n*Math.cos(-i*s);a=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(i-r>180),0,u,e+n*Math.sin(-i*s)]]}else a=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return a}function qt(t){if(!(t=zt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,i=0,a=0,s=0,o=t.length,u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],i=n,a=r,s++,e[0]=["M",n,r]);for(var l=function(s){var o=void 0,l=t[s],p=l[0];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=+l[6]+n,o[7]=+l[7]+r;break;case"V":o[1]=+l[1]+r;break;case"H":o[1]=+l[1]+n;break;case"R":for(var c=[n,r].concat(l.slice(1)),h=2,f=c.length;h0&&(o=Math.max(o,Math.ceil(n/e)));for(var u=0;ue;)i=Gt(r,i,.5),t.splice(n+1,0,i)}function le(t,e){var n,r;if("string"==typeof t){var i=te(t,e);t=i.ring,r=i.skipBisect}else if(!Array.isArray(t))throw new TypeError("Invalid path value");if(!pe(n=t.slice(0)))throw new TypeError("Invalid path value");return n.length>1&&Jt(n[0],n[n.length-1])&&n.pop(),se(n)>0&&n.reverse(),!r&&e&&$t(e)&&e>0&&ue(n,e),n}function pe(t){return t.every((function(t){return Array.isArray(t)&&t.length>=2&&$t(t[0])&&$t(t[1])}))}function ce(t,e,n){var r=le(t,n=n||f.morphPrecision),i=le(e,n),a=r.length-i.length;return oe(r,a<0?-1*a:0),oe(i,a>0?a:0),ie(r,i),[r,i]}var he={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof Element?e:/^\.|^\#/.test(e)?V(e):null,i=new RegExp("\\n","ig");return"object"==typeof e&&e.pathArray?e:(r&&/path|glyph/.test(r.tagName)?n.original=r.getAttribute("d").replace(i,""):!r&&/[a-z][^a-z]*/gi.test(e)&&(n.original=e.replace(i,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var i=e.pathArray,a=n.pathArray,s=a.length;t.setAttribute("d",1===r?n.original:"M"+Lt(i,a,s,r).join("L")+"Z")})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].pathArray,n=this.valuesEnd[t].pathArray;if(!e||!n||e&&n&&e.length!==n.length){var r=ce(this.valuesStart[t].original,this.valuesEnd[t].original,this._morphPrecision?parseInt(this._morphPrecision):f.morphPrecision);this.valuesStart[t].pathArray=r[0],this.valuesEnd[t].pathArray=r[1]}}}},fe={component:"svgMorph",property:"path",defaultValue:[],Interpolate:Lt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:he,Util:{INVALID_INPUT:"Invalid path value",isFiniteNumber:$t,distance:Wt,pointAlong:Gt,samePoint:Jt,pathToAbsolute:qt,pathToString:Kt,pathStringToRing:te,exactRing:ee,approximateRing:ne,measure:re,rotateRing:ie,polygonLength:ae,polygonArea:se,addPoints:oe,bisect:ue,normalizeRing:le,validRing:pe,getInterpolationPoints:ce}};for(var de in x.SVGMorph=fe,x){var ve=x[de];x[de]=new F(ve)}return{Animation:F,Components:x,Tween:H,fromTo:function(t,e,n,r){return r=r||{},new P.tween(V(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new P.tween(V(t),e,e,n)},TweenCollection:j,allFromTo:function(t,e,n,r){return r=r||{},new j(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new j(V(t,!0),e,e,n)},Objects:b,Util:w,Easing:L,CubicBezier:O,Render:l,Interpolate:r,Process:k,Internals:T,Selector:V,Version:"2.0.13"}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).KUTE=e()}(this,(function(){"use strict";var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},i={},a={};a.now=self.performance.now.bind(self.performance);var s=0,o=function(t){for(var n=0;n(n=1))return n;for(;ei?e=r:n=r,r=.5*(n-e)+e}return r};var L={},P={linear:new O(0,0,1,1,"linear"),easingSinusoidalIn:new O(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new O(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new O(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new O(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new O(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new O(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new O(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new O(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new O(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new O(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new O(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new O(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new O(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new O(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new O(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new O(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new O(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new O(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new O(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new O(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new O(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new O(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new O(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new O(.68,-.55,.265,1.55,"easingBackInOut")};function V(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}function U(){for(var t in i)if("function"==typeof i[t])i[t].call(this,t);else for(var e in i[t])i[t][e].call(this,e);C.call(this)}L.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof P[t])return P[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new O(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),P.linear};var N=function(e,n,r,a){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,a=a||{},this._resetStart=a.resetStart||0,this._easing="function"==typeof a.easing?a.easing:L.processEasing(a.easing),this._duration=a.duration||f.duration,this._delay=a.delay||f.delay,a){var o="_"+s;o in this||(this[o]=a[s])}var u=this._easing.name;return i[u]||(i[u]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};N.prototype.start=function(e){return _(this),this.playing=!0,this._startTime=void 0!==e?e:t.Time(),this._startTime+=this._delay,this._startFired||(this._onStart&&this._onStart.call(this),U.call(this),this._startFired=!0),!s&&o(),this},N.prototype.stop=function(){return this.playing&&(T(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},N.prototype.close=function(){for(var t in y)for(var e in y[t])y[t][e].call(this,e);this._startFired=!1,u.call(this)},N.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},N.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},N.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},L.tween=N,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var H=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],i=t[2];if(A.call(this,i,"end"),this._resetStart?this.valuesStart=r:A.call(this,r,"start"),!this._resetStart)for(var a in g)for(var s in g[a])g[a][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||f.repeat,this._repeatDelay=o.repeatDelay||f.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||f.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,M.call(this),g)for(var r in g[n])g[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var i in this.valuesEnd)this.valuesRepeat[i]=this.valuesStart[i];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),U.call(this),this._startTime+=t.Time()-this._pauseTime,_(this),!s&&o()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(T(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(N);L.tween=H;var j=function(t,e,n,r){var i=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var a=[];return Array.from(t).map((function(t,s){a[s]=r||{},a[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?i.tweens.push(new L.tween(t,e,n,a[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};j.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},j.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},j.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},j.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},j.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof j)e.chain(t.tweens);else{if(!(t instanceof L.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},j.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},j.prototype.removeTweens=function(){this.tweens=[]},j.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var F=function(t){try{t.component in c?console.error("KUTE.js - "+t.component+" already registered"):t.property in h?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};function R(t,e){for(var n,r=parseInt(t)||0,i=["px","%","deg","rad","em","rem","vh","vw"],a=0;a.99||i<.01?(10*D(n,r,i)>>0)/10:D(n,r,i)>>0)+"px"})}F.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:v,prepareStart:d,onStart:i,onComplete:y,crossCheck:g},a=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(c[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)h[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var u in t.defaultValues)h[u]=t.defaultValues[u];this.supports=(o||s)+" "+(s||a)+" properties"}if(t.defaultOptions)for(var l in t.defaultOptions)f[l]=t.defaultOptions[l];if(t.functions)for(var p in n)if(p in t.functions)if("function"==typeof t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][a||s]&&(n[p][e][a||s]=t.functions[p]);else for(var b in t.functions[p])!n[p][e]&&(n[p][e]={}),!n[p][e][b]&&(n[p][e][b]=t.functions[p][b]);if(t.Interpolate){for(var x in t.Interpolate){var _=t.Interpolate[x];if("function"!=typeof _||r[x])for(var T in _)"function"!=typeof _[T]||r[x]||(r[x]=_[T]);else r[x]=_}m[e]=t.Interpolate}if(t.Util)for(var C in t.Util)!w[C]&&(w[C]=t.Util[C]);return this};var X=["top","left","width","height"],B={};X.map((function(t){return B[t]=Q}));var z={component:"essentialBoxModel",category:"boxModel",properties:X,defaultValues:{top:0,left:0,width:0,height:0},Interpolate:{numbers:D},functions:{prepareStart:function(t){return E(this.element,t)||h[t]},prepareProperty:function(t,e){var n=R(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:B},Util:{trueDimension:R}};function Z(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var i=document.getElementsByTagName("head")[0];i.style.color=t;var a=getComputedStyle(i,null).color;return a=/rgb/.test(a)?a.replace(/[^\d,]/g,"").split(","):[0,0,0],i.style.color="",{r:parseInt(a[0]),g:parseInt(a[1]),b:parseInt(a[2])}}}function Y(t,e,n){var r,i={};for(r in e)i[r]="a"!==r?D(t[r],e[r],n)>>0||0:t[r]&&e[r]?(100*D(t[r],e[r],n)>>0)/100:null;return i.a?"rgba("+i.r+","+i.g+","+i.b+","+i.a+")":"rgb("+i.r+","+i.g+","+i.b+")"}function q(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=Y(n,r,i)})}x.BoxModelEssential=z;var K=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],$={};K.map((function(t){$[t]="#000"}));var W={};K.map((function(t){return W[t]=q}));var G={component:"colorProperties",category:"colors",properties:K,defaultValues:$,Interpolate:{numbers:D,colors:Y},functions:{prepareStart:function(t,e){return E(this.element,t)||h[t]},prepareProperty:function(t,e){return Z(e)},onStart:W},Util:{trueColor:Z}};x.ColorProperties=G;var J={},tt=["fill","stroke","stop-color"];function et(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var nt={prepareStart:function(t,e){var n={};for(var r in e){var i=et(r).replace(/_+[a-z]+/,""),a=this.element.getAttribute(i);n[i]=tt.includes(i)?a||"rgba(0,0,0,0)":a||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var r in e){var a=et(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(a.replace(/_+[a-z]+/,""));if(tt.includes(a))i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,Y(n,r,i))})},n[a]=Z(e[r])||h.htmlAttributes[r];else if(null!==o&&s.test(o)){var u=R(o).u||R(e[r]).u,l=/%/.test(u)?"_percent":"_"+u;i.htmlAttributes[a+l]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){var a=e.replace(l,"");t.setAttribute(a,(1e3*D(n.v,r.v,i)>>0)/1e3+r.u)})},n[a+l]=R(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,(1e3*D(n,r,i)>>0)/1e3)})},n[a]=parseFloat(e[r]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,i){for(var a in r)t.attributes[a](e,a,n[a],r[a],i)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=J)}}},rt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:D,colors:Y},functions:nt,Util:{replaceUppercase:et,trueColor:Z,trueDimension:R}};x.HTMLAttributes=rt;var it={prepareStart:function(t){return E(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=(1e3*D(n,r,i)>>0)/1e3})}},at={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:D},functions:it};x.OpacityProperty=at;var st=String("abcdefghijklmnopqrstuvwxyz").split(""),ot=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),ut=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),lt=String("0123456789").split(""),pt=st.concat(ot,lt),ct=pt.concat(ut),ht={alpha:st,upper:ot,symbols:ut,numeric:lt,alphanumeric:pt,all:ct},ft={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ht?ht[n]:n&&n.length?n:ht[f.textChars];t[e]=function(t,e,n,i){var a="",s="",o=e.substring(0),u=n.substring(0),l=r[Math.random()*r.length>>0];" "===e?(s=u.substring(Math.min(i*u.length,u.length)>>0,0),t.innerHTML=i<1?s+l:""===n?" ":n):" "===n?(a=o.substring(0,Math.min((1-i)*o.length,o.length)>>0),t.innerHTML=i<1?a+l:""===n?" ":n):(a=o.substring(o.length,Math.min(i*o.length,o.length)>>0),s=u.substring(0,Math.min(i*u.length,u.length)>>0),t.innerHTML=i<1?s+l+a:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,r){t.innerHTML=D(e,n,r)>>0})}};function vt(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var i=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=i,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function dt(t,e){var n=[];if(t.children.length){for(var r,i=[],a=t.innerHTML,s=0,o=t.children.length,u=void 0,l=void 0,p=void 0;s>0)/1e3+n+")"}function mt(t,e,n,r){for(var i=[],a=0;a<3;a++)i[a]=(t[a]||e[a]?(1e3*(t[a]+(e[a]-t[a])*r)>>0)/1e3:0)+n;return"translate3d("+i.join(",")+")"}function bt(t,e,n,r){var i="";return i+=t[0]||e[0]?"rotateX("+(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3+n+")":"",i+=t[1]||e[1]?"rotateY("+(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3+n+")":"",i+=t[2]||e[2]?"rotateZ("+(1e3*(t[2]+(e[2]-t[2])*r)>>0)/1e3+n+")":""}function wt(t,e,n){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}function xt(t,e,n,r){var i=[];return i[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","skew("+i.join(",")+")"}x.TextWriteProperties=gt;var _t={component:"transformFunctions",property:"transform",subProperties:["perspective","translate3d","translateX","translateY","translateZ","translate","rotate3d","rotateX","rotateY","rotateZ","rotate","skewX","skewY","skew","scale"],defaultValues:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,translate:[0,0],rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,rotate:0,skewX:0,skewY:0,skew:[0,0],scale:1},functions:{prepareStart:function(t,e){var n=S(this.element);return n[t]?n[t]:h[t]},prepareProperty:function(t,e){var n=["X","Y","Z"],r={},i=[],a=[],s=[],o=["translate3d","translate","rotate3d","skew"];for(var u in e){var l="object"==typeof e[u]&&e[u].length?e[u].map((function(t){return parseInt(t)})):parseInt(e[u]);if(o.includes(u))r["translate"===u||"rotate"===u?u+"3d":u]="skew"===u?l.length?[l[0]||0,l[1]||0]:[l||0,0]:"translate"===u?l.length?[l[0]||0,l[1]||0,l[2]||0]:[l||0,0,0]:[l[0]||0,l[1]||0,l[2]||0];else if(/[XYZ]/.test(u)){for(var p=u.replace(/[XYZ]/,""),c="skew"===p?p:p+"3d",h="skew"===p?2:3,f="translate"===p?i:"rotate"===p?a:"skew"===p?s:{},v=0;v>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","translate("+i.join(",")+")"},rotate:function(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"},scale:wt,skew:xt}};function Tt(t,e){return parseFloat(t)/100*e}function Ct(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function It(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},i=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var a=0;a>0)/100,a=0-(100*D(e.s,n.s,r)>>0)/100,s=(100*D(e.e,n.e,r)>>0)/100+a;t.style.strokeDashoffset=a+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+i+"px"})}},Lt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:D},functions:Ot,Util:{getRectLength:Ct,getPolyLength:It,getLineLength:St,getCircleLength:Et,getEllipseLength:At,getTotalLength:Mt,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:kt,percent:Tt}};function Pt(t,e,n,r){for(var i=[],a=0;a>0)/1e3)}return i}x.SVGDraw=Lt;var Vt=3;function Ut(t){return t.map((function(t){return t.map((function(t,e){var n=+t,r=Math.pow(10,Vt);return e?n%1==0?n:(n*r>>0)/r:t}))}))}function Nt(t){return this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err="",this}var Ht={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function jt(t){var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;if("m"===n&&r.length>2&&(t.segments.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.segments.push([e].concat(r));else for(;r.length>=Ht[n]&&(t.segments.push([e].concat(r.splice(0,Ht[n]))),Ht[n]););}function Ft(t){var e=t.pathValue.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="Invalid path value")}function Rt(t){return t>=48&&t<=57}function Dt(t){var e,n=t.index,r=n,i=t.max,a=!1,s=!1,o=!1,u=!1;if(r>=i)t.err="Invalid path value";else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r=48&&t<=57||43===t||45===t||46===t}function Xt(t){for(;t.index=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0);)t.index++;var e}function Bt(t){var e,n,r,i,a=t.max;if(t.segmentStart=t.index,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}(e=t.pathValue.charCodeAt(t.index)))if(r=Ht[t.pathValue[t.index].toLowerCase()],t.index++,Xt(t),t.data=[],r){for(n=!1;;){for(i=r;i>0;i--){if(97!=(32|e)||3!==i&&4!==i?Dt(t):Ft(t),t.err.length)return;t.data.push(t.param),Xt(t),n=!1,t.index=t.max)break;if(!Qt(t.pathValue.charCodeAt(t.index)))break}}jt(t)}else jt(t);else t.err="Invalid path value"}function zt(t){if(Array.isArray(t)&&Array.isArray(t[0]))return function t(e){return e.map((function(e){return Array.isArray(e)?t(e):isNaN(+e)?e:+e}))}(t);var e=new Nt(t),n=e.max;for(Xt(e);e.indexr;r+=2){var a=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4==r?a[3]={x:+t[0],y:+t[1]}:i-2==r&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[i-2],y:+t[i-1]}:i-4==r?a[3]=a[2]:r||(a[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return n}function Yt(t,e,n,r,i){var a;if(null==i&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=i){var s=Math.PI/180,o=t+n*Math.cos(-r*s),u=t+n*Math.cos(-i*s);a=[["M",o,e+n*Math.sin(-r*s)],["A",n,n,0,+(i-r>180),0,u,e+n*Math.sin(-i*s)]]}else a=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return a}function qt(t){if(!(t=zt(t))||!t.length)return[["M",0,0]];var e=[],n=0,r=0,i=0,a=0,s=0,o=t.length,u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase();"M"===t[0][0]&&(n=+t[0][1],r=+t[0][2],i=n,a=r,s++,e[0]=["M",n,r]);for(var l=function(s){var o=[],l=t[s],p=l[0],c=[];if(e.push(o=[]),p!==p.toUpperCase())switch(o[0]=p.toUpperCase(),o[0]){case"A":o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=+l[6]+n,o[7]=+l[7]+r;break;case"V":o[1]=+l[1]+r;break;case"H":o[1]=+l[1]+n;break;case"R":for(var h=2,f=(c=[n,r].concat(l.slice(1))).length;h0&&(o=Math.max(o,Math.ceil(n/e)));for(var u=0;ue;)i=Gt(r,i,.5),t.splice(n+1,0,i)}function le(t,e){var n,r;if("string"==typeof t){var i=te(t,e);t=i.ring,r=i.skipBisect}else if(!Array.isArray(t))throw new TypeError("Invalid path value");if(!pe(n=t.slice(0)))throw new TypeError("Invalid path value");return n.length>1&&Jt(n[0],n[n.length-1])&&n.pop(),se(n)>0&&n.reverse(),!r&&e&&$t(e)&&e>0&&ue(n,e),n}function pe(t){return t.every((function(t){return Array.isArray(t)&&t.length>=2&&$t(t[0])&&$t(t[1])}))}function ce(t,e,n){var r=le(t,n=n||f.morphPrecision),i=le(e,n),a=r.length-i.length;return oe(r,a<0?-1*a:0),oe(i,a>0?a:0),ie(r,i),[r,i]}var he={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof Element?e:/^\.|^\#/.test(e)?V(e):null,i=new RegExp("\\n","ig");return"object"==typeof e&&e.pathArray?e:(r&&/path|glyph/.test(r.tagName)?n.original=r.getAttribute("d").replace(i,""):!r&&/[a-z][^a-z]*/gi.test(e)&&(n.original=e.replace(i,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var i=e.pathArray,a=n.pathArray,s=a.length;t.setAttribute("d",1===r?n.original:"M"+Pt(i,a,s,r).join("L")+"Z")})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].pathArray,n=this.valuesEnd[t].pathArray;if(!e||!n||e&&n&&e.length!==n.length){var r=ce(this.valuesStart[t].original,this.valuesEnd[t].original,this._morphPrecision?parseInt(this._morphPrecision):f.morphPrecision);this.valuesStart[t].pathArray=r[0],this.valuesEnd[t].pathArray=r[1]}}}},fe={component:"svgMorph",property:"path",defaultValue:[],Interpolate:Pt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:he,Util:{INVALID_INPUT:"Invalid path value",isFiniteNumber:$t,distance:Wt,pointAlong:Gt,samePoint:Jt,pathToAbsolute:qt,pathToString:Kt,pathStringToRing:te,exactRing:ee,approximateRing:ne,measure:re,rotateRing:ie,polygonLength:ae,polygonArea:se,addPoints:oe,bisect:ue,normalizeRing:le,validRing:pe,getInterpolationPoints:ce}};for(var ve in x.SVGMorph=fe,x){var de=x[ve];x[ve]=new F(de)}return{Animation:F,Components:x,Tween:H,fromTo:function(t,e,n,r){return r=r||{},new L.tween(V(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new L.tween(V(t),e,e,n)},TweenCollection:j,allFromTo:function(t,e,n,r){return r=r||{},new j(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new j(V(t,!0),e,e,n)},Objects:b,Util:w,Easing:P,CubicBezier:O,Render:l,Interpolate:r,Process:k,Internals:I,Selector:V,Version:"2.0.13"}})); diff --git a/package.json b/package.json index dbf8740..39cd3dc 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "help": "rollup --help", "build": "npm-run-all --parallel copy-build build-*", "custom": "rollup -c --environment", - "copy-build": "rollup -c --environment OUTPUTFILE:demo/src/kute.min.js,DIST:standard,MIN:true,FORMAT:umd -c", + "copy-build": "rollup --environment OUTPUTFILE:demo/src/kute.min.js,DIST:standard,MIN:true,FORMAT:umd -c", "build-standard": "rollup --environment DIST:standard,MIN:false,FORMAT:umd -c", "build-standard-min": "rollup --environment DIST:standard,MIN:true,FORMAT:umd -c", "build-standard-esm": "rollup --environment DIST:standard,MIN:false,FORMAT:esm -c", @@ -54,7 +54,7 @@ }, "homepage": "http://thednp.github.io/kute.js", "dependencies": { - "svg-path-commander": "^0.0.1-c", + "svg-path-commander": "^0.0.2", "cubic-bezier-easing": "^1.0.2", "minifill": "^0.0.13", "shorter-js": "^0.1.4" @@ -62,10 +62,10 @@ "devDependencies": { "@rollup/plugin-buble": "^0.21.3", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^7.1.3", + "@rollup/plugin-node-resolve": "^9.0.0", "npm-run-all": "^4.1.5", - "rollup": "^1.32.1", + "rollup": "^2.26.3", "rollup-plugin-cleanup": "^3.1.1", - "rollup-plugin-terser": "^5.3.0" + "rollup-plugin-terser": "^7.0.0" } } diff --git a/rollup.config.js b/rollup.config.js index dcd35aa..5513648 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -32,16 +32,16 @@ const OUTPUT = { } const PLUGINS = [ - node({mainFields: ['jsnext', 'module']}), + node({mainFields: ['jsnext','module'], dedupe: ['svg-path-commander']}) , json(), buble(), + cleanup() ] if (MIN){ PLUGINS.push(terser({output: {preamble: miniBanner}})); } else { OUTPUT.banner = banner; - PLUGINS.push(cleanup()); } if (FORMAT!=='esm') { diff --git a/src/animation/animation.js b/src/animation/animation.js index 9c06074..abec4bd 100644 --- a/src/animation/animation.js +++ b/src/animation/animation.js @@ -89,14 +89,14 @@ export default class Animation { // set component interpolate if (Component.Interpolate) { - for (const fn in Component.Interpolate) { - const compIntObj = Component.Interpolate[fn] - if ( typeof(compIntObj) === 'function' && !Interpolate[fn] ) { - Interpolate[fn] = compIntObj; + for (const fni in Component.Interpolate) { + const compIntObj = Component.Interpolate[fni] + if ( typeof(compIntObj) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj; } else { for ( const sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn] ) { - Interpolate[fn] = compIntObj[sfn]; + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj[sfn]; } } } @@ -106,8 +106,8 @@ export default class Animation { // set component util if (Component.Util) { - for (const fn in Component.Util){ - !Util[fn] && (Util[fn] = Component.Util[fn]) + for (const fnu in Component.Util){ + !Util[fnu] && (Util[fnu] = Component.Util[fnu]) } } diff --git a/src/animation/animationBase.js b/src/animation/animationBase.js index 925331a..fa7ba92 100644 --- a/src/animation/animationBase.js +++ b/src/animation/animationBase.js @@ -49,14 +49,14 @@ export default class AnimationBase { // set interpolate if (Component.Interpolate) { - for (const fn in Component.Interpolate) { - const compIntObj = Component.Interpolate[fn] - if ( typeof(compIntObj) === 'function' && !Interpolate[fn] ) { - Interpolate[fn] = compIntObj; + for (const fni in Component.Interpolate) { + const compIntObj = Component.Interpolate[fni] + if ( typeof(compIntObj) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj; } else { for ( const sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn] ) { - Interpolate[fn] = compIntObj[sfn]; + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { + Interpolate[fni] = compIntObj[sfn]; } } } @@ -66,8 +66,8 @@ export default class AnimationBase { // set component util if (Component.Util) { - for (const fn in Component.Util){ - !Util[fn] && (Util[fn] = Component.Util[fn]) + for (const fnu in Component.Util){ + !Util[fnu] && (Util[fnu] = Component.Util[fnu]) } } diff --git a/src/animation/animationDevelopment.js b/src/animation/animationDevelopment.js index 0791114..1cc2ed4 100644 --- a/src/animation/animationDevelopment.js +++ b/src/animation/animationDevelopment.js @@ -49,15 +49,15 @@ export default class AnimationDevelopment extends Animation { propertyInfo.interface = [] propertyInfo.render = [] propertyInfo.warning = [] - for (const fn in Functions) { - if (fn in Component.functions) { - fn === 'prepareProperty' ? propertyInfo.interface.push(`fromTo()`) : 0 - fn === 'prepareStart' ? propertyInfo.interface.push(`to()`) : 0 - fn === 'onStart' ? propertyInfo.render = `can render update` : 0 + for (const fnf in Functions) { + if (fnf in Component.functions) { + fnf === 'prepareProperty' ? propertyInfo.interface.push(`fromTo()`) : 0 + fnf === 'prepareStart' ? propertyInfo.interface.push(`to()`) : 0 + fnf === 'onStart' ? propertyInfo.render = `can render update` : 0 } else { - fn === 'prepareProperty' ? propertyInfo.warning.push(`fromTo()`) : 0 - fn === 'prepareStart' ? propertyInfo.warning.push(`to()`) : 0 - fn === 'onStart' ? propertyInfo.render = `no function to render update` : 0 + fnf === 'prepareProperty' ? propertyInfo.warning.push(`fromTo()`) : 0 + fnf === 'prepareStart' ? propertyInfo.warning.push(`to()`) : 0 + fnf === 'onStart' ? propertyInfo.render = `no function to render update` : 0 } } propertyInfo.interface.length ? propertyInfo.interface = `${Category||Property} can use [${propertyInfo.interface.join(', ')}] method(s)` : delete propertyInfo.uses @@ -69,17 +69,17 @@ export default class AnimationDevelopment extends Animation { propertyInfo.uses = [] propertyInfo.adds = [] - for (const fn in Component.Interpolate) { - const compIntObj = Component.Interpolate[fn] + for (let fni in Component.Interpolate) { + let compIntObj = Component.Interpolate[fni] // register new Interpolation functions if ( typeof(compIntObj) === 'function' ) { - if ( !Interpolate[fn] ) { - propertyInfo.adds.push(`${fn}`) + if ( !Interpolate[fni] ) { + propertyInfo.adds.push(`${fni}`) } - propertyInfo.uses.push(`${fn}`) + propertyInfo.uses.push(`${fni}`) } else { - for ( const sfn in compIntObj ) { - if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fn] ) { + for ( let sfn in compIntObj ) { + if ( typeof(compIntObj[sfn]) === 'function' && !Interpolate[fni] ) { propertyInfo.adds.push(`${sfn}`) } propertyInfo.uses.push(`${sfn}`) diff --git a/src/components/svgCubicMorph.js b/src/components/svgCubicMorph.js index b394618..3fa3e5a 100644 --- a/src/components/svgCubicMorph.js +++ b/src/components/svgCubicMorph.js @@ -13,9 +13,9 @@ import reverseCurve from 'svg-path-commander/src/process/reverseCurve.js' // const SVGMorph = { property : 'path', defaultValue: [], interpolators: {numbers} }, functions = { prepareStart, prepareProperty, onStart, crossCheck } // Component Util -function createPath (path) { // create a when glyph - const np = document.createElementNS('http://www.w3.org/2000/svg','path'), - d = path instanceof SVGElement ? path.getAttribute('d') : path +function createPath(path) { // create a when glyph + let np = document.createElementNS('http://www.w3.org/2000/svg','path'), + d = path instanceof SVGElement ? path.getAttribute('d') : path np.setAttribute('d',d); return np } @@ -103,9 +103,9 @@ function crossCheckCubicMorph(tweenProp){ if ( !pathCurve1 || !pathCurve2 || ( pathCurve1 && pathCurve2 && pathCurve1[0][0] === 'M' && pathCurve1.length !== pathCurve2.length) ) { let path1 = this.valuesStart[tweenProp].original, path2 = this.valuesEnd[tweenProp].original, - curves = pathToCurve(path1,path2) - - let curve0 = this._reverseFirstPath ? reverseCurve(curves[0]) : curves[0], + curves = pathToCurve(path1,path2), + + curve0 = this._reverseFirstPath ? reverseCurve(curves[0]) : curves[0], curve1 = this._reverseSecondPath ? reverseCurve(curves[1]) : curves[1] curve0 = getRotatedCurve.call(this,curve0,curve1) diff --git a/src/components/svgCubicMorphBase.js b/src/components/svgCubicMorphBase.js index 3da255c..a192466 100644 --- a/src/components/svgCubicMorphBase.js +++ b/src/components/svgCubicMorphBase.js @@ -5,13 +5,10 @@ import pathToString from 'svg-path-commander/src/convert/pathToString.js' // const SVGMorph = { property : 'path', defaultValue: [], interpolators: {numbers} }, functions = { prepareStart, prepareProperty, onStart, crossCheck } - // Component Functions export function onStartCubicMorph(tweenProp){ if (!KUTE[tweenProp] && this.valuesEnd[tweenProp]) { KUTE[tweenProp] = function(elem,a,b,v){ - // v === 1 && console.log(a.curve,b.curve) - let curve = [], path1 = a.curve, path2 = b.curve; for(let i=0, l=path2.length; iparseInt(v)) : parseInt(obj[x]); if (arrayFunctions.includes(x)) { @@ -42,7 +42,7 @@ function prepareTransform(prop,obj){ : fn === 'rotate' ? rotateArray : fn === 'skew' ? skewArray : {} for (let fnIndex = 0; fnIndex < fnLen; fnIndex++) { - const fnAxis = prepAxis[fnIndex]; + let fnAxis = prepAxis[fnIndex]; fnArray[fnIndex] = (`${fn}${fnAxis}` in obj) ? parseInt(obj[`${fn}${fnAxis}`]) : 0; } transformObject[fnId] = fnArray; diff --git a/src/components/transformLegacy.js b/src/components/transformLegacy.js index c51b867..6e4faa6 100644 --- a/src/components/transformLegacy.js +++ b/src/components/transformLegacy.js @@ -30,8 +30,8 @@ function prepareLegacyTransform(prop,obj){ transformObject = {}, arrayFunctions = ['translate3d','translate','rotate3d','skew'] - for (const x in obj) { - const pv = typeof(obj[x]) === 'object' && obj[x].length ? obj[x].map(v=>parseInt(v)) : parseInt(obj[x]) + for (let x in obj) { + let pv = typeof(obj[x]) === 'object' && obj[x].length ? obj[x].map(v=>parseInt(v)) : parseInt(obj[x]) if (arrayFunctions.includes(x)) { diff --git a/src/components/transformMatrix.js b/src/components/transformMatrix.js index 3d04a2a..82faaac 100644 --- a/src/components/transformMatrix.js +++ b/src/components/transformMatrix.js @@ -27,7 +27,8 @@ function getTransform(tweenProp, value){ } function prepareTransform(tweenProp,value){ if ( typeof(value) === 'object' && !value.length) { - let transformObject = {}, + let pv, + transformObject = {}, translate3dObj = {}, rotate3dObj = {}, scale3dObj = {}, @@ -36,7 +37,7 @@ function prepareTransform(tweenProp,value){ for (const prop in value) { if ( /3d/.test(prop) && typeof(value[prop]) === 'object' && value[prop].length ){ - let pv = value[prop].map( (v) => prop === 'scale3d' ? parseFloat(v) : parseInt(v) ) + pv = value[prop].map( (v) => prop === 'scale3d' ? parseFloat(v) : parseInt(v) ) transformObject[prop] = prop === 'scale3d' ? [pv[0]||1, pv[1]||1, pv[2]||1] : [pv[0]||0, pv[1]||0, pv[2]||0] } else if ( /[XYZ]/.test(prop) ) { let obj = /translate/.test(prop) ? translate3dObj @@ -46,7 +47,7 @@ function prepareTransform(tweenProp,value){ let idx = prop.replace(/translate|rotate|scale|skew/,'').toLowerCase() obj[idx] = /scale/.test(prop) ? parseFloat(value[prop]) : parseInt(value[prop]) } else if ('skew' === prop ) { - let pv = value[prop].map(v => parseInt(v)||0) + pv = value[prop].map(v => parseInt(v)||0) transformObject[prop] = [pv[0]||0, pv[1]||0] } else { // perspective transformObject[prop] = parseInt(value[prop]); @@ -54,8 +55,7 @@ function prepareTransform(tweenProp,value){ } axis.map((o) => { - const tp = Object.keys(o)[0] - const tv = o[tp] + let tp = Object.keys(o)[0], tv = o[tp] if ( Object.keys(tv).length && !transformObject[tp]) { transformObject[tp] = tp === 'scale3d' ? [tv.x || 1, tv.y || 1, tv.z || 1] : tp === 'skew' ? [tv.x || 0, tv.y || 0] diff --git a/src/tween/tweenExtra.js b/src/tween/tweenExtra.js index 7cae999..7b7c8f7 100644 --- a/src/tween/tweenExtra.js +++ b/src/tween/tweenExtra.js @@ -36,8 +36,8 @@ export default class TweenExtra extends Tween { } } // set options accepting [repeat,yoyo,delay,repeatDelay,easing] - option(option,value) { - this[`_${option}`] = value + option(o,v) { + this[`_${o}`] = v } }