popmotion
Advanced tools
Comparing version 9.0.0-rc.12 to 9.0.0-rc.13
@@ -6,16 +6,22 @@ import { __assign, __spreadArrays, __rest } from 'tslib'; | ||
var SpringAnimator = /*#__PURE__*/function () { | ||
function SpringAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
this.createSpring(); | ||
} | ||
SpringAnimator.prototype.createSpring = function () { | ||
var _a = this.options, | ||
velocity = _a.velocity, | ||
from = _a.from, | ||
to = _a.to, | ||
damping = _a.damping, | ||
stiffness = _a.stiffness, | ||
mass = _a.mass; | ||
function spring(_a) { | ||
var _b = _a.from, | ||
from = _b === void 0 ? 0.0 : _b, | ||
_c = _a.to, | ||
to = _c === void 0 ? 0.0 : _c, | ||
_d = _a.velocity, | ||
velocity = _d === void 0 ? 0.0 : _d, | ||
_e = _a.stiffness, | ||
stiffness = _e === void 0 ? 100 : _e, | ||
_f = _a.damping, | ||
damping = _f === void 0 ? 10 : _f, | ||
_g = _a.mass, | ||
mass = _g === void 0 ? 1.0 : _g, | ||
_h = _a.restSpeed, | ||
restSpeed = _h === void 0 ? 2 : _h, | ||
restDelta = _a.restDelta; | ||
var state = { done: false, value: from }; | ||
var resolveSpring = zero; | ||
var resolveVelocity = zero; | ||
function createSpring() { | ||
var initialVelocity = velocity ? -(velocity / 1000) : 0.0; | ||
@@ -25,4 +31,5 @@ var initialDelta = to - from; | ||
var angularFreq = Math.sqrt(stiffness / mass) / 1000; | ||
restDelta !== null && restDelta !== void 0 ? restDelta : restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4; | ||
if (dampingRatio < 1) { | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -32,3 +39,3 @@ var expoDecay = angularFreq * Math.sqrt(1.0 - dampingRatio * dampingRatio); | ||
}; | ||
this.resolveVelocity = function (t) { | ||
resolveVelocity = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -39,78 +46,39 @@ var expoDecay = angularFreq * Math.sqrt(1.0 - dampingRatio * dampingRatio); | ||
} else if (dampingRatio === 1) { | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-angularFreq * t); | ||
return to - envelope * (initialDelta + (initialVelocity + angularFreq * initialDelta) * t); | ||
}; | ||
this.resolveVelocity = function () { | ||
return 0; | ||
}; | ||
} else { | ||
var dampedAngularFreq_1 = angularFreq * Math.sqrt(dampingRatio * dampingRatio - 1); | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
return to - envelope * ((initialVelocity + dampingRatio * angularFreq * initialDelta) * Math.sinh(dampedAngularFreq_1 * t) + dampedAngularFreq_1 * initialDelta * Math.cosh(dampedAngularFreq_1 * t)) / dampedAngularFreq_1; | ||
}; | ||
this.resolveVelocity = function () { | ||
return 0; | ||
}; | ||
} | ||
}; | ||
SpringAnimator.prototype.update = function (t) { | ||
var _a = this.options, | ||
restSpeed = _a.restSpeed, | ||
restDelta = _a.restDelta, | ||
to = _a.to; | ||
var latest = this.resolveSpring(t); | ||
var velocity = this.resolveVelocity(t) * 1000; | ||
var isBelowVelocityThreshold = Math.abs(velocity) <= restSpeed; | ||
var isBelowDisplacementThreshold = Math.abs(to - latest) <= restDelta; | ||
this.isComplete = isBelowVelocityThreshold && isBelowDisplacementThreshold; | ||
return this.isComplete ? to : latest; | ||
}; | ||
SpringAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, | ||
from = _b === void 0 ? 0.0 : _b, | ||
_c = _a.to, | ||
to = _c === void 0 ? 0.0 : _c, | ||
_d = _a.velocity, | ||
velocity = _d === void 0 ? 0.0 : _d, | ||
_e = _a.stiffness, | ||
stiffness = _e === void 0 ? 100 : _e, | ||
_f = _a.damping, | ||
damping = _f === void 0 ? 10 : _f, | ||
_g = _a.mass, | ||
mass = _g === void 0 ? 1.0 : _g, | ||
_h = _a.restSpeed, | ||
restSpeed = _h === void 0 ? 2 : _h, | ||
restDelta = _a.restDelta; | ||
if (restDelta === undefined) { | ||
restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4; | ||
} | ||
createSpring(); | ||
return { | ||
next: function (t) { | ||
var current = resolveSpring(t); | ||
var velocity = resolveVelocity(t) * 1000; | ||
var isBelowVelocityThreshold = Math.abs(velocity) <= restSpeed; | ||
var isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta; | ||
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold; | ||
state.value = state.done ? to : current; | ||
return state; | ||
}, | ||
flipTarget: function () { | ||
var _a; | ||
velocity = -velocity; | ||
_a = [to, from], from = _a[0], to = _a[1]; | ||
createSpring(); | ||
} | ||
this.options = { | ||
from: from, | ||
to: to, | ||
velocity: velocity, | ||
stiffness: stiffness, | ||
damping: damping, | ||
mass: mass, | ||
restSpeed: restSpeed, | ||
restDelta: restDelta | ||
}; | ||
}; | ||
SpringAnimator.prototype.flipTarget = function () { | ||
var _a = this.options, | ||
from = _a.from, | ||
to = _a.to, | ||
velocity = _a.velocity; | ||
this.options.velocity = -velocity; | ||
this.options.from = to; | ||
this.options.to = from; | ||
this.createSpring(); | ||
}; | ||
SpringAnimator.needsInterpolation = function (from, to) { | ||
return typeof from === "string" || typeof to === "string"; | ||
}; | ||
SpringAnimator.uniqueOptionKeys = /*#__PURE__*/new Set(["velocity", "stiffness", "damping", "mass", "restSpeed", "restDelta"]); | ||
return SpringAnimator; | ||
}(); | ||
} | ||
spring.needsInterpolation = function (a, b) { | ||
return typeof a === "string" || typeof b === "string"; | ||
}; | ||
var zero = function (_t) { | ||
return 0; | ||
}; | ||
@@ -417,123 +385,75 @@ var progress = function (from, to, value) { | ||
} | ||
var KeyframesAnimator = /*#__PURE__*/function () { | ||
function KeyframesAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
var _a = this.options, | ||
from = _a.from, | ||
to = _a.to; | ||
this.values = Array.isArray(to) ? to : [from, to]; | ||
this.createInterpolator(); | ||
function keyframes(_a) { | ||
var _b = _a.from, | ||
from = _b === void 0 ? 0 : _b, | ||
_c = _a.to, | ||
to = _c === void 0 ? 1 : _c, | ||
ease = _a.ease, | ||
offset = _a.offset, | ||
_d = _a.duration, | ||
duration = _d === void 0 ? 300 : _d; | ||
var state = { done: false, value: from }; | ||
var values = Array.isArray(to) ? to : [from, to]; | ||
var times = convertOffsetToTimes(offset !== null && offset !== void 0 ? offset : defaultOffset(values), duration); | ||
function createInterpolator() { | ||
return interpolate(times, values, { | ||
ease: Array.isArray(ease) ? ease : defaultEasing(values, ease) | ||
}); | ||
} | ||
KeyframesAnimator.prototype.createInterpolator = function () { | ||
var _a = this.options, | ||
duration = _a.duration, | ||
ease = _a.ease, | ||
offset = _a.offset; | ||
ease = Array.isArray(ease) ? ease : defaultEasing(this.values, ease); | ||
offset = offset || defaultOffset(this.values); | ||
var times = convertOffsetToTimes(offset, duration); | ||
this.interpolator = interpolate(times, this.values, { ease: ease }); | ||
var interpolator = createInterpolator(); | ||
return { | ||
next: function (t) { | ||
state.value = interpolator(t); | ||
state.done = t >= duration; | ||
return state; | ||
}, | ||
flipTarget: function () { | ||
values.reverse(); | ||
interpolator = createInterpolator(); | ||
} | ||
}; | ||
KeyframesAnimator.prototype.update = function (t) { | ||
var duration = this.options.duration; | ||
this.isComplete = t >= duration; | ||
return this.interpolator(t); | ||
}; | ||
KeyframesAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, | ||
from = _b === void 0 ? 0 : _b, | ||
_c = _a.to, | ||
to = _c === void 0 ? 1 : _c, | ||
ease = _a.ease, | ||
offset = _a.offset, | ||
_d = _a.duration, | ||
duration = _d === void 0 ? 300 : _d; | ||
this.options = { from: from, to: to, ease: ease, offset: offset, duration: duration }; | ||
}; | ||
KeyframesAnimator.prototype.flipTarget = function () { | ||
this.values.reverse(); | ||
this.createInterpolator(); | ||
}; | ||
KeyframesAnimator.needsInterpolation = function () { | ||
return false; | ||
}; | ||
KeyframesAnimator.uniqueOptionKeys = /*#__PURE__*/new Set(["duration", "ease"]); | ||
return KeyframesAnimator; | ||
}(); | ||
} | ||
var DecayAnimator = /*#__PURE__*/function () { | ||
function DecayAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
var _a = this.options, | ||
power = _a.power, | ||
velocity = _a.velocity, | ||
modifyTarget = _a.modifyTarget, | ||
from = _a.from; | ||
var amplitude = power * velocity; | ||
var idealTarget = from + amplitude; | ||
var target = typeof modifyTarget === "undefined" ? idealTarget : modifyTarget(idealTarget); | ||
if (target !== idealTarget) amplitude = target - from; | ||
this.target = target; | ||
this.amplitude = amplitude; | ||
} | ||
DecayAnimator.prototype.flipTarget = function () {}; | ||
DecayAnimator.prototype.update = function (t) { | ||
var _a = this.options, | ||
timeConstant = _a.timeConstant, | ||
restDelta = _a.restDelta; | ||
var delta = -this.amplitude * Math.exp(-t / timeConstant); | ||
this.isComplete = !(delta > restDelta || delta < -restDelta); | ||
return this.isComplete ? this.target : this.target + delta; | ||
function decay(_a) { | ||
var _b = _a.velocity, | ||
velocity = _b === void 0 ? 0 : _b, | ||
_c = _a.from, | ||
from = _c === void 0 ? 0 : _c, | ||
_d = _a.power, | ||
power = _d === void 0 ? 0.8 : _d, | ||
_e = _a.timeConstant, | ||
timeConstant = _e === void 0 ? 350 : _e, | ||
_f = _a.restDelta, | ||
restDelta = _f === void 0 ? 0.5 : _f, | ||
modifyTarget = _a.modifyTarget; | ||
var state = { done: false, value: from }; | ||
var amplitude = power * velocity; | ||
var ideal = from + amplitude; | ||
var target = modifyTarget === undefined ? ideal : modifyTarget(ideal); | ||
if (target !== ideal) amplitude = target - from; | ||
return { | ||
next: function (t) { | ||
var delta = -amplitude * Math.exp(-t / timeConstant); | ||
state.done = !(delta > restDelta || delta < -restDelta); | ||
state.value = state.done ? target : target + delta; | ||
return state; | ||
}, | ||
flipTarget: function () {} | ||
}; | ||
DecayAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a === void 0 ? {} : _a, | ||
_c = _b.velocity, | ||
velocity = _c === void 0 ? 0 : _c, | ||
_d = _b.from, | ||
from = _d === void 0 ? 0 : _d, | ||
_e = _b.power, | ||
power = _e === void 0 ? 0.8 : _e, | ||
_f = _b.timeConstant, | ||
timeConstant = _f === void 0 ? 350 : _f, | ||
_g = _b.restDelta, | ||
restDelta = _g === void 0 ? 0.5 : _g, | ||
modifyTarget = _b.modifyTarget; | ||
this.options = { | ||
velocity: velocity, | ||
from: from, | ||
power: power, | ||
timeConstant: timeConstant, | ||
restDelta: restDelta, | ||
modifyTarget: modifyTarget | ||
}; | ||
}; | ||
DecayAnimator.needsInterpolation = function () { | ||
return false; | ||
}; | ||
DecayAnimator.uniqueOptionKeys = /*#__PURE__*/new Set(["power", "timeConstant", "modifyTarget"]); | ||
return DecayAnimator; | ||
}(); | ||
} | ||
var animators = [KeyframesAnimator, DecayAnimator, SpringAnimator]; | ||
var types = { | ||
keyframes: KeyframesAnimator, | ||
spring: SpringAnimator, | ||
decay: DecayAnimator | ||
}; | ||
var numAnimators = animators.length; | ||
var types = { keyframes: keyframes, spring: spring, decay: decay }; | ||
function detectAnimationFromOptions(config) { | ||
if (Array.isArray(config.to)) { | ||
return KeyframesAnimator; | ||
return keyframes; | ||
} else if (types[config.type]) { | ||
return types[config.type]; | ||
} | ||
for (var key in config) { | ||
for (var i = 0; i < numAnimators; i++) { | ||
var animator = animators[i]; | ||
if (animator.uniqueOptionKeys.has(key)) return animator; | ||
} | ||
var keys = new Set(Object.keys(config)); | ||
if (keys.has("ease") || keys.has("duration")) { | ||
return keyframes; | ||
} else if (keys.has("stiffness") || keys.has("mass") || keys.has("damping") || keys.has("restSpeed") || keys.has("restDelta")) { | ||
return spring; | ||
} | ||
return KeyframesAnimator; | ||
return keyframes; | ||
} | ||
@@ -575,15 +495,16 @@ | ||
function animate(_a) { | ||
var _b, _c; | ||
var from = _a.from, | ||
_b = _a.autoplay, | ||
autoplay = _b === void 0 ? true : _b, | ||
_c = _a.driver, | ||
driver = _c === void 0 ? framesync : _c, | ||
_d = _a.elapsed, | ||
elapsed = _d === void 0 ? 0 : _d, | ||
_e = _a.repeat, | ||
repeatMax = _e === void 0 ? 0 : _e, | ||
_f = _a.repeatType, | ||
repeatType = _f === void 0 ? "loop" : _f, | ||
_g = _a.repeatDelay, | ||
repeatDelay = _g === void 0 ? 0 : _g, | ||
_d = _a.autoplay, | ||
autoplay = _d === void 0 ? true : _d, | ||
_e = _a.driver, | ||
driver = _e === void 0 ? framesync : _e, | ||
_f = _a.elapsed, | ||
elapsed = _f === void 0 ? 0 : _f, | ||
_g = _a.repeat, | ||
repeatMax = _g === void 0 ? 0 : _g, | ||
_h = _a.repeatType, | ||
repeatType = _h === void 0 ? "loop" : _h, | ||
_j = _a.repeatDelay, | ||
repeatDelay = _j === void 0 ? 0 : _j, | ||
onPlay = _a.onPlay, | ||
@@ -603,4 +524,4 @@ onStop = _a.onStop, | ||
var interpolateFromNumber; | ||
var Animator = detectAnimationFromOptions(options); | ||
if (Animator.needsInterpolation(from, to)) { | ||
var animator = detectAnimationFromOptions(options); | ||
if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) { | ||
interpolateFromNumber = interpolate([0, 100], [from, to], { | ||
@@ -612,3 +533,3 @@ clamp: false | ||
} | ||
var animation = new Animator(__assign(__assign({}, options), { from: from, to: to })); | ||
var animation = animator(__assign(__assign({}, options), { from: from, to: to })); | ||
function repeat() { | ||
@@ -624,3 +545,2 @@ repeatCount++; | ||
isComplete = false; | ||
animation.isComplete = false; | ||
onRepeat && onRepeat(); | ||
@@ -636,11 +556,10 @@ } | ||
if (!isComplete) { | ||
latest = animation.update(Math.max(0, elapsed)); | ||
var state = animation.next(Math.max(0, elapsed)); | ||
latest = state.value; | ||
if (interpolateFromNumber) latest = interpolateFromNumber(latest); | ||
isComplete = isForwardPlayback ? animation.isComplete : elapsed <= 0; | ||
isComplete = isForwardPlayback ? state.done : elapsed <= 0; | ||
} | ||
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest); | ||
if (isComplete) { | ||
if (repeatCount === 0 && computedDuration === undefined) { | ||
computedDuration = elapsed; | ||
} | ||
if (repeatCount === 0) computedDuration !== null && computedDuration !== void 0 ? computedDuration : computedDuration = elapsed; | ||
if (repeatCount < repeatMax) { | ||
@@ -660,7 +579,2 @@ hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat(); | ||
return { | ||
play: play, | ||
pause: function () {}, | ||
resume: function () {}, | ||
reverse: function () {}, | ||
seek: function () {}, | ||
stop: function () { | ||
@@ -729,6 +643,6 @@ onStop === null || onStop === void 0 ? void 0 : onStop(); | ||
prev_1 = current_1; | ||
current_1 = v; | ||
velocity = velocityPerSecond(v - prev_1, getFrameData().delta); | ||
current_1 = v; | ||
if (!(boundary_1 - v * heading_1 > 0)) { | ||
startSpring({ from: current_1, to: boundary_1, velocity: velocity }); | ||
if (heading_1 === 1 && v > boundary_1 || heading_1 === -1 && v < boundary_1) { | ||
startSpring({ from: v, to: boundary_1, velocity: velocity }); | ||
} | ||
@@ -983,2 +897,2 @@ }; | ||
export { DecayAnimator, KeyframesAnimator, SpringAnimator, angle, animate, anticipate, applyOffset, attract, attractExpo, backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, clamp, createAnticipate, createAttractor, createBackIn, createExpoIn, cubicBezier, degreesToRadians, distance, easeIn, easeInOut, easeOut, inertia, interpolate, isPoint, isPoint3D, linear, mirrorEasing, mix, mixColor, mixComplex, pipe, pointFromVector, progress, radiansToDegrees, reverseEasing, smooth, smoothFrame, snap, steps, toDecimal, velocityPerFrame, velocityPerSecond, wrap }; | ||
export { angle, animate, anticipate, applyOffset, attract, attractExpo, backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, clamp, createAnticipate, createAttractor, createBackIn, createExpoIn, cubicBezier, decay, degreesToRadians, distance, easeIn, easeInOut, easeOut, inertia, interpolate, isPoint, isPoint3D, keyframes, linear, mirrorEasing, mix, mixColor, mixComplex, pipe, pointFromVector, progress, radiansToDegrees, reverseEasing, smooth, smoothFrame, snap, spring, steps, toDecimal, velocityPerFrame, velocityPerSecond, wrap }; |
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).popmotion={})}(this,function(t){"use strict";var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function r(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var A=function(){return(A=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)};function b(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e}function i(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),o=0;for(r=0;r<e;r++)for(var i=arguments[r],u=0,a=i.length;u<a;u++,o++)n[o]=i[u];return n}function e(r,e){return function(t){return Math.max(Math.min(t,e),r)}}function p(t){return t%1?Number(t.toFixed(5)):t}function o(r){return{test:function(t){return"string"==typeof t&&t.endsWith(r)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+r}}}function u(t){return void 0!==t.red}function a(t){return void 0!==t.hue}function s(i){return function(t){if("string"!=typeof t)return t;for(var r,e={},n=(r=t).substring(r.indexOf("(")+1,r.lastIndexOf(")")).split(/,\s*/),o=0;o<4;o++)e[i[o]]=void 0!==n[o]?parseFloat(n[o]):1;return e}}var c=/(-)?(\d[\d\.]*)/g,f=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,d=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,l={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},v=A(A({},l),{transform:e(0,1)}),h=A(A({},l),{default:1}),m=o("deg"),g=o("%"),y=o("px"),w=o("vh"),O=o("vw"),M=A(A({},g),{parse:function(t){return g.parse(t)/100},transform:function(t){return g.transform(100*t)}}),x=e(0,255),S=A(A({},l),{transform:function(t){return Math.round(x(t))}});function k(t,r){return t.startsWith(r)&&d.test(t)}function C(t){return"number"==typeof t?0:t}function P(t){return rt=t}function R(t){return it[t].process(nt)}function T(r){return function(t){return 1-r(1-t)}}function V(r){return function(t){return t<=.5?r(2*t)/2:(2-r(2*(1-t)))/2}}function j(r){return function(t){return Math.pow(t,r)}}function _(r){return function(t){return t*t*((r+1)*t-r)}}function E(t){var r=_(t);return function(t){return(t*=2)<1?.5*r(t):.5*(2-Math.pow(2,-10*(t-1)))}}function D(t){return t}function F(t){return 1-Math.sin(Math.acos(t))}function X(t){var r=t*t;return t<4/11?7.5625*r:t<8/11?9.075*r-9.9*t+3.4:t<.9?4356/361*r-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72}function Y(t,r){return 1-3*r+3*t}function L(t,r){return 3*r-6*t}function I(t){return 3*t}function z(t,r,e){return 3*Y(r,e)*t*t+2*L(r,e)*t+I(r)}function W(t,r,e){return((Y(r,e)*t+L(r,e))*t+I(r))*t}var B={test:function(t){return"string"==typeof t?k(t,"rgb"):u(t)},parse:s(["red","green","blue","alpha"]),transform:function(t){var r,e,n,o,i,u=t.red,a=t.green,s=t.blue,c=t.alpha,f=void 0===c?1:c;return r={red:S.transform(u),green:S.transform(a),blue:S.transform(s),alpha:p(v.transform(f))},e=r.red,n=r.green,o=r.blue,i=r.alpha,"rgba("+e+", "+n+", "+o+", "+(void 0===i?1:i)+")"}},q={test:function(t){return"string"==typeof t?k(t,"hsl"):a(t)},parse:s(["hue","saturation","lightness","alpha"]),transform:function(t){var r,e,n,o,i,u=t.hue,a=t.saturation,s=t.lightness,c=t.alpha,f=void 0===c?1:c;return r={hue:Math.round(u),saturation:g.transform(p(a)),lightness:g.transform(p(s)),alpha:p(v.transform(f))},e=r.hue,n=r.saturation,o=r.lightness,i=r.alpha,"hsla("+e+", "+n+", "+o+", "+(void 0===i?1:i)+")"}},N=A(A({},B),{test:function(t){return"string"==typeof t&&k(t,"#")},parse:function(t){var r="",e="",n="";return 4<t.length?(r=t.substr(1,2),e=t.substr(3,2),n=t.substr(5,2)):(r=t.substr(1,1),e=t.substr(2,1),n=t.substr(3,1),r+=r,e+=e,n+=n),{red:parseInt(r,16),green:parseInt(e,16),blue:parseInt(n,16),alpha:1}}}),U={test:function(t){return"string"==typeof t&&d.test(t)||u(t)||a(t)},parse:function(t){return B.test(t)?B.parse(t):q.test(t)?q.parse(t):N.test(t)?N.parse(t):t},transform:function(t){return u(t)?B.transform(t):a(t)?q.transform(t):t}},Z="${c}",H="${n}",$={test:function(t){if("string"!=typeof t||!isNaN(t))return!1;var r=0,e=t.match(c),n=t.match(f);return e&&(r+=e.length),n&&(r+=n.length),0<r},parse:function(t){var r=t,e=[],n=r.match(f);n&&(r=r.replace(f,Z),e.push.apply(e,n.map(U.parse)));var o=r.match(c);return o&&e.push.apply(e,o.map(l.parse)),e},createTransformer:function(t){var n=t,o=0,r=t.match(f),i=r?r.length:0;if(r)for(var e=0;e<i;e++)n=n.replace(r[e],Z),o++;var u=n.match(c),a=u?u.length:0;if(u)for(e=0;e<a;e++)n=n.replace(u[e],H),o++;return function(t){for(var r=n,e=0;e<o;e++)r=r.replace(e<i?Z:H,e<i?U.transform(t[e]):p(t[e]));return r}},getAnimatableNone:function(t){var r=$.parse(t);return $.createTransformer(t)(r.map(C))}},G=Object.freeze({__proto__:null,alpha:v,color:U,complex:$,degrees:m,hex:N,hsla:q,number:l,percent:g,progressPercentage:M,px:y,rgbUnit:S,rgba:B,scale:h,vh:w,vw:O}),K=0,J="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var r=Date.now(),e=Math.max(0,16.7-(r-K));K=r+e,setTimeout(function(){return t(K)},e)},Q=1/60*1e3,tt=!0,rt=!1,et=!1,nt={delta:0,timestamp:0},ot=["read","update","render","postRender"],it=ot.reduce(function(t,r){var n,i,u,a,s,o,c,f,p;return t[r]=(n=P,i=[],s=!(u=[]),o=a=0,c=new WeakSet,f=new WeakSet,p={cancel:function(t){var r=u.indexOf(t);c.add(t),-1!==r&&u.splice(r,1)},process:function(t){var r,e;if(s=!0,i=(r=[u,i])[0],(u=r[1]).length=0,a=i.length)for(o=0;o<a;o++)(e=i[o])(t),!0!==f.has(e)||c.has(e)||(p.schedule(e),n(!0));s=!1},schedule:function(t,r,e){void 0===r&&(r=!1),void 0===e&&(e=!1);var n=e&&s,o=n?i:u;c.delete(t),r&&f.add(t),-1===o.indexOf(t)&&(o.push(t),n&&(a=i.length))}}),t},{}),ut=ot.reduce(function(t,r){var n=it[r];return t[r]=function(t,r,e){return void 0===r&&(r=!1),void 0===e&&(e=!1),rt||st(),n.schedule(t,r,e),t},t},{}),at=function(t){rt=!1,nt.delta=tt?Q:Math.max(Math.min(t-nt.timestamp,40),1),tt||(Q=nt.delta),nt.timestamp=t,et=!0,ot.forEach(R),et=!1,rt&&(tt=!1,J(at))},st=function(){tt=rt=!0,et||J(at)},ct=T,ft=V,pt=j(2),dt=T(pt),lt=V(pt),vt=T(F),ht=V(vt),mt=_(1.525),gt=T(mt),yt=V(mt),bt=E(1.525),wt="undefined"!=typeof Float32Array;function Ot(t){return"number"==typeof t}function Mt(t){return 180*t/Math.PI}function xt(t,r){return void 0===r&&(r=Ft),Mt(Math.atan2(r.y-t.y,r.x-t.x))}function At(r,e){var n=!0;return void 0===e&&(e=r,n=!1),function(t){return n?t-r+e:(r=t,n=!0,e)}}function St(n){return function(r,e,t){return void 0!==t?n(r,e,t):function(t){return n(r,e,t)}}}function kt(t){return t*Math.PI/180}function Ct(t){return t.hasOwnProperty("x")&&t.hasOwnProperty("y")}function Pt(t){return Ct(t)&&t.hasOwnProperty("z")}function Rt(t,r){return Math.abs(t-r)}function Tt(t,r){if(void 0===r&&(r=Ft),Ot(t)&&Ot(r))return Rt(t,r);if(Ct(t)&&Ct(r)){var e=Rt(t.x,r.x),n=Rt(t.y,r.y),o=Pt(t)&&Pt(r)?Rt(t.z,r.z):0;return Math.sqrt(Math.pow(e,2)+Math.pow(n,2)+Math.pow(o,2))}return 0}function Vt(t,r,e){return-e*t+e*r+t}function jt(t,r,e){var n=t*t,o=r*r;return Math.sqrt(Math.max(0,e*(o-n)+n))}function _t(r){return It.find(function(t){return t.test(r)})}function Et(r,e){return function(t){return e(r(t))}}var Dt=Object.freeze({__proto__:null,reversed:T,mirrored:V,createReversedEasing:ct,createMirroredEasing:ft,createExpoIn:j,createBackIn:_,createAnticipateEasing:E,linear:D,easeIn:pt,easeOut:dt,easeInOut:lt,circIn:F,circOut:vt,circInOut:ht,backIn:mt,backOut:gt,backInOut:yt,anticipate:bt,bounceOut:X,bounceIn:function(t){return 1-X(1-t)},bounceInOut:function(t){return t<.5?.5*(1-X(1-2*t)):.5*X(2*t-1)+.5},cubicBezier:function(u,r,a,e){function n(t){for(var r,e,n,o=0,i=1;10!==i&&s[i]<=t;++i)o+=.1;return r=(t-s[--i])/(s[i+1]-s[i]),.001<=(n=z(e=o+.1*r,u,a))?function(t,r){for(var e=0,n=0;e<8;++e){if(0===(n=z(r,u,a)))return r;r-=(W(r,u,a)-t)/n}return r}(t,e):0===n?e:function(t,r,e){for(var n,o,i=0;0<(n=W(o=r+(e-r)/2,u,a)-t)?e=o:r=o,1e-7<Math.abs(n)&&++i<10;);return o}(t,o,o+.1)}var s=new(wt?Float32Array:Array)(11);return function(){for(var t=0;t<11;++t)s[t]=W(.1*t,u,a)}(),function(t){return u===r&&a===e?t:0===t?0:1===t?1:W(n(t),r,e)}}}),Ft={x:0,y:0,z:0},Xt=St(function(t,r,e){return Math.min(Math.max(e,t),r)}),Yt=function(t,r,e){var n=r-t;return 0==n?1:(e-t)/n},Lt=function(){return(Lt=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},It=[N,B,q],zt=function(t,r){var e=_t(t),n=_t(r);e.transform,n.transform;var o=e.parse(t),i=n.parse(r),u=Lt({},o),a=e===q?Vt:jt;return function(t){for(var r in u)"alpha"!==r&&(u[r]=a(o[r],i[r],t));return u.alpha=Vt(o.alpha,i.alpha,t),e.transform(u)}},Wt=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.reduce(Et)};function Bt(r,e){return Ot(r)?function(t){return Vt(r,e,t)}:(U.test(r)?zt:Zt)(r,e)}var qt=function(t,e){var n=t.slice(),o=n.length,i=t.map(function(t,r){return Bt(t,e[r])});return function(t){for(var r=0;r<o;r++)n[r]=i[r](t);return n}},Nt=function(t,r){var e=Lt({},t,r),n={};for(var o in e)void 0!==t[o]&&void 0!==r[o]&&(n[o]=Bt(t[o],r[o]));return function(t){for(var r in n)e[r]=n[r](t);return e}};function Ut(t){for(var r=$.parse(t),e=r.length,n=0,o=0,i=0,u=0;u<e;u++)n||"number"==typeof r[u]?n++:void 0!==r[u].hue?i++:o++;return{parsed:r,numNumbers:n,numRGB:o,numHSL:i}}var Zt=function(t,r){var e=$.createTransformer(r),n=Ut(t),o=Ut(r);return Wt(qt(n.parsed,o.parsed),e)},Ht=function(r,e){return function(t){return Vt(r,e,t)}};function $t(t,r,e){for(var n,o=[],i=e||("number"==typeof(n=t[0])?Ht:"string"==typeof n?U.test(n)?zt:Zt:Array.isArray(n)?qt:"object"==typeof n?Nt:void 0),u=t.length-1,a=0;a<u;a++){var s=i(t[a],t[a+1]);if(r){var c=Array.isArray(r)?r[a]:r;s=Wt(c,s)}o.push(s)}return o}function Gt(t,r,e,n){return void 0===n&&(n=0),o=t+e*(r-t)/Math.max(n,e),void 0===i&&(i=2),i=Math.pow(10,i),Math.round(o*i)/i;var o,i}function Kt(t){return t}function Jt(i){return void 0===i&&(i=Kt),St(function(t,r,e){var n=r-e,o=-(0-t+1)*(0-i(Math.abs(n)));return n<=0?r+o:r-o})}function Qt(t,r){return Ot(t)?t/(1e3/r):0}function tr(t,r){return r?t*(1e3/r):0}var rr=Jt(),er=Jt(Math.sqrt),nr=St(function(t,r,e){var n=r-t;return((e-t)%n+n)%n+t}),or=(Xt(0,1),ir.prototype.applyMiddleware=function(t){return this.create(A(A({},this.props),{middleware:this.props.middleware?i([t],this.props.middleware):[t]}))},ir.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e=1===t.length?t[0]:Wt.apply(void 0,t);return this.applyMiddleware(function(r){return function(t){return r(e(t))}})},ir.prototype.while=function(n){return this.applyMiddleware(function(r,e){return function(t){return n(t)?r(t):e()}})},ir.prototype.filter=function(e){return this.applyMiddleware(function(r){return function(t){return e(t)&&r(t)}})},ir);function ir(t){void 0===t&&(t={}),this.props=t}function ur(t,r,e){var n=r.middleware;return new sr({middleware:n,onComplete:e},"function"==typeof t?{update:t}:t)}var ar,sr=function(t,r){var e=this,n=t.middleware,o=t.onComplete;this.isActive=!0,this.update=function(t){e.observer.update&&e.updateObserver(t)},this.complete=function(){e.observer.complete&&e.isActive&&e.observer.complete(),e.onComplete&&e.onComplete(),e.isActive=!1},this.error=function(t){e.observer.error&&e.isActive&&e.observer.error(t),e.isActive=!1},this.observer=r,this.updateObserver=function(t){return r.update(t)},this.onComplete=o,r.update&&n&&n.length&&n.forEach(function(t){return e.updateObserver=t(e.updateObserver,e.complete)})},cr=(r(fr,ar=or),fr.prototype.create=function(t){return new fr(t)},fr.prototype.start=function(t){void 0===t&&(t={});var r=!1,e={stop:function(){}},n=this.props,o=n.init,i=b(n,["init"]),u=o(ur(t,i,function(){r=!0,e.stop()}));return e=u?A(A({},e),u):e,t.registerParent&&t.registerParent(e),r&&e.stop(),e},fr);function fr(){return null!==ar&&ar.apply(this,arguments)||this}function pr(t){return new cr({init:t})}var dr,lr=(r(vr,dr=or),vr.prototype.complete=function(){this.subscribers.forEach(function(t){return t.complete()})},vr.prototype.error=function(r){this.subscribers.forEach(function(t){return t.error(r)})},vr.prototype.update=function(t){for(var r=0;r<this.subscribers.length;r++)this.subscribers[r].update(t)},vr.prototype.subscribe=function(t){var r=this,e=ur(t,this.props);return this.subscribers.push(e),{unsubscribe:function(){var t=r.subscribers.indexOf(e);-1!==t&&r.subscribers.splice(t,1)}}},vr.prototype.stop=function(){this.parent&&this.parent.stop()},vr.prototype.registerParent=function(t){this.stop(),this.parent=t},vr);function vr(){var t=null!==dr&&dr.apply(this,arguments)||this;return t.subscribers=[],t}var hr,mr=(r(gr,hr=lr),gr.prototype.create=function(t){return new gr(t)},gr);function gr(){return null!==hr&&hr.apply(this,arguments)||this}var yr,br,wr=0,Or="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var r=Date.now(),e=Math.max(0,16.7-(r-wr));wr=r+e,setTimeout(function(){return t(wr)},e)};(br=yr=yr||{}).Read="read",br.Update="update",br.Render="render",br.PostRender="postRender",br.FixedUpdate="fixedUpdate";function Mr(t){return Rr=t}function xr(t){return Er[t].process(Vr)}function Ar(){return Vr}function Sr(t,r){var e=1/(t-1),n=1/(2*(t-1)),o=Math.min(r,1)/n;return Math.floor((1+o)/2)*e}var kr,Cr=1/60*1e3,Pr=!0,Rr=!1,Tr=!1,Vr={delta:0,timestamp:0},jr=[yr.Read,yr.Update,yr.Render,yr.PostRender],_r=jr.reduce(function(t,r){var n,i,u,a,s,o,c,f,p,d=(n=Mr,i=[],s=!(u=[]),o=a=0,c=new WeakSet,f=new WeakSet,p={cancel:function(t){var r=u.indexOf(t);c.add(t),-1!==r&&u.splice(r,1)},process:function(t){var r,e;if(s=!0,i=(r=[u,i])[0],(u=r[1]).length=0,a=i.length)for(o=0;o<a;o++)(e=i[o])(t),!0!==f.has(e)||c.has(e)||(p.schedule(e),n(!0));s=!1},schedule:function(t,r,e){void 0===r&&(r=!1),void 0===e&&(e=!1);var n=e&&s,o=n?i:u;c.delete(t),r&&f.add(t),-1===o.indexOf(t)&&(o.push(t),n&&(a=i.length))}});return t.sync[r]=function(t,r,e){return void 0===r&&(r=!1),void 0===e&&(e=!1),Rr||Yr(),d.schedule(t,r,e),t},t.cancelSync[r]=function(t){return d.cancel(t)},t.steps[r]=d,t},{steps:{},sync:{},cancelSync:{}}),Er=_r.steps,Dr=_r.sync,Fr=_r.cancelSync,Xr=function(t){Rr=!1,Vr.delta=Pr?Cr:Math.max(Math.min(t-Vr.timestamp,40),1),Pr||(Cr=Vr.delta),Vr.timestamp=t,Tr=!0,jr.forEach(xr),Tr=!1,Rr&&(Pr=!1,Or(Xr))},Yr=function(){Pr=Rr=!0,Tr||Or(Xr)},Lr=Object.freeze({__proto__:null,angle:xt,degreesToRadians:kt,distance:Tt,isPoint3D:Pt,isPoint:Ct,dilate:Vt,getValueFromProgress:Vt,pointFromAngleAndDistance:function(t,r,e){return r=kt(r),{x:e*Math.cos(r)+t.x,y:e*Math.sin(r)+t.y}},getProgressFromValue:Yt,radiansToDegrees:Mt,smooth:Gt,speedPerFrame:Qt,speedPerSecond:tr,stepProgress:Sr}),Ir=(r(zr,kr=lr),zr.prototype.create=function(t){return new zr(t)},zr.prototype.get=function(){return this.current},zr.prototype.getVelocity=function(){return this.getVelocityOfCurrent()},zr.prototype.update=function(t){kr.prototype.update.call(this,t),this.prev=this.current,this.updateCurrent(t);var r=Ar(),e=r.delta,n=r.timestamp;this.timeDelta=e,this.lastUpdated=n,Dr.postRender(this.scheduleVelocityCheck)},zr.prototype.subscribe=function(t){var r=kr.prototype.subscribe.call(this,t);return this.subscribers[this.subscribers.length-1].update(this.current),r},zr.prototype.getSingleVelocity=function(t,r){return"number"==typeof t&&"number"==typeof r?tr(t-r,this.timeDelta):tr(parseFloat(t)-parseFloat(r),this.timeDelta)||0},zr.prototype.getListVelocity=function(){var e=this;return this.current.map(function(t,r){return e.getSingleVelocity(t,e.prev[r])})},zr.prototype.getMapVelocity=function(){var t={};for(var r in this.current)this.current.hasOwnProperty(r)&&(t[r]=this.getSingleVelocity(this.current[r],this.prev[r]));return t},zr);function zr(t){var r,e,n,o=kr.call(this,t)||this;return o.scheduleVelocityCheck=function(){return Dr.postRender(o.velocityCheck)},o.velocityCheck=function(t){t.timestamp!==o.lastUpdated&&(o.prev=o.current)},o.prev=o.current=t.value||0,e=o.current,"string"==(n=typeof e)||"number"==n?(o.updateCurrent=function(t){return o.current=t},o.getVelocityOfCurrent=function(){return o.getSingleVelocity(o.current,o.prev)}):(r=o.current,Array.isArray(r)?(o.updateCurrent=function(t){return o.current=i(t)},o.getVelocityOfCurrent=function(){return o.getListVelocity()}):(o.updateCurrent=function(t){for(var r in o.current={},t)t.hasOwnProperty(r)&&(o.current[r]=t[r])},o.getVelocityOfCurrent=function(){return o.getMapVelocity()})),t.initialSubscription&&o.subscribe(t.initialSubscription),o}function Wr(t){var f=t.getCount,p=t.getFirst,d=t.getOutput,l=t.mapApi,v=t.setProp,h=t.startActions;return function(c){return pr(function(t){function n(){return r(a)}var r=t.update,o=t.complete,i=t.error,u=f(c),a=d(),s=0,e=h(c,function(t,r){var e=!1;return t.start({complete:function(){e||(e=!0,++s===u&&Dr.update(o))},error:i,update:function(t){v(a,r,t),Dr.update(n,!1,!0)}})});return Object.keys(p(e)).reduce(function(t,r){return t[r]=l(e,r),t},{})})}}function Br(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return se(t)}function qr(e){function n(t,r){return void 0!==t&&!e[r](t)}var t=Object.keys(e);return{getVectorKeys:function(e){return t.reduce(function(t,r){return n(e[r],r)&&t.push(r),t},[])},testVectorProps:function(r){return r&&t.some(function(t){return n(r[t],t)})}}}function Nr(r){return ce.find(function(t){return t.test(r)})}function Ur(t,r){return t(r)}function Zr(o,i,u){var t=u[0],r=i[t].map(function(t,r){var e,n=u.reduce((e=r,function(t,r){return t[r]=t[r][e],t}),A({},i));return de(t)(o,n)});return Br.apply(void 0,r)}function Hr(o,i,u){var a=u[0],t=Object.keys(i[a]).reduce(function(t,r){var e,n=u.reduce((e=r,function(t,r){return t[r]=t[r][e],t}),A({},i));return t[r]=de(i[a][r])(o,n),t},{});return ae(t)}function $r(t,r){var e=r.from,n=r.to,o=b(r,["from","to"]),i=Nr(e)||Nr(n),u=i.transform,a=i.parse;return t(A(A({},o),{from:"string"==typeof e?a(e):e,to:"string"==typeof n?a(n):n})).pipe(u)}function Gr(i){return function(t,r){var e=r.from,n=r.to,o=b(r,["from","to"]);return t(A(A({},o),{from:0,to:1})).pipe(i(e,n))}}function Kr(n,t){var r=qr(t),o=r.testVectorProps,i=r.getVectorKeys;return function(t){if(!o(t))return n(t);var r=i(t),e=t[r[0]];return de(e)(n,t,r)}}function Jr(b){return void 0===b&&(b={}),pr(function(t){var o=t.complete,i=t.update,r=b.velocity,e=void 0===r?0:r,n=b.from,u=void 0===n?0:n,a=b.power,s=void 0===a?.8:a,c=b.timeConstant,f=void 0===c?350:c,p=b.restDelta,d=void 0===p?.5:p,l=b.modifyTarget,v=0,h=s*e,m=u+h,g=void 0===l?m:l(m);g!==m&&(h=g-u);var y=Dr.update(function(t){var r=t.delta;v+=r;var e=-h*Math.exp(-v/f),n=d<e||e<-d;i(n?g+e:g),n||(Fr.update(y),o())},!0);return{stop:function(){return Fr.update(y)}}})}function Qr(S){return void 0===S&&(S={}),pr(function(t){var s=t.update,c=t.complete,r=S.velocity,f=void 0===r?0:r,e=S.from,n=void 0===e?0:e,o=S.to,p=void 0===o?0:o,i=S.stiffness,d=void 0===i?100:i,u=S.damping,l=void 0===u?10:u,a=S.mass,v=void 0===a?1:a,h=S.restSpeed,m=void 0===h?.01:h,g=S.restDelta,y=void 0===g?.01:g,b=f?-f/1e3:0,w=0,O=p-n,M=n,x=M,A=Dr.update(function(t){var r=t.delta;w+=r;var e=l/(2*Math.sqrt(d*v)),n=Math.sqrt(d/v)/1e3;if(x=M,e<1){var o=Math.exp(-e*n*w),i=n*Math.sqrt(1-e*e);M=p-o*((b+e*n*O)/i*Math.sin(i*w)+O*Math.cos(i*w))}else{o=Math.exp(-n*w);M=p-o*(O+(b+n*O)*w)}f=tr(M-x,r);var u=Math.abs(f)<=m,a=Math.abs(p-M)<=y;u&&a?(s(M=p),Fr.update(A),c()):s(M)},!0);return{stop:function(){return Fr.update(A)}}})}function te(D){return void 0===D&&(D={}),pr(function(t){function n(t){var r;void 0===t&&(t=!1),j=me({from:O=(r=[x,O])[0],to:x=r[1],ease:p,reverseEase:t}).start(u)}function o(){_=ge(Yt(0,c,S)),j.seek(_)}function r(){E=!0,i=Dr.update(function(t){var r,e=t.delta;S+=e,o(),!(r=E&&c+b<S)||(!r||h||l||g)&&(S=c-(S-b),h&&V<h?(V++,!0):l&&C<l?(C++,n(),!0):g&&R<g&&(n(++R%2!=0),!0))||(Fr.update(i),a&&Dr.update(a,!1,!0))},!0)}function e(){E=!1,i&&Fr.update(i)}var i,u=t.update,a=t.complete,s=D.duration,c=void 0===s?300:s,f=D.ease,p=void 0===f?dt:f,d=D.flip,l=void 0===d?0:d,v=D.loop,h=void 0===v?0:v,m=D.yoyo,g=void 0===m?0:m,y=D.repeatDelay,b=void 0===y?0:y,w=D.from,O=void 0===w?0:w,M=D.to,x=void 0===M?1:M,A=D.elapsed,S=void 0===A?0:A,k=D.flipCount,C=void 0===k?0:k,P=D.yoyoCount,R=void 0===P?0:P,T=D.loopCount,V=void 0===T?0:T,j=me({from:O,to:x,ease:p}).start(u),_=0,E=!1;return r(),{isActive:function(){return E},getElapsed:function(){return Xt(0,c,S)},getProgress:function(){return _},stop:function(){e()},pause:function(){return e(),this},resume:function(){return E||r(),this},seek:function(t){return S=Vt(0,c,t),Dr.update(o,!1,!0),this},reverse:function(){return n(),this}}})}function re(t){var r,e,n,o,i=t.easings,u=t.ease,a=void 0===u?D:u,s=t.times,c=t.values,f=b(t,["easings","ease","times","values"]);i=Array.isArray(i)?i:(e=i,(r=c).map(function(){return e||dt}).splice(0,r.length-1)),s=s||(o=(n=c).length,n.map(function(t,r){return 0!==r?r/(o-1):0}));var p=i.map(function(t,r){return me({from:c[r],to:c[r+1],ease:t})});return te(A(A({},f),{ease:a})).applyMiddleware(function(t){return r=p,e=t,o=(n=s).length,u=(i=o-1)-1,a=r.map(function(t){return t.start(e)}),function(t){t<=n[0]&&a[0].seek(0),t>=n[i]&&a[u].seek(1);for(var r=1;r<o&&!(n[r]>t||r===i);r++);var e=Yt(n[r-1],n[r],t);a[r-1].seek(ye(e))};var n,r,e,o,i,u,a})}function ee(t,r){var e,n,o,i,u,a,s;return Array.isArray(r)?t.push.apply(t,(n=[],o=(e=r)[e.length-1],u=(i="number"==typeof o)?o:0,a=i?e.slice(0,-1):e,s=a.length,a.forEach(function(t,r){if(n.push(t),r!==s-1){var e=t.duration||300;n.push(""+(u-e))}}),n)):t.push(r),t}function ne(t,r,e){var n=t.duration,o=t.easings,i=t.times,u=t.values,a=u.length,s=i[a-1],c=0===r.at?0:r.at/n,f=(r.at+r.duration)/n;if(0===e)u.push(r.from),i.push(c);else if(s!==c){void 0!==r.from&&(u.push(u[a-1]),i.push(c),o.push(D));var p=void 0!==r.from?r.from:u[a-1];u.push(p),i.push(c),o.push(D)}else void 0!==r.from&&(u.push(r.from),i.push(c),o.push(D));return u.push(r.to),i.push(f),o.push(r.ease||lt),t}function oe(n,o,i){return pr(function(t){var r=t.update,e=o.split(" ").map(function(t){return n.addEventListener(t,r,i),t});return{stop:function(){return e.forEach(function(t){return n.removeEventListener(t,r,i)})}}})}function ie(){return{clientX:0,clientY:0,pageX:0,pageY:0,x:0,y:0}}function ue(t,r){return void 0===r&&(r=ie()),r.clientX=r.x=t.clientX,r.clientY=r.y=t.clientY,r.pageX=t.pageX,r.pageY=t.pageY,r}var ae=Wr({getOutput:function(){return{}},getCount:function(t){return Object.keys(t).length},getFirst:function(t){return t[Object.keys(t)[0]]},mapApi:function(o,i){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return Object.keys(o).reduce(function(t,r){var e;return o[r][i]&&(n[0]&&void 0!==n[0][r]?t[r]=o[r][i](n[0][r]):t[r]=(e=o[r])[i].apply(e,n)),t},{})}},setProp:function(t,r,e){return t[r]=e},startActions:function(e,n){return Object.keys(e).reduce(function(t,r){return t[r]=n(e[r],r),t},{})}}),se=Wr({getOutput:function(){return[]},getCount:function(t){return t.length},getFirst:function(t){return t[0]},mapApi:function(r,n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.map(function(t,r){if(t[n])return Array.isArray(e[0])?t[n](e[0][r]):t[n].apply(t,e)})}},setProp:function(t,r,e){return t[r]=e},startActions:function(t,e){return t.map(function(t,r){return e(t,r)})}}),ce=[y,g,m,w,O],fe=Gr(zt),pe=Gr(Zt),de=function(t){return"number"==typeof t?Ur:Array.isArray(t)?Zr:Boolean(Nr(t))?$r:U.test(t)?fe:$.test(t)?pe:"object"==typeof t?Hr:Ur},le=Kr(Jr,{from:l.test,modifyTarget:function(t){return"function"==typeof t},velocity:l.test}),ve=Kr(Qr,{from:l.test,to:l.test,stiffness:l.test,damping:l.test,mass:l.test,velocity:l.test}),he=Kr(function(t){var r=t.from,v=void 0===r?0:r,e=t.velocity,h=void 0===e?0:e,m=t.min,g=t.max,n=t.power,y=void 0===n?.8:n,o=t.timeConstant,b=void 0===o?700:o,i=t.bounceStiffness,w=void 0===i?500:i,u=t.bounceDamping,O=void 0===u?10:u,a=t.restDelta,M=void 0===a?1:a,x=t.modifyTarget;return pr(function(t){function r(t){return void 0!==m&&t<m||void 0!==g&&g<t}function e(t){return Math.abs(m-t)<Math.abs(g-t)?m:g}function n(t,r){i&&i.stop(),i=t.start({update:u,complete:function(){(r||a)()}})}function o(t){n(Qr(A(A({},t),{stiffness:w,damping:O,restDelta:M})))}var i,u=t.update,a=t.complete,s=v;if(r(v))o({from:v,velocity:h,to:e(v)});else{var c=y*h+v;void 0!==x&&(c=x(c),x=void 0,h=(c-v)/y);var f=Jr({from:v,velocity:h,timeConstant:b,power:y,restDelta:M,modifyTarget:x}),p=void 0;if(r(c)){var d=e(c),l=d==m?-1:1;f=f.while(function(t){return h=tr(t-s,Ar().delta),0<d-(s=t)*l}),p=function(){return o({from:s,to:d,velocity:h})}}n(f,p)}return{stop:function(){return i&&i.stop()}}})},{from:l.test,velocity:l.test,min:l.test,max:l.test,damping:l.test,stiffness:l.test,modifyTarget:function(t){return"function"==typeof t}}),me=Kr(function(t){var r=t.from,e=void 0===r?0:r,n=t.to,o=void 0===n?1:n,i=t.ease,u=void 0===i?D:i,a=t.reverseEase;return void 0!==a&&a&&(u=ct(u)),pr(function(t){var r=t.update;return{seek:function(t){return r(t)}}}).pipe(u,function(t){return Vt(e,o,t)})},{ease:function(t){return"function"==typeof t},from:l.test,to:l.test}),ge=Xt(0,1),ye=Xt(0,1),be=Kr(function(m){return void 0===m&&(m={}),pr(function(t){var n=t.complete,o=t.update,r=m.acceleration,i=void 0===r?0:r,e=m.friction,u=void 0===e?0:e,a=m.velocity,s=void 0===a?0:a,c=m.springStrength,f=m.to,p=m.restSpeed,d=void 0===p?.001:p,l=m.from,v=void 0===l?0:l,h=Dr.update(function(t){var r=t.delta,e=Math.max(r,16);i&&(s+=Qt(i,e)),u&&(s*=Math.pow(1-u,e/100)),void 0!==c&&void 0!==f&&(s+=(f-v)*Qt(c,e));v+=Qt(s,e),o(v),!1!==d&&(!s||Math.abs(s)<=d)&&(Fr.update(h),n())},!0);return{set:function(t){return v=t,this},setAcceleration:function(t){return i=t,this},setFriction:function(t){return u=t,this},setSpringStrength:function(t){return c=t,this},setSpringTarget:function(t){return f=t,this},setVelocity:function(t){return s=t,this},stop:function(){return Fr.update(h)}}})},{acceleration:l.test,friction:l.test,velocity:l.test,from:l.test,to:l.test,springStrength:l.test}),we=[ie()],Oe=!1;if("undefined"!=typeof document){oe(document,"touchstart touchmove",{passive:!0,capture:!0}).start(function(t){var r=t.touches;Oe=!0;for(var e=r.length,n=we.length=0;n<e;n++){var o=r[n];we.push(ue(o))}})}function Me(t){var r=void 0===t?{}:t,e=r.preventDefault,f=void 0===e||e,n=r.scale,p=void 0===n?1:n,o=r.rotate,d=void 0===o?0:o;return pr(function(t){var o=t.update,i={touches:we,scale:p,rotate:d},u=0,a=0,s=1<we.length;if(s){var r=we[0],e=we[1];u=Tt(r,e),a=xt(r,e)}function n(){if(s){var t=we[0],r=we[1],e=Tt(t,r),n=xt(t,r);i.scale=p*(e/u),i.rotate=d+(n-a)}o(i)}var c=oe(document,"touchmove",{passive:!f}).start(function(t){(f||1<t.touches.length)&&t.preventDefault(),Dr.update(n)});return Oe&&Dr.update(n),{stop:function(){Fr.update(n),c.stop()}}})}var xe=ie(),Ae=!1;if("undefined"!=typeof document){oe(document,"mousedown mousemove",!0).start(function(t){Ae=!0,ue(t,xe)})}function Se(t){var r=(void 0===t?{}:t).preventDefault,o=void 0===r||r;return pr(function(t){function r(){return e(xe)}var e=t.update,n=oe(document,"mousemove").start(function(t){o&&t.preventDefault(),Dr.update(r)});return Ae&&Dr.update(r),{stop:function(){Fr.update(r),n.stop()}}})}function ke(t){return t[0]}function Ce(t){return void 0===t&&(t={}),Oe?Me(t).pipe(function(t){return t.touches},ke):Se(t)}function Pe(){for(var u=[],t=0;t<arguments.length;t++)u[t]=arguments[t];return pr(function(t){var r,e=t.update,n=t.complete,o=0,i=function(){r=u[o].start({complete:function(){(++o>=u.length?n:i)()},update:e})};return i(),{stop:function(){return r&&r.stop()}}})}function Re(n){return pr(function(t){var r=t.complete,e=setTimeout(r,n);return{stop:function(){return clearTimeout(e)}}})}function Te(t){var e=t.onRead,r=t.onRender,n=t.uncachedValues,c=void 0===n?new Set:n,o=t.useCache,f=void 0===o||o;return function(t){void 0===t&&(t={});var n=b(t,[]),o={},i=[],u=!1;function a(t,r){t.startsWith("--")&&(n.hasCSSVariable=!0);var e=o[t];o[t]=r,o[t]!==e&&(-1===i.indexOf(t)&&i.push(t),u||(u=!0,ut.render(s.render)))}var s={get:function(t,r){return void 0===r&&(r=!1),!r&&f&&!c.has(t)&&void 0!==o[t]?o[t]:e(t,n)},set:function(t,r){if("string"==typeof t)a(t,r);else for(var e in t)a(e,t[e]);return this},render:function(t){return void 0===t&&(t=!1),!u&&!0!==t||(r(o,n,i),u=!1,i.length=0),this}};return s}}function Ve(t,r){return Xe.set(t,De(r))}var je,_e=Object.freeze({__proto__:null,applyOffset:At,clamp:Xt,conditional:function(r,e){return function(t){return r(t)?e(t):t}},interpolate:function(t,r,e){var n=void 0===e?{}:e,o=n.clamp,i=void 0===o||o,u=n.ease,a=n.mixer,s=t.length;r.length,u&&Array.isArray(u)&&u.length,t[0]>t[s-1]&&(t=[].concat(t),r=[].concat(r),t.reverse(),r.reverse());var c,f,p,d,l,v,h,m,g,y=$t(r,u,a),b=2===s?(v=y,h=(l=t)[0],m=l[1],g=v[0],function(t){return g(Yt(h,m,t))}):(f=y,p=(c=t).length,d=p-1,function(t){var r=0,e=!1;if(t<=c[0]?e=!0:t>=c[d]&&(r=d-1,e=!0),!e){for(var n=1;n<p&&!(c[n]>t||n===d);n++);r=n-1}var o=Yt(c[r],c[r+1],t);return f[r](o)});return i?Wt(Xt(t[0],t[s-1]),b):b},blendArray:qt,blendColor:zt,pipe:Wt,smooth:function(o){void 0===o&&(o=50);var i=0,u=0;return function(t){var r=nt.timestamp,e=r!==u?r-u:0,n=e?Gt(i,t,e,o):i;return u=r,i=n}},snap:function(o){if("number"==typeof o)return function(t){return Math.round(t/o)*o};var i=0,u=o.length;return function(t){var r=Math.abs(o[0]-t);for(i=1;i<u;i++){var e=o[i],n=Math.abs(e-t);if(0===n)return e;if(r<n)return o[i-1];if(i===u-1)return e;r=n}}},generateStaticSpring:Jt,nonlinearSpring:er,linearSpring:rr,wrap:nr,appendUnit:function(r){return function(t){return""+t+r}},steps:function(e,n,o){return void 0===n&&(n=0),void 0===o&&(o=1),function(t){var r=Yt(n,o,t);return Vt(n,o,Sr(e,r))}},transformMap:function(o){return function(t){var r=A({},t);for(var e in o)if(o.hasOwnProperty(e)){var n=o[e];r[e]=n(t[e])}return r}}}),Ee=/([a-z])([A-Z])/g,De=function(t){return t.replace(Ee,"$1-$2").toLowerCase()},Fe=new Map,Xe=new Map,Ye=["Webkit","Moz","O","ms",""],Le=Ye.length,Ie="undefined"!=typeof document,ze=function(t,r){void 0===r&&(r=!1);var e,n=r?Xe:Fe;return n.has(t)||(Ie?function(t){je=je||document.createElement("div");for(var r=0;r<Le;r++){var e=Ye[r],n=""===e,o=n?t:e+t.charAt(0).toUpperCase()+t.slice(1);if(o in je.style||n){if(n&&"clipPath"===t&&Xe.has(t))return;Fe.set(t,o),Ve(t,(n?"":"-")+De(o))}}}(t):Ve(e=t,e)),n.get(t)||t},We=["","X","Y","Z"],Be=["translate","scale","rotate","skew","transformPerspective"].reduce(function(t,e){return We.reduce(function(t,r){return t.push(e+r),t},t)},["x","y","z"]),qe=Be.reduce(function(t,r){return t[r]=!0,t},{});function Ne(t){return!0===qe[t]}function Ue(t,r){return Be.indexOf(t)-Be.indexOf(r)}var Ze=new Set(["originX","originY","originZ"]);var He=A(A({},l),{transform:Math.round}),$e={color:U,backgroundColor:U,outlineColor:U,fill:U,stroke:U,borderColor:U,borderTopColor:U,borderRightColor:U,borderBottomColor:U,borderLeftColor:U,borderWidth:y,borderTopWidth:y,borderRightWidth:y,borderBottomWidth:y,borderLeftWidth:y,borderRadius:y,radius:y,borderTopLeftRadius:y,borderTopRightRadius:y,borderBottomRightRadius:y,borderBottomLeftRadius:y,width:y,maxWidth:y,height:y,maxHeight:y,size:y,top:y,right:y,bottom:y,left:y,padding:y,paddingTop:y,paddingRight:y,paddingBottom:y,paddingLeft:y,margin:y,marginTop:y,marginRight:y,marginBottom:y,marginLeft:y,rotate:m,rotateX:m,rotateY:m,rotateZ:m,scale:h,scaleX:h,scaleY:h,scaleZ:h,skew:m,skewX:m,skewY:m,distance:y,translateX:y,translateY:y,translateZ:y,x:y,y:y,z:y,perspective:y,opacity:v,originX:M,originY:M,originZ:y,zIndex:He,fillOpacity:v,strokeOpacity:v,numOctaves:He},Ge=function(t){return $e[t]},Ke=function(t,r){return r&&"number"==typeof t?r.transform(t):t},Je="scrollLeft",Qe="scrollTop",tn=new Set([Je,Qe]),rn=new Set([Je,Qe,"transform"]),en={x:"translateX",y:"translateY",z:"translateZ"};function nn(t){return"function"==typeof t}function on(t,r,e,n,o,i,u,a){void 0===r&&(r=!0),void 0===e&&(e={}),void 0===n&&(n={}),void 0===o&&(o={}),void 0===i&&(i=[]),void 0===u&&(u=!1),void 0===a&&(a=!0);var s,c=!0,f=!1,p=!1;for(var d in t){var l=t[d],v=Ge(d),h=Ke(l,v);Ne(d)?(f=!0,n[d]=h,i.push(d),c&&(v.default&&l!==v.default||!v.default&&0!==l)&&(c=!1)):(s=d,Ze.has(s)?(o[d]=h,p=!0):rn.has(d)&&nn(h)||(e[ze(d,u)]=h))}return!f&&"function"!=typeof t.transform||(e.transform=function(t,r,e,n,o,i){void 0===i&&(i=!0);var u="",a=!1;e.sort(Ue);for(var s=e.length,c=0;c<s;c++){var f=e[c];u+=(en[f]||f)+"("+r[f]+") ",a="z"===f||a}return!a&&o?u+="translateZ(0)":u=u.trim(),nn(t.transform)?u=t.transform(r,n?"":u):i&&n&&(u="none"),u}(t,n,i,c,r,a)),p&&(e.transformOrigin=(o.originX||"50%")+" "+(o.originY||"50%")+" "+(o.originZ||0)),e}function un(t){var r=void 0===t?{}:t,e=r.enableHardwareAcceleration,n=void 0===e||e,o=r.isDashCase,i=void 0===o||o,u=r.allowTransformNone,a=void 0===u||u,s={},c={},f={},p=[];return function(t){return p.length=0,on(t,n,s,c,f,p,i,a),s}}var an=Te({onRead:function(t,r){var e=r.element,n=r.preparseOutput,o=Ge(t);if(Ne(t))return o&&o.default||0;if(tn.has(t))return e[t];var i=window.getComputedStyle(e,null).getPropertyValue(ze(t,!0))||0;return n&&o&&o.test(i)&&o.parse?o.parse(i):i},onRender:function(t,r,e){var n=r.element,o=r.buildStyles,i=r.hasCSSVariable;if(Object.assign(n.style,o(t)),i)for(var u=e.length,a=0;a<u;a++){var s=e[a];s.startsWith("--")&&n.style.setProperty(s,t[s])}-1!==e.indexOf(Je)&&(n[Je]=t[Je]),-1!==e.indexOf(Qe)&&(n[Qe]=t[Qe])},uncachedValues:tn});var sn=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),cn=.5,fn=function(){return{style:{}}},pn=function(t,r){return y.transform(t*r)},dn={x:0,y:0,width:0,height:0};function ln(t,r,e){return"string"==typeof t?t:y.transform(r+e*t)}var vn={enableHardwareAcceleration:!1,isDashCase:!1};function hn(t,r,e,n,o,i){void 0===r&&(r=dn),void 0===n&&(n=un(vn)),void 0===o&&(o=fn()),void 0===i&&(i=!0);var u,a,s=t.attrX,c=t.attrY,f=t.originX,p=t.originY,d=t.pathLength,l=t.pathSpacing,v=void 0===l?1:l,h=t.pathOffset,m=void 0===h?0:h,g=n(b(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var y in g){if("transform"===y)o.style.transform=g[y];else o[i&&!sn.has(y)?De(y):y]=g[y]}return void 0===f&&void 0===p&&!g.transform||(o.style.transformOrigin=(a=void 0!==p?p:cn,ln(void 0!==f?f:cn,(u=r).x,u.width)+" "+ln(a,u.y,u.height))),void 0!==s&&(o.x=s),void 0!==c&&(o.y=c),void 0!==e&&void 0!==d&&(o[i?"stroke-dashoffset":"strokeDashoffset"]=pn(-m,e),o[i?"stroke-dasharray":"strokeDasharray"]=pn(d,e)+" "+pn(v,e)),o}function mn(t){var r=function(t){try{return"function"==typeof(r=t).getBBox?r.getBBox():r.getBoundingClientRect()}catch(t){return{x:0,y:0,width:0,height:0}}var r}(t),e="path"===t.tagName&&t.getTotalLength?t.getTotalLength():void 0;return yn({element:t,buildAttrs:function(r,e,n){void 0===n&&(n=!0);var o=fn(),i=un(vn);return function(t){return hn(t,r,e,i,o,n)}}(r,e)})}function gn(t,r){var e,n,o;return t===window?e=bn(t):(o=t)instanceof HTMLElement||"function"==typeof o.click?e=function(t,r){void 0===r&&(r={});var e=r.enableHardwareAcceleration,n=r.allowTransformNone,o=b(r,["enableHardwareAcceleration","allowTransformNone"]);return an(A({element:t,buildStyles:un({enableHardwareAcceleration:e,allowTransformNone:n}),preparseOutput:!0},o))}(t,r):((n=t)instanceof SVGElement||"ownerSVGElement"in n)&&(e=mn(t)),wn.set(t,e),e}var yn=Te({onRead:function(t,r){var e=r.element;if(Ne(t=sn.has(t)?t:De(t))){var n=Ge(t);return n&&n.default||0}return e.getAttribute(t)},onRender:function(t,r){var e=r.element,n=(0,r.buildAttrs)(t);for(var o in n)"style"===o?Object.assign(e.style,n.style):e.setAttribute(o,n[o])}}),bn=Te({useCache:!1,onRead:function(t){return"scrollTop"===t?window.pageYOffset:window.pageXOffset},onRender:function(t){var r=t.scrollTop,e=void 0===r?0:r,n=t.scrollLeft,o=void 0===n?0:n;return window.scrollTo(o,e)}}),wn=new WeakMap;function On(t,r){var e,n,o="string"==typeof t?document.querySelector(t):t;return e=o,n=r,wn.has(e)?wn.get(e):gn(e,n)}t.Action=cr,t.ValueReaction=Ir,t.action=pr,t.calc=Lr,t.chain=Pe,t.composite=ae,t.crossfade=function(r,e){return pr(function(n){var o=0,t=Br(r,e).start(A(A({},n),{update:function(t){var r=t[0],e=t[1];n.update(Vt(r,e,o))}}));return{setBalance:function(t){return o=t},stop:function(){return t.stop()}}})},t.css=function(t,r){return On(t,r)},t.decay=le,t.delay=Re,t.easing=Dt,t.everyFrame=function(){return pr(function(t){var e=t.update,n=0,r=Dr.update(function(t){var r=t.timestamp;e(r-(n=n||r))},!0,!0);return{stop:function(){return Fr.update(r)}}})},t.inertia=he,t.keyframes=re,t.listen=oe,t.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return pr(function(r){var t=e.map(function(t){return t.start(r)});return{stop:function(){return t.forEach(function(t){return t.stop()})}}})},t.mouse=Se,t.multicast=function(){return new mr},t.multitouch=Me,t.parallel=Br,t.physics=be,t.pointer=function(t){void 0===t&&(t={});var r=t.x,e=t.y,n=b(t,["x","y"]);if(void 0===r&&void 0===e)return Ce(n);var o=At(r||0),i=At(e||0),u={x:0,y:0};return Ce(n).pipe(function(t){return u.x=o(t.x),u.y=i(t.y),u})},t.schedule=function(u,a){return pr(function(t){var r,e=t.update,n=t.complete,o=u.start({update:function(){return void 0!==r&&e(r)},complete:n}),i=a.start({update:function(t){return r=t},complete:n});return{stop:function(){o.stop(),i.stop()}}})},t.spring=ve,t.stagger=function(t,n){var o="number"==typeof n,r=t.map(function(t,r){var e=o?n*r:n(r);return Pe(Re(e),t)});return Br.apply(void 0,r)},t.styler=On,t.svg=function(t,r){return On(t,r)},t.timeline=function(t,r){var e=void 0===r?{}:r,n=e.duration,o=e.elapsed,i=e.ease,u=e.loop,a=e.flip,s=e.yoyo,c=0,f=0,p=t.reduce(ee,[]),d=[];p.forEach(function(t){if("string"==typeof t)c+=parseFloat(t);else if("number"==typeof t)c=t;else{var r=A(A({},t),{at:c});r.duration=void 0===r.duration?300:r.duration,d.push(r),c+=r.duration,f=Math.max(f,r.at+r.duration)}});for(var l={},v=d.length,h=0;h<v;h++){var m=d[h],g=m.track;if(void 0===g)throw new Error("No track defined");l.hasOwnProperty(g)||(l[g]=[]),l[g].push(m)}var y={};for(var b in l)if(l.hasOwnProperty(b)){var w=l[b].reduce(ne,{duration:f,easings:[],times:[],values:[]});y[b]=re(A(A({},w),{duration:n||f,ease:i,elapsed:o,loop:u,yoyo:s,flip:a}))}return ae(y)},t.transform=_e,t.tween=te,t.value=function(t,r){return new Ir({value:t,initialSubscription:r})},t.valueTypes=G,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).popmotion={})}(this,function(t){"use strict";var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function r(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var A=function(){return(A=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)};function b(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]]);return e}function i(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;for(var n=Array(t),o=0,r=0;r<e;r++)for(var i=arguments[r],u=0,a=i.length;u<a;u++,o++)n[o]=i[u];return n}function e(r,e){return function(t){return Math.max(Math.min(t,e),r)}}function p(t){return t%1?Number(t.toFixed(5)):t}function o(r){return{test:function(t){return"string"==typeof t&&t.endsWith(r)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+r}}}function u(t){return void 0!==t.red}function a(t){return void 0!==t.hue}var s=/(-)?(\d[\d\.]*)/g,c=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,f=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,d={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},l=A(A({},d),{transform:e(0,1)}),v=A(A({},d),{default:1}),h=o("deg"),m=o("%"),g=o("px"),y=o("vh"),w=o("vw"),O=A(A({},m),{parse:function(t){return m.parse(t)/100},transform:function(t){return m.transform(100*t)}}),M=e(0,255);function x(i){return function(t){if("string"!=typeof t)return t;for(var r,e={},n=(r=t).substring(r.indexOf("(")+1,r.lastIndexOf(")")).replace(/(,|\/)/g," ").split(/ \s*/),o=0;o<4;o++)e[i[o]]=void 0!==n[o]?parseFloat(n[o]):1;return e}}var k=A(A({},d),{transform:function(t){return Math.round(M(t))}});function C(t,r){return t.startsWith(r)&&f.test(t)}function S(t){return"number"==typeof t?0:t}function P(t){return tt=t}function T(t){return ot[t].process(et)}function V(r){return function(t){return 1-r(1-t)}}function R(r){return function(t){return t<=.5?r(2*t)/2:(2-r(2*(1-t)))/2}}function j(r){return function(t){return Math.pow(t,r)}}function _(r){return function(t){return t*t*((r+1)*t-r)}}function E(t){var r=_(t);return function(t){return(t*=2)<1?.5*r(t):.5*(2-Math.pow(2,-10*(t-1)))}}function D(t){return t}function F(t){return 1-Math.sin(Math.acos(t))}function X(t){var r=t*t;return t<4/11?7.5625*r:t<8/11?9.075*r-9.9*t+3.4:t<.9?4356/361*r-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72}function Y(t,r){return 1-3*r+3*t}function L(t,r){return 3*r-6*t}function I(t,r,e){return 3*Y(r,e)*t*t+2*L(r,e)*t+3*r}function z(t,r,e){return((Y(r,e)*t+L(r,e))*t+3*r)*t}var W={test:function(t){return"string"==typeof t?C(t,"rgb"):u(t)},parse:x(["red","green","blue","alpha"]),transform:function(t){var r,e,n,o,i,u=t.red,a=t.green,s=t.blue,c=t.alpha,f=void 0===c?1:c;return r={red:k.transform(u),green:k.transform(a),blue:k.transform(s),alpha:p(l.transform(f))},e=r.red,n=r.green,o=r.blue,i=r.alpha,"rgba("+e+", "+n+", "+o+", "+(void 0===i?1:i)+")"}},B={test:function(t){return"string"==typeof t?C(t,"hsl"):a(t)},parse:x(["hue","saturation","lightness","alpha"]),transform:function(t){var r,e,n,o,i,u=t.hue,a=t.saturation,s=t.lightness,c=t.alpha,f=void 0===c?1:c;return r={hue:Math.round(u),saturation:m.transform(p(a)),lightness:m.transform(p(s)),alpha:p(l.transform(f))},e=r.hue,n=r.saturation,o=r.lightness,i=r.alpha,"hsla("+e+", "+n+", "+o+", "+(void 0===i?1:i)+")"}},q=A(A({},W),{test:function(t){return"string"==typeof t&&C(t,"#")},parse:function(t){var r="",e="",n="";return 4<t.length?(r=t.substr(1,2),e=t.substr(3,2),n=t.substr(5,2)):(r=t.substr(1,1),e=t.substr(2,1),n=t.substr(3,1),r+=r,e+=e,n+=n),{red:parseInt(r,16),green:parseInt(e,16),blue:parseInt(n,16),alpha:1}}}),N={test:function(t){return"string"==typeof t&&f.test(t)||u(t)||a(t)},parse:function(t){return W.test(t)?W.parse(t):B.test(t)?B.parse(t):q.test(t)?q.parse(t):t},transform:function(t){return u(t)?W.transform(t):a(t)?B.transform(t):t}},Z="${c}",H="${n}",U={test:function(t){if("string"!=typeof t||!isNaN(t))return!1;var r=0,e=t.match(s),n=t.match(c);return e&&(r+=e.length),n&&(r+=n.length),0<r},parse:function(t){var r=t,e=[],n=r.match(c);n&&(r=r.replace(c,Z),e.push.apply(e,n.map(N.parse)));var o=r.match(s);return o&&e.push.apply(e,o.map(d.parse)),e},createTransformer:function(t){var n=t,o=0,r=t.match(c),i=r?r.length:0;if(r)for(var e=0;e<i;e++)n=n.replace(r[e],Z),o++;var u=n.match(s),a=u?u.length:0;if(u)for(e=0;e<a;e++)n=n.replace(u[e],H),o++;return function(t){for(var r=n,e=0;e<o;e++)r=r.replace(e<i?Z:H,e<i?N.transform(t[e]):p(t[e]));return r}},getAnimatableNone:function(t){var r=U.parse(t);return U.createTransformer(t)(r.map(S))}},$=Object.freeze({__proto__:null,alpha:l,color:N,complex:U,degrees:h,hex:q,hsla:B,number:d,percent:m,progressPercentage:O,px:g,rgbUnit:k,rgba:W,scale:v,vh:y,vw:w}),G=0,K="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var r=Date.now(),e=Math.max(0,16.7-(r-G));G=r+e,setTimeout(function(){return t(G)},e)},J=1/60*1e3,Q=!0,tt=!1,rt=!1,et={delta:0,timestamp:0},nt=["read","update","preRender","render","postRender"],ot=nt.reduce(function(t,r){var n,i,u,a,s,o,c,f,p;return t[r]=(n=P,i=[],s=!(u=[]),o=a=0,c=new WeakSet,f=new WeakSet,p={cancel:function(t){var r=u.indexOf(t);c.add(t),-1!==r&&u.splice(r,1)},process:function(t){var r,e;if(s=!0,i=(r=[u,i])[0],(u=r[1]).length=0,a=i.length)for(o=0;o<a;o++)(e=i[o])(t),!0!==f.has(e)||c.has(e)||(p.schedule(e),n(!0));s=!1},schedule:function(t,r,e){void 0===r&&(r=!1),void 0===e&&(e=!1);var n=e&&s,o=n?i:u;c.delete(t),r&&f.add(t),-1===o.indexOf(t)&&(o.push(t),n&&(a=i.length))}}),t},{}),it=nt.reduce(function(t,r){var n=ot[r];return t[r]=function(t,r,e){return void 0===r&&(r=!1),void 0===e&&(e=!1),tt||at(),n.schedule(t,r,e),t},t},{}),ut=function(t){tt=!1,et.delta=Q?J:Math.max(Math.min(t-et.timestamp,40),1),Q||(J=et.delta),et.timestamp=t,rt=!0,nt.forEach(T),rt=!1,tt&&(Q=!1,K(ut))},at=function(){Q=tt=!0,rt||K(ut)},st=V,ct=j(2),ft=V(ct),pt=R(ct),dt=V(F),lt=R(dt),vt=_(1.525),ht=V(vt),mt=R(vt),gt=E(1.525),yt="undefined"!=typeof Float32Array;function bt(t){return"number"==typeof t}function wt(t){return 180*t/Math.PI}function Ot(t,r){return void 0===r&&(r=Et),wt(Math.atan2(r.y-t.y,r.x-t.x))}function Mt(r,e){var n=!0;return void 0===e&&(e=r,n=!1),function(t){return n?t-r+e:(r=t,n=!0,e)}}function xt(n){return function(r,e,t){return void 0!==t?n(r,e,t):function(t){return n(r,e,t)}}}function At(t){return t*Math.PI/180}function kt(t){return t.hasOwnProperty("x")&&t.hasOwnProperty("y")}function Ct(t){return kt(t)&&t.hasOwnProperty("z")}function St(t,r){return Math.abs(t-r)}function Pt(t,r){if(void 0===r&&(r=Et),bt(t)&&bt(r))return St(t,r);if(kt(t)&&kt(r)){var e=St(t.x,r.x),n=St(t.y,r.y),o=Ct(t)&&Ct(r)?St(t.z,r.z):0;return Math.sqrt(Math.pow(e,2)+Math.pow(n,2)+Math.pow(o,2))}return 0}function Tt(t,r,e){return-e*t+e*r+t}function Vt(t,r,e){var n=t*t,o=r*r;return Math.sqrt(Math.max(0,e*(o-n)+n))}function Rt(r){return Yt.find(function(t){return t.test(r)})}function jt(r,e){return function(t){return e(r(t))}}var _t=Object.freeze({__proto__:null,reversed:V,mirrored:R,createReversedEasing:st,createMirroredEasing:R,createExpoIn:j,createBackIn:_,createAnticipateEasing:E,linear:D,easeIn:ct,easeOut:ft,easeInOut:pt,circIn:F,circOut:dt,circInOut:lt,backIn:vt,backOut:ht,backInOut:mt,anticipate:gt,bounceOut:X,bounceIn:function(t){return 1-X(1-t)},bounceInOut:function(t){return t<.5?.5*(1-X(1-2*t)):.5*X(2*t-1)+.5},cubicBezier:function(u,e,a,n){function o(t){for(var r,e,n,o=0,i=1;10!==i&&s[i]<=t;++i)o+=.1;return r=(t-s[--i])/(s[i+1]-s[i]),.001<=(n=I(e=o+.1*r,u,a))?function(t,r){for(var e,n=0;n<8;++n){if(0===(e=I(r,u,a)))return r;r-=(z(r,u,a)-t)/e}return r}(t,e):0===n?e:function(t,r,e){for(var n,o,i=0;0<(n=z(o=r+(e-r)/2,u,a)-t)?e=o:r=o,1e-7<Math.abs(n)&&++i<10;);return o}(t,o,o+.1)}var s=new(yt?Float32Array:Array)(11);return function(){for(var t=0;t<11;++t)s[t]=z(.1*t,u,a)}(),function(t){var r=u===e&&a===n?t:0===t?0:1===t?1:z(o(t),e,n);return r}}}),Et={x:0,y:0,z:0},Dt=xt(function(t,r,e){return Math.min(Math.max(e,t),r)}),Ft=function(t,r,e){var n=r-t;return 0==n?1:(e-t)/n},Xt=function(){return(Xt=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},Yt=[q,W,B],Lt=function(t,r){var e=Rt(t),n=Rt(r);e.transform,n.transform;var o=e.parse(t),i=n.parse(r),u=Xt({},o),a=e===B?Tt:Vt;return function(t){for(var r in u)"alpha"!==r&&(u[r]=a(o[r],i[r],t));return u.alpha=Tt(o.alpha,i.alpha,t),e.transform(u)}},It=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.reduce(jt)};function zt(r,e){return bt(r)?function(t){return Tt(r,e,t)}:(N.test(r)?Lt:Nt)(r,e)}var Wt=function(t,e){var n=t.slice(),o=n.length,i=t.map(function(t,r){return zt(t,e[r])});return function(t){for(var r=0;r<o;r++)n[r]=i[r](t);return n}},Bt=function(t,r){var e=Xt({},t,r),n={};for(var o in e)void 0!==t[o]&&void 0!==r[o]&&(n[o]=zt(t[o],r[o]));return function(t){for(var r in n)e[r]=n[r](t);return e}};function qt(t){for(var r=U.parse(t),e=r.length,n=0,o=0,i=0,u=0;u<e;u++)n||"number"==typeof r[u]?n++:void 0!==r[u].hue?i++:o++;return{parsed:r,numNumbers:n,numRGB:o,numHSL:i}}var Nt=function(t,r){var e=U.createTransformer(r),n=qt(t),o=qt(r);return It(Wt(n.parsed,o.parsed),e)},Zt=function(r,e){return function(t){return Tt(r,e,t)}};function Ht(t,r,e){for(var n,o=[],i=e||("number"==typeof(n=t[0])?Zt:"string"==typeof n?N.test(n)?Lt:Nt:Array.isArray(n)?Wt:"object"==typeof n?Bt:void 0),u=t.length-1,a=0;a<u;a++){var s,c=i(t[a],t[a+1]);r&&(s=Array.isArray(r)?r[a]:r,c=It(s,c)),o.push(c)}return o}function Ut(t,r,e,n){return void 0===n&&(n=0),o=t+e*(r-t)/Math.max(n,e),void 0===i&&(i=2),i=Math.pow(10,i),Math.round(o*i)/i;var o,i}function $t(t){return t}function Gt(i){return void 0===i&&(i=$t),xt(function(t,r,e){var n=r-e,o=-(0-t+1)*(0-i(Math.abs(n)));return n<=0?r+o:r-o})}function Kt(t,r){return bt(t)?t/(1e3/r):0}function Jt(t,r){return r?t*(1e3/r):0}var Qt=Gt(),tr=Gt(Math.sqrt),rr=xt(function(t,r,e){var n=r-t;return((e-t)%n+n)%n+t}),er=(Dt(0,1),nr.prototype.applyMiddleware=function(t){return this.create(A(A({},this.props),{middleware:this.props.middleware?i([t],this.props.middleware):[t]}))},nr.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e=1===t.length?t[0]:It.apply(void 0,t);return this.applyMiddleware(function(r){return function(t){return r(e(t))}})},nr.prototype.while=function(n){return this.applyMiddleware(function(r,e){return function(t){return n(t)?r(t):e()}})},nr.prototype.filter=function(e){return this.applyMiddleware(function(r){return function(t){return e(t)&&r(t)}})},nr);function nr(t){void 0===t&&(t={}),this.props=t}function or(t,r,e){var n=r.middleware;return new ur({middleware:n,onComplete:e},"function"==typeof t?{update:t}:t)}var ir,ur=function(t,r){var e=this,n=t.middleware,o=t.onComplete;this.isActive=!0,this.update=function(t){e.observer.update&&e.updateObserver(t)},this.complete=function(){e.observer.complete&&e.isActive&&e.observer.complete(),e.onComplete&&e.onComplete(),e.isActive=!1},this.error=function(t){e.observer.error&&e.isActive&&e.observer.error(t),e.isActive=!1},this.observer=r,this.updateObserver=function(t){return r.update(t)},this.onComplete=o,r.update&&n&&n.length&&n.forEach(function(t){return e.updateObserver=t(e.updateObserver,e.complete)})},ar=(r(sr,ir=er),sr.prototype.create=function(t){return new sr(t)},sr.prototype.start=function(t){void 0===t&&(t={});var r=!1,e={stop:function(){}},n=this.props,o=n.init,i=b(n,["init"]),u=o(or(t,i,function(){r=!0,e.stop()})),e=u?A(A({},e),u):e;return t.registerParent&&t.registerParent(e),r&&e.stop(),e},sr);function sr(){return null!==ir&&ir.apply(this,arguments)||this}function cr(t){return new ar({init:t})}var fr,pr=(r(dr,fr=er),dr.prototype.complete=function(){this.subscribers.forEach(function(t){return t.complete()})},dr.prototype.error=function(r){this.subscribers.forEach(function(t){return t.error(r)})},dr.prototype.update=function(t){for(var r=0;r<this.subscribers.length;r++)this.subscribers[r].update(t)},dr.prototype.subscribe=function(t){var r=this,e=or(t,this.props);return this.subscribers.push(e),{unsubscribe:function(){var t=r.subscribers.indexOf(e);-1!==t&&r.subscribers.splice(t,1)}}},dr.prototype.stop=function(){this.parent&&this.parent.stop()},dr.prototype.registerParent=function(t){this.stop(),this.parent=t},dr);function dr(){var t=null!==fr&&fr.apply(this,arguments)||this;return t.subscribers=[],t}var lr,vr=(r(hr,lr=pr),hr.prototype.create=function(t){return new hr(t)},hr);function hr(){return null!==lr&&lr.apply(this,arguments)||this}function mr(t){return Ar=t}function gr(t){return Pr[t].process(Cr)}function yr(t,r){var e=1/(t-1),n=1/(2*(t-1)),o=Math.min(r,1)/n;return Math.floor((1+o)/2)*e}var br,wr=0,Or="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var r=Date.now(),e=Math.max(0,16.7-(r-wr));wr=r+e,setTimeout(function(){return t(wr)},e)},Mr=1/60*1e3,xr=!0,Ar=!1,kr=!1,Cr={delta:0,timestamp:0},Sr=["read","update","preRender","render","postRender"],Pr=Sr.reduce(function(t,r){var n,i,u,a,s,o,c,f,p;return t[r]=(n=mr,i=[],s=!(u=[]),o=a=0,c=new WeakSet,f=new WeakSet,p={cancel:function(t){var r=u.indexOf(t);c.add(t),-1!==r&&u.splice(r,1)},process:function(t){var r,e;if(s=!0,i=(r=[u,i])[0],(u=r[1]).length=0,a=i.length)for(o=0;o<a;o++)(e=i[o])(t),!0!==f.has(e)||c.has(e)||(p.schedule(e),n(!0));s=!1},schedule:function(t,r,e){void 0===r&&(r=!1),void 0===e&&(e=!1);var n=e&&s,o=n?i:u;c.delete(t),r&&f.add(t),-1===o.indexOf(t)&&(o.push(t),n&&(a=i.length))}}),t},{}),Tr=Sr.reduce(function(t,r){var n=Pr[r];return t[r]=function(t,r,e){return void 0===r&&(r=!1),void 0===e&&(e=!1),Ar||jr(),n.schedule(t,r,e),t},t},{}),Vr=Sr.reduce(function(t,r){return t[r]=Pr[r].cancel,t},{}),Rr=function(t){Ar=!1,Cr.delta=xr?Mr:Math.max(Math.min(t-Cr.timestamp,40),1),xr||(Mr=Cr.delta),Cr.timestamp=t,kr=!0,Sr.forEach(gr),kr=!1,Ar&&(xr=!1,Or(Rr))},jr=function(){xr=Ar=!0,kr||Or(Rr)},_r=Object.freeze({__proto__:null,angle:Ot,degreesToRadians:At,distance:Pt,isPoint3D:Ct,isPoint:kt,dilate:Tt,getValueFromProgress:Tt,pointFromAngleAndDistance:function(t,r,e){return r=At(r),{x:e*Math.cos(r)+t.x,y:e*Math.sin(r)+t.y}},getProgressFromValue:Ft,radiansToDegrees:wt,smooth:Ut,speedPerFrame:Kt,speedPerSecond:Jt,stepProgress:yr}),Er=(r(Dr,br=pr),Dr.prototype.create=function(t){return new Dr(t)},Dr.prototype.get=function(){return this.current},Dr.prototype.getVelocity=function(){return this.getVelocityOfCurrent()},Dr.prototype.update=function(t){br.prototype.update.call(this,t),this.prev=this.current,this.updateCurrent(t);var r=Cr.delta,e=Cr.timestamp;this.timeDelta=r,this.lastUpdated=e,Tr.postRender(this.scheduleVelocityCheck)},Dr.prototype.subscribe=function(t){var r=br.prototype.subscribe.call(this,t);return this.subscribers[this.subscribers.length-1].update(this.current),r},Dr.prototype.getSingleVelocity=function(t,r){return"number"==typeof t&&"number"==typeof r?Jt(t-r,this.timeDelta):Jt(parseFloat(t)-parseFloat(r),this.timeDelta)||0},Dr.prototype.getListVelocity=function(){var e=this;return this.current.map(function(t,r){return e.getSingleVelocity(t,e.prev[r])})},Dr.prototype.getMapVelocity=function(){var t={};for(var r in this.current)this.current.hasOwnProperty(r)&&(t[r]=this.getSingleVelocity(this.current[r],this.prev[r]));return t},Dr);function Dr(t){var r,e,n,o=br.call(this,t)||this;return o.scheduleVelocityCheck=function(){return Tr.postRender(o.velocityCheck)},o.velocityCheck=function(t){t.timestamp!==o.lastUpdated&&(o.prev=o.current)},o.prev=o.current=t.value||0,e=o.current,"string"==(n=typeof e)||"number"==n?(o.updateCurrent=function(t){return o.current=t},o.getVelocityOfCurrent=function(){return o.getSingleVelocity(o.current,o.prev)}):(r=o.current,Array.isArray(r)?(o.updateCurrent=function(t){return o.current=i(t)},o.getVelocityOfCurrent=function(){return o.getListVelocity()}):(o.updateCurrent=function(t){for(var r in o.current={},t)t.hasOwnProperty(r)&&(o.current[r]=t[r])},o.getVelocityOfCurrent=function(){return o.getMapVelocity()})),t.initialSubscription&&o.subscribe(t.initialSubscription),o}function Fr(t){var f=t.getCount,p=t.getFirst,d=t.getOutput,l=t.mapApi,v=t.setProp,h=t.startActions;return function(c){return cr(function(t){function n(){return r(a)}var r=t.update,o=t.complete,i=t.error,u=f(c),a=d(),s=0,e=h(c,function(t,r){var e=!1;return t.start({complete:function(){e||(e=!0,++s===u&&Tr.update(o))},error:i,update:function(t){v(a,r,t),Tr.update(n,!1,!0)}})});return Object.keys(p(e)).reduce(function(t,r){return t[r]=l(e,r),t},{})})}}function Xr(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return ee(t)}function Yr(e){function n(t,r){return void 0!==t&&!e[r](t)}var t=Object.keys(e);return{getVectorKeys:function(e){return t.reduce(function(t,r){return n(e[r],r)&&t.push(r),t},[])},testVectorProps:function(r){return r&&t.some(function(t){return n(r[t],t)})}}}function Lr(r){return ne.find(function(t){return t.test(r)})}function Ir(t,r){return t(r)}function zr(o,i,u){var t=u[0],r=i[t].map(function(t,r){var e,n=u.reduce((e=r,function(t,r){return t[r]=t[r][e],t}),A({},i));return ue(t)(o,n)});return Xr.apply(void 0,r)}function Wr(o,i,u){var a=u[0],t=Object.keys(i[a]).reduce(function(t,r){var e,n=u.reduce((e=r,function(t,r){return t[r]=t[r][e],t}),A({},i));return t[r]=ue(i[a][r])(o,n),t},{});return re(t)}function Br(t,r){var e=r.from,n=r.to,o=b(r,["from","to"]),i=Lr(e)||Lr(n),u=i.transform,a=i.parse;return t(A(A({},o),{from:"string"==typeof e?a(e):e,to:"string"==typeof n?a(n):n})).pipe(u)}function qr(i){return function(t,r){var e=r.from,n=r.to,o=b(r,["from","to"]);return t(A(A({},o),{from:0,to:1})).pipe(i(e,n))}}function Nr(n,t){var r=Yr(t),o=r.testVectorProps,i=r.getVectorKeys;return function(t){if(!o(t))return n(t);var r=i(t),e=t[r[0]];return ue(e)(n,t,r)}}function Zr(b){return void 0===b&&(b={}),cr(function(t){var o=t.complete,i=t.update,r=b.velocity,e=void 0===r?0:r,n=b.from,u=void 0===n?0:n,a=b.power,s=void 0===a?.8:a,c=b.timeConstant,f=void 0===c?350:c,p=b.restDelta,d=void 0===p?.5:p,l=b.modifyTarget,v=0,h=s*e,m=u+h,g=void 0===l?m:l(m);g!==m&&(h=g-u);var y=Tr.update(function(t){var r=t.delta;v+=r;var e=-h*Math.exp(-v/f),n=d<e||e<-d;i(n?g+e:g),n||(Vr.update(y),o())},!0);return{stop:function(){return Vr.update(y)}}})}function Hr(k){return void 0===k&&(k={}),cr(function(t){var s,c=t.update,f=t.complete,r=k.velocity,p=void 0===r?0:r,e=k.from,n=void 0===e?0:e,o=k.to,d=void 0===o?0:o,i=k.stiffness,l=void 0===i?100:i,u=k.damping,v=void 0===u?10:u,a=k.mass,h=void 0===a?1:a,m=k.restSpeed,g=void 0===m?.01:m,y=k.restDelta,b=void 0===y?.01:y,w=p?-p/1e3:0,O=0,M=d-n,x=n,A=Tr.update(function(t){var r=t.delta;O+=r;var e,n,o=v/(2*Math.sqrt(l*h)),i=Math.sqrt(l/h)/1e3;s=x,x=o<1?(n=Math.exp(-o*i*O),e=i*Math.sqrt(1-o*o),d-n*((w+o*i*M)/e*Math.sin(e*O)+M*Math.cos(e*O))):(n=Math.exp(-i*O),d-n*(M+(w+i*M)*O)),p=Jt(x-s,r);var u=Math.abs(p)<=g,a=Math.abs(d-x)<=b;u&&a?(c(x=d),Vr.update(A),f()):c(x)},!0);return{stop:function(){return Vr.update(A)}}})}function Ur(D){return void 0===D&&(D={}),cr(function(t){function n(t){var r;void 0===t&&(t=!1),j=fe({from:O=(r=[x,O])[0],to:x=r[1],ease:p,reverseEase:t}).start(u)}function o(){_=pe(Ft(0,c,k)),j.seek(_)}function r(){E=!0,i=Tr.update(function(t){var r,e=t.delta;k+=e,o(),!(r=E&&c+b<k)||(!r||h||l||g)&&(k=c-(k-b),h&&R<h?(R++,1):l&&S<l?(S++,n(),1):g&&T<g&&(n(++T%2!=0),1))||(Vr.update(i),a&&Tr.update(a,!1,!0))},!0)}function e(){E=!1,i&&Vr.update(i)}var i,u=t.update,a=t.complete,s=D.duration,c=void 0===s?300:s,f=D.ease,p=void 0===f?ft:f,d=D.flip,l=void 0===d?0:d,v=D.loop,h=void 0===v?0:v,m=D.yoyo,g=void 0===m?0:m,y=D.repeatDelay,b=void 0===y?0:y,w=D.from,O=void 0===w?0:w,M=D.to,x=void 0===M?1:M,A=D.elapsed,k=void 0===A?0:A,C=D.flipCount,S=void 0===C?0:C,P=D.yoyoCount,T=void 0===P?0:P,V=D.loopCount,R=void 0===V?0:V,j=fe({from:O,to:x,ease:p}).start(u),_=0,E=!1;return r(),{isActive:function(){return E},getElapsed:function(){return Dt(0,c,k)},getProgress:function(){return _},stop:function(){e()},pause:function(){return e(),this},resume:function(){return E||r(),this},seek:function(t){return k=Tt(0,c,t),Tr.update(o,!1,!0),this},reverse:function(){return n(),this}}})}function $r(t){var r,e,n,o,i=t.easings,u=t.ease,a=void 0===u?D:u,s=t.times,c=t.values,f=b(t,["easings","ease","times","values"]),i=Array.isArray(i)?i:(e=i,(r=c).map(function(){return e||ft}).splice(0,r.length-1)),s=s||(o=(n=c).length,n.map(function(t,r){return 0!==r?r/(o-1):0})),p=i.map(function(t,r){return fe({from:c[r],to:c[r+1],ease:t})});return Ur(A(A({},f),{ease:a})).applyMiddleware(function(t){return r=p,e=t,o=(n=s).length,u=(i=o-1)-1,a=r.map(function(t){return t.start(e)}),function(t){t<=n[0]&&a[0].seek(0),t>=n[i]&&a[u].seek(1);for(var r=1;r<o&&!(n[r]>t||r===i);r++);var e=Ft(n[r-1],n[r],t);a[r-1].seek(de(e))};var n,r,e,o,i,u,a})}function Gr(t,r){var e,n,o,i,u,a,s;return Array.isArray(r)?t.push.apply(t,(n=[],o=(e=r)[e.length-1],u=(i="number"==typeof o)?o:0,a=i?e.slice(0,-1):e,s=a.length,a.forEach(function(t,r){var e;n.push(t),r!==s-1&&(e=t.duration||300,n.push(""+(u-e)))}),n)):t.push(r),t}function Kr(t,r,e){var n,o=t.duration,i=t.easings,u=t.times,a=t.values,s=a.length,c=u[s-1],f=0===r.at?0:r.at/o,p=(r.at+r.duration)/o;return 0===e?(a.push(r.from),u.push(f)):c!==f?(void 0!==r.from&&(a.push(a[s-1]),u.push(f),i.push(D)),n=void 0!==r.from?r.from:a[s-1],a.push(n),u.push(f),i.push(D)):void 0!==r.from&&(a.push(r.from),u.push(f),i.push(D)),a.push(r.to),u.push(p),i.push(r.ease||pt),t}function Jr(n,o,i){return cr(function(t){var r=t.update,e=o.split(" ").map(function(t){return n.addEventListener(t,r,i),t});return{stop:function(){return e.forEach(function(t){return n.removeEventListener(t,r,i)})}}})}function Qr(){return{clientX:0,clientY:0,pageX:0,pageY:0,x:0,y:0}}function te(t,r){return void 0===r&&(r=Qr()),r.clientX=r.x=t.clientX,r.clientY=r.y=t.clientY,r.pageX=t.pageX,r.pageY=t.pageY,r}var re=Fr({getOutput:function(){return{}},getCount:function(t){return Object.keys(t).length},getFirst:function(t){return t[Object.keys(t)[0]]},mapApi:function(o,i){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return Object.keys(o).reduce(function(t,r){var e;return o[r][i]&&(n[0]&&void 0!==n[0][r]?t[r]=o[r][i](n[0][r]):t[r]=(e=o[r])[i].apply(e,n)),t},{})}},setProp:function(t,r,e){return t[r]=e},startActions:function(e,n){return Object.keys(e).reduce(function(t,r){return t[r]=n(e[r],r),t},{})}}),ee=Fr({getOutput:function(){return[]},getCount:function(t){return t.length},getFirst:function(t){return t[0]},mapApi:function(r,n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.map(function(t,r){if(t[n])return Array.isArray(e[0])?t[n](e[0][r]):t[n].apply(t,e)})}},setProp:function(t,r,e){return t[r]=e},startActions:function(t,e){return t.map(function(t,r){return e(t,r)})}}),ne=[g,m,h,y,w],oe=qr(Lt),ie=qr(Nt),ue=function(t){return"number"==typeof t?Ir:Array.isArray(t)?zr:Boolean(Lr(t))?Br:N.test(t)?oe:U.test(t)?ie:"object"==typeof t?Wr:Ir},ae=Nr(Zr,{from:d.test,modifyTarget:function(t){return"function"==typeof t},velocity:d.test}),se=Nr(Hr,{from:d.test,to:d.test,stiffness:d.test,damping:d.test,mass:d.test,velocity:d.test}),ce=Nr(function(t){var r=t.from,v=void 0===r?0:r,e=t.velocity,h=void 0===e?0:e,m=t.min,g=t.max,n=t.power,y=void 0===n?.8:n,o=t.timeConstant,b=void 0===o?700:o,i=t.bounceStiffness,w=void 0===i?500:i,u=t.bounceDamping,O=void 0===u?10:u,a=t.restDelta,M=void 0===a?1:a,x=t.modifyTarget;return cr(function(t){function r(t){return void 0!==m&&t<m||void 0!==g&&g<t}function e(t){return Math.abs(m-t)<Math.abs(g-t)?m:g}function n(t,r){i&&i.stop(),i=t.start({update:p,complete:function(){(r||d)()}})}function o(t){n(Hr(A(A({},t),{stiffness:w,damping:O,restDelta:M})))}var i,u,a,s,c,f,p=t.update,d=t.complete,l=v;return r(v)?o({from:v,velocity:h,to:e(v)}):(u=y*h+v,void 0!==x&&(u=x(u),x=void 0,h=(u-v)/y),c=Zr({from:v,velocity:h,timeConstant:b,power:y,restDelta:M,modifyTarget:x}),f=void 0,r(u)&&(a=e(u),s=a==m?-1:1,c=c.while(function(t){return h=Jt(t-l,Cr.delta),0<a-(l=t)*s}),f=function(){return o({from:l,to:a,velocity:h})}),n(c,f)),{stop:function(){return i&&i.stop()}}})},{from:d.test,velocity:d.test,min:d.test,max:d.test,damping:d.test,stiffness:d.test,modifyTarget:function(t){return"function"==typeof t}}),fe=Nr(function(t){var r=t.from,e=void 0===r?0:r,n=t.to,o=void 0===n?1:n,i=t.ease,u=void 0===i?D:i,a=t.reverseEase;return void 0!==a&&a&&(u=st(u)),cr(function(t){var r=t.update;return{seek:function(t){return r(t)}}}).pipe(u,function(t){return Tt(e,o,t)})},{ease:function(t){return"function"==typeof t},from:d.test,to:d.test}),pe=Dt(0,1),de=Dt(0,1),le=Nr(function(m){return void 0===m&&(m={}),cr(function(t){var n=t.complete,o=t.update,r=m.acceleration,i=void 0===r?0:r,e=m.friction,u=void 0===e?0:e,a=m.velocity,s=void 0===a?0:a,c=m.springStrength,f=m.to,p=m.restSpeed,d=void 0===p?.001:p,l=m.from,v=void 0===l?0:l,h=Tr.update(function(t){var r=t.delta,e=Math.max(r,16);i&&(s+=Kt(i,e)),u&&(s*=Math.pow(1-u,e/100)),void 0!==c&&void 0!==f&&(s+=(f-v)*Kt(c,e)),v+=Kt(s,e),o(v),!1!==d&&(!s||Math.abs(s)<=d)&&(Vr.update(h),n())},!0);return{set:function(t){return v=t,this},setAcceleration:function(t){return i=t,this},setFriction:function(t){return u=t,this},setSpringStrength:function(t){return c=t,this},setSpringTarget:function(t){return f=t,this},setVelocity:function(t){return s=t,this},stop:function(){return Vr.update(h)}}})},{acceleration:d.test,friction:d.test,velocity:d.test,from:d.test,to:d.test,springStrength:d.test}),ve=[Qr()],he=!1;"undefined"!=typeof document&&Jr(document,"touchstart touchmove",{passive:!0,capture:!0}).start(function(t){var r=t.touches;he=!0;for(var e=r.length,n=ve.length=0;n<e;n++){var o=r[n];ve.push(te(o))}});function me(t){var r=void 0===t?{}:t,e=r.preventDefault,f=void 0===e||e,n=r.scale,p=void 0===n?1:n,o=r.rotate,d=void 0===o?0:o;return cr(function(t){var r,e,o=t.update,i={touches:ve,scale:p,rotate:d},u=0,a=0,s=1<ve.length;s&&(r=ve[0],e=ve[1],u=Pt(r,e),a=Ot(r,e));function n(){var t,r,e,n;s&&(t=ve[0],r=ve[1],e=Pt(t,r),n=Ot(t,r),i.scale=p*(e/u),i.rotate=d+(n-a)),o(i)}var c=Jr(document,"touchmove",{passive:!f}).start(function(t){(f||1<t.touches.length)&&t.preventDefault(),Tr.update(n)});return he&&Tr.update(n),{stop:function(){Vr.update(n),c.stop()}}})}var ge=Qr(),ye=!1;"undefined"!=typeof document&&Jr(document,"mousedown mousemove",!0).start(function(t){ye=!0,te(t,ge)});function be(t){var r=(void 0===t?{}:t).preventDefault,o=void 0===r||r;return cr(function(t){function r(){return e(ge)}var e=t.update,n=Jr(document,"mousemove").start(function(t){o&&t.preventDefault(),Tr.update(r)});return ye&&Tr.update(r),{stop:function(){Vr.update(r),n.stop()}}})}function we(t){return t[0]}function Oe(t){return void 0===t&&(t={}),he?me(t).pipe(function(t){return t.touches},we):be(t)}function Me(){for(var u=[],t=0;t<arguments.length;t++)u[t]=arguments[t];return cr(function(t){var r,e=t.update,n=t.complete,o=0,i=function(){r=u[o].start({complete:function(){(++o>=u.length?n:i)()},update:e})};return i(),{stop:function(){return r&&r.stop()}}})}function xe(n){return cr(function(t){var r=t.complete,e=setTimeout(r,n);return{stop:function(){return clearTimeout(e)}}})}function Ae(t){var e=t.onRead,r=t.onRender,n=t.uncachedValues,c=void 0===n?new Set:n,o=t.useCache,f=void 0===o||o;return function(t){void 0===t&&(t={});var n=b(t,[]),o={},i=[],u=!1;function a(t,r){t.startsWith("--")&&(n.hasCSSVariable=!0);var e=o[t];o[t]=r,o[t]!==e&&(-1===i.indexOf(t)&&i.push(t),u||(u=!0,it.render(s.render)))}var s={get:function(t,r){return void 0===r&&(r=!1),!r&&f&&!c.has(t)&&void 0!==o[t]?o[t]:e(t,n)},set:function(t,r){if("string"==typeof t)a(t,r);else for(var e in t)a(e,t[e]);return this},render:function(t){return void 0===t&&(t=!1),!u&&!0!==t||(r(o,n,i),u=!1,i.length=0),this}};return s}}function ke(t,r){return Re.set(t,Te(r))}var Ce,Se=Object.freeze({__proto__:null,applyOffset:Mt,clamp:Dt,conditional:function(r,e){return function(t){return r(t)?e(t):t}},interpolate:function(t,r,e){var n=void 0===e?{}:e,o=n.clamp,i=void 0===o||o,u=n.ease,a=n.mixer,s=t.length;r.length,u&&Array.isArray(u)&&u.length,t[0]>t[s-1]&&(t=[].concat(t),r=[].concat(r),t.reverse(),r.reverse());var c,f,p,d,l,v,h,m,g,y=Ht(r,u,a),b=2===s?(v=y,h=(l=t)[0],m=l[1],g=v[0],function(t){return g(Ft(h,m,t))}):(f=y,p=(c=t).length,d=p-1,function(t){var r=0,e=!1;if(t<=c[0]?e=!0:t>=c[d]&&(r=d-1,e=!0),!e){for(var n=1;n<p&&!(c[n]>t||n===d);n++);r=n-1}var o=Ft(c[r],c[r+1],t);return f[r](o)});return i?It(Dt(t[0],t[s-1]),b):b},blendArray:Wt,blendColor:Lt,pipe:It,smooth:function(o){void 0===o&&(o=50);var i=0,u=0;return function(t){var r=et.timestamp,e=r!==u?r-u:0,n=e?Ut(i,t,e,o):i;return u=r,i=n}},snap:function(o){if("number"==typeof o)return function(t){return Math.round(t/o)*o};var i=0,u=o.length;return function(t){var r=Math.abs(o[0]-t);for(i=1;i<u;i++){var e=o[i],n=Math.abs(e-t);if(0===n)return e;if(r<n)return o[i-1];if(i===u-1)return e;r=n}}},generateStaticSpring:Gt,nonlinearSpring:tr,linearSpring:Qt,wrap:rr,appendUnit:function(r){return function(t){return""+t+r}},steps:function(e,n,o){return void 0===n&&(n=0),void 0===o&&(o=1),function(t){var r=Ft(n,o,t);return Tt(n,o,yr(e,r))}},transformMap:function(o){return function(t){var r,e=A({},t);for(var n in o){o.hasOwnProperty(n)&&(r=o[n],e[n]=r(t[n]))}return e}}}),Pe=/([a-z])([A-Z])/g,Te=function(t){return t.replace(Pe,"$1-$2").toLowerCase()},Ve=new Map,Re=new Map,je=["Webkit","Moz","O","ms",""],_e=je.length,Ee="undefined"!=typeof document,De=function(t,r){void 0===r&&(r=!1);var e,n=r?Re:Ve;return n.has(t)||(Ee?function(t){Ce=Ce||document.createElement("div");for(var r=0;r<_e;r++){var e=je[r],n=""===e,o=n?t:e+t.charAt(0).toUpperCase()+t.slice(1);if(o in Ce.style||n){if(n&&"clipPath"===t&&Re.has(t))return;Ve.set(t,o),ke(t,(n?"":"-")+Te(o))}}}(t):ke(e=t,e)),n.get(t)||t},Fe=["","X","Y","Z"],Xe=["translate","scale","rotate","skew","transformPerspective"].reduce(function(t,e){return Fe.reduce(function(t,r){return t.push(e+r),t},t)},["x","y","z"]),Ye=Xe.reduce(function(t,r){return t[r]=!0,t},{});function Le(t){return!0===Ye[t]}function Ie(t,r){return Xe.indexOf(t)-Xe.indexOf(r)}var ze=new Set(["originX","originY","originZ"]);var We=A(A({},d),{transform:Math.round}),Be={color:N,backgroundColor:N,outlineColor:N,fill:N,stroke:N,borderColor:N,borderTopColor:N,borderRightColor:N,borderBottomColor:N,borderLeftColor:N,borderWidth:g,borderTopWidth:g,borderRightWidth:g,borderBottomWidth:g,borderLeftWidth:g,borderRadius:g,radius:g,borderTopLeftRadius:g,borderTopRightRadius:g,borderBottomRightRadius:g,borderBottomLeftRadius:g,width:g,maxWidth:g,height:g,maxHeight:g,size:g,top:g,right:g,bottom:g,left:g,padding:g,paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g,margin:g,marginTop:g,marginRight:g,marginBottom:g,marginLeft:g,rotate:h,rotateX:h,rotateY:h,rotateZ:h,scale:v,scaleX:v,scaleY:v,scaleZ:v,skew:h,skewX:h,skewY:h,distance:g,translateX:g,translateY:g,translateZ:g,x:g,y:g,z:g,perspective:g,opacity:l,originX:O,originY:O,originZ:g,zIndex:We,fillOpacity:l,strokeOpacity:l,numOctaves:We},qe=function(t){return Be[t]},Ne=function(t,r){return r&&"number"==typeof t?r.transform(t):t},Ze="scrollLeft",He="scrollTop",Ue=new Set([Ze,He]),$e=new Set([Ze,He,"transform"]),Ge={x:"translateX",y:"translateY",z:"translateZ"};function Ke(t){return"function"==typeof t}function Je(t,r,e,n,o,i,u,a){void 0===r&&(r=!0),void 0===e&&(e={}),void 0===n&&(n={}),void 0===o&&(o={}),void 0===i&&(i=[]),void 0===u&&(u=!1),void 0===a&&(a=!0);var s,c=!0,f=!1,p=!1;for(var d in t){var l=t[d],v=qe(d),h=Ne(l,v);Le(d)?(f=!0,n[d]=h,i.push(d),c&&(v.default&&l!==v.default||!v.default&&0!==l)&&(c=!1)):(s=d,ze.has(s)?(o[d]=h,p=!0):$e.has(d)&&Ke(h)||(e[De(d,u)]=h))}return!f&&"function"!=typeof t.transform||(e.transform=function(t,r,e,n,o,i){void 0===i&&(i=!0);var u="",a=!1;e.sort(Ie);for(var s=e.length,c=0;c<s;c++){var f=e[c];u+=(Ge[f]||f)+"("+r[f]+") ",a="z"===f||a}return!a&&o?u+="translateZ(0)":u=u.trim(),Ke(t.transform)?u=t.transform(r,n?"":u):i&&n&&(u="none"),u}(t,n,i,c,r,a)),p&&(e.transformOrigin=(o.originX||"50%")+" "+(o.originY||"50%")+" "+(o.originZ||0)),e}function Qe(t){var r=void 0===t?{}:t,e=r.enableHardwareAcceleration,n=void 0===e||e,o=r.isDashCase,i=void 0===o||o,u=r.allowTransformNone,a=void 0===u||u,s={},c={},f={},p=[];return function(t){return p.length=0,Je(t,n,s,c,f,p,i,a),s}}var tn=Ae({onRead:function(t,r){var e=r.element,n=r.preparseOutput,o=qe(t);if(Le(t))return o&&o.default||0;if(Ue.has(t))return e[t];var i=window.getComputedStyle(e,null).getPropertyValue(De(t,!0))||0;return n&&o&&o.test(i)&&o.parse?o.parse(i):i},onRender:function(t,r,e){var n=r.element,o=r.buildStyles,i=r.hasCSSVariable;if(Object.assign(n.style,o(t)),i)for(var u=e.length,a=0;a<u;a++){var s=e[a];s.startsWith("--")&&n.style.setProperty(s,t[s])}-1!==e.indexOf(Ze)&&(n[Ze]=t[Ze]),-1!==e.indexOf(He)&&(n[He]=t[He])},uncachedValues:Ue});var rn=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),en=.5,nn=function(){return{style:{}}},on=function(t,r){return g.transform(t*r)},un={x:0,y:0,width:0,height:0};function an(t,r,e){return"string"==typeof t?t:g.transform(r+e*t)}var sn={enableHardwareAcceleration:!1,isDashCase:!1};function cn(t,r,e,n,o,i){void 0===r&&(r=un),void 0===n&&(n=Qe(sn)),void 0===o&&(o=nn()),void 0===i&&(i=!0);var u,a,s=t.attrX,c=t.attrY,f=t.originX,p=t.originY,d=t.pathLength,l=t.pathSpacing,v=void 0===l?1:l,h=t.pathOffset,m=void 0===h?0:h,g=n(b(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var y in g){"transform"===y?o.style.transform=g[y]:o[i&&!rn.has(y)?Te(y):y]=g[y]}return void 0===f&&void 0===p&&!g.transform||(o.style.transformOrigin=(a=void 0!==p?p:en,an(void 0!==f?f:en,(u=r).x,u.width)+" "+an(a,u.y,u.height))),void 0!==s&&(o.x=s),void 0!==c&&(o.y=c),void 0!==e&&void 0!==d&&(o[i?"stroke-dashoffset":"strokeDashoffset"]=on(-m,e),o[i?"stroke-dasharray":"strokeDasharray"]=on(d,e)+" "+on(v,e)),o}function fn(t){var r=function(t){try{return"function"==typeof(r=t).getBBox?r.getBBox():r.getBoundingClientRect()}catch(t){return{x:0,y:0,width:0,height:0}}var r}(t),e="path"===t.tagName&&t.getTotalLength?t.getTotalLength():void 0;return dn({element:t,buildAttrs:function(r,e,n){void 0===n&&(n=!0);var o=nn(),i=Qe(sn);return function(t){return cn(t,r,e,i,o,n)}}(r,e)})}function pn(t,r){var e,n,o;return t===window?e=ln(t):(o=t)instanceof HTMLElement||"function"==typeof o.click?e=function(t,r){void 0===r&&(r={});var e=r.enableHardwareAcceleration,n=r.allowTransformNone,o=b(r,["enableHardwareAcceleration","allowTransformNone"]);return tn(A({element:t,buildStyles:Qe({enableHardwareAcceleration:e,allowTransformNone:n}),preparseOutput:!0},o))}(t,r):((n=t)instanceof SVGElement||"ownerSVGElement"in n)&&(e=fn(t)),vn.set(t,e),e}var dn=Ae({onRead:function(t,r){var e=r.element;if(Le(t=rn.has(t)?t:Te(t))){var n=qe(t);return n&&n.default||0}return e.getAttribute(t)},onRender:function(t,r){var e=r.element,n=(0,r.buildAttrs)(t);for(var o in n)"style"===o?Object.assign(e.style,n.style):e.setAttribute(o,n[o])}}),ln=Ae({useCache:!1,onRead:function(t){return"scrollTop"===t?window.pageYOffset:window.pageXOffset},onRender:function(t){var r=t.scrollTop,e=void 0===r?0:r,n=t.scrollLeft,o=void 0===n?0:n;return window.scrollTo(o,e)}}),vn=new WeakMap;function hn(t,r){var e,n,o="string"==typeof t?document.querySelector(t):t;return e=o,n=r,vn.has(e)?vn.get(e):pn(e,n)}var mn=hn,gn=hn;t.Action=ar,t.ValueReaction=Er,t.action=cr,t.calc=_r,t.chain=Me,t.composite=re,t.crossfade=function(r,e){return cr(function(n){var o=0,t=Xr(r,e).start(A(A({},n),{update:function(t){var r=t[0],e=t[1];n.update(Tt(r,e,o))}}));return{setBalance:function(t){return o=t},stop:function(){return t.stop()}}})},t.css=mn,t.decay=ae,t.delay=xe,t.easing=_t,t.everyFrame=function(){return cr(function(t){var e=t.update,n=0,r=Tr.update(function(t){var r=t.timestamp;e(r-(n=n||r))},!0,!0);return{stop:function(){return Vr.update(r)}}})},t.inertia=ce,t.keyframes=$r,t.listen=Jr,t.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cr(function(r){var t=e.map(function(t){return t.start(r)});return{stop:function(){return t.forEach(function(t){return t.stop()})}}})},t.mouse=be,t.multicast=function(){return new vr},t.multitouch=me,t.parallel=Xr,t.physics=le,t.pointer=function(t){void 0===t&&(t={});var r=t.x,e=t.y,n=b(t,["x","y"]);if(void 0===r&&void 0===e)return Oe(n);var o=Mt(r||0),i=Mt(e||0),u={x:0,y:0};return Oe(n).pipe(function(t){return u.x=o(t.x),u.y=i(t.y),u})},t.schedule=function(u,a){return cr(function(t){var r,e=t.update,n=t.complete,o=u.start({update:function(){return void 0!==r&&e(r)},complete:n}),i=a.start({update:function(t){return r=t},complete:n});return{stop:function(){o.stop(),i.stop()}}})},t.spring=se,t.stagger=function(t,n){var o="number"==typeof n,r=t.map(function(t,r){var e=o?n*r:n(r);return Me(xe(e),t)});return Xr.apply(void 0,r)},t.styler=hn,t.svg=gn,t.timeline=function(t,r){var e=void 0===r?{}:r,n=e.duration,o=e.elapsed,i=e.ease,u=e.loop,a=e.flip,s=e.yoyo,c=0,f=0,p=t.reduce(Gr,[]),d=[];p.forEach(function(t){var r;"string"==typeof t?c+=parseFloat(t):"number"==typeof t?c=t:((r=A(A({},t),{at:c})).duration=void 0===r.duration?300:r.duration,d.push(r),c+=r.duration,f=Math.max(f,r.at+r.duration))});for(var l={},v=d.length,h=0;h<v;h++){var m=d[h],g=m.track;if(void 0===g)throw new Error("No track defined");l.hasOwnProperty(g)||(l[g]=[]),l[g].push(m)}var y,b={};for(var w in l){l.hasOwnProperty(w)&&(y=l[w].reduce(Kr,{duration:f,easings:[],times:[],values:[]}),b[w]=$r(A(A({},y),{duration:n||f,ease:i,elapsed:o,loop:u,yoyo:s,flip:a})))}return re(b)},t.transform=Se,t.tween=Ur,t.value=function(t,r){return new Er({value:t,initialSubscription:r})},t.valueTypes=$,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -8,14 +8,14 @@ (function (global, factory) { | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -54,10 +54,8 @@ | ||
var SpringAnimator = (function () { | ||
function SpringAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
this.createSpring(); | ||
} | ||
SpringAnimator.prototype.createSpring = function () { | ||
var _a = this.options, velocity = _a.velocity, from = _a.from, to = _a.to, damping = _a.damping, stiffness = _a.stiffness, mass = _a.mass; | ||
function spring(_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 2 : _h, restDelta = _a.restDelta; | ||
var state = { done: false, value: from }; | ||
var resolveSpring = zero; | ||
var resolveVelocity = zero; | ||
function createSpring() { | ||
var initialVelocity = velocity ? -(velocity / 1000) : 0.0; | ||
@@ -67,4 +65,5 @@ var initialDelta = to - from; | ||
var angularFreq = Math.sqrt(stiffness / mass) / 1000; | ||
restDelta !== null && restDelta !== void 0 ? restDelta : (restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4); | ||
if (dampingRatio < 1) { | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -80,3 +79,3 @@ var expoDecay = angularFreq * Math.sqrt(1.0 - dampingRatio * dampingRatio); | ||
}; | ||
this.resolveVelocity = function (t) { | ||
resolveVelocity = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -100,3 +99,3 @@ var expoDecay = angularFreq * Math.sqrt(1.0 - dampingRatio * dampingRatio); | ||
else if (dampingRatio === 1) { | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-angularFreq * t); | ||
@@ -108,7 +107,6 @@ return (to - | ||
}; | ||
this.resolveVelocity = function () { return 0; }; | ||
} | ||
else { | ||
var dampedAngularFreq_1 = angularFreq * Math.sqrt(dampingRatio * dampingRatio - 1); | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -125,51 +123,28 @@ return (to - | ||
}; | ||
this.resolveVelocity = function () { return 0; }; | ||
} | ||
} | ||
createSpring(); | ||
return { | ||
next: function (t) { | ||
var current = resolveSpring(t); | ||
var velocity = resolveVelocity(t) * 1000; | ||
var isBelowVelocityThreshold = Math.abs(velocity) <= restSpeed; | ||
var isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta; | ||
state.done = | ||
isBelowVelocityThreshold && isBelowDisplacementThreshold; | ||
state.value = state.done ? to : current; | ||
return state; | ||
}, | ||
flipTarget: function () { | ||
var _a; | ||
velocity = -velocity; | ||
_a = [to, from], from = _a[0], to = _a[1]; | ||
createSpring(); | ||
}, | ||
}; | ||
SpringAnimator.prototype.update = function (t) { | ||
var _a = this.options, restSpeed = _a.restSpeed, restDelta = _a.restDelta, to = _a.to; | ||
var latest = this.resolveSpring(t); | ||
var velocity = this.resolveVelocity(t) * 1000; | ||
var isBelowVelocityThreshold = Math.abs(velocity) <= restSpeed; | ||
var isBelowDisplacementThreshold = Math.abs(to - latest) <= restDelta; | ||
this.isComplete = | ||
isBelowVelocityThreshold && isBelowDisplacementThreshold; | ||
return this.isComplete ? to : latest; | ||
}; | ||
SpringAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 2 : _h, restDelta = _a.restDelta; | ||
if (restDelta === undefined) { | ||
restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4; | ||
} | ||
this.options = { | ||
from: from, | ||
to: to, | ||
velocity: velocity, | ||
stiffness: stiffness, | ||
damping: damping, | ||
mass: mass, | ||
restSpeed: restSpeed, | ||
restDelta: restDelta, | ||
}; | ||
}; | ||
SpringAnimator.prototype.flipTarget = function () { | ||
var _a = this.options, from = _a.from, to = _a.to, velocity = _a.velocity; | ||
this.options.velocity = -velocity; | ||
this.options.from = to; | ||
this.options.to = from; | ||
this.createSpring(); | ||
}; | ||
SpringAnimator.needsInterpolation = function (from, to) { | ||
return typeof from === "string" || typeof to === "string"; | ||
}; | ||
SpringAnimator.uniqueOptionKeys = new Set([ | ||
"velocity", | ||
"stiffness", | ||
"damping", | ||
"mass", | ||
"restSpeed", | ||
"restDelta", | ||
]); | ||
return SpringAnimator; | ||
}()); | ||
} | ||
spring.needsInterpolation = function (a, b) { | ||
return typeof a === "string" || typeof b === "string"; | ||
}; | ||
var zero = function (_t) { return 0; }; | ||
@@ -673,90 +648,49 @@ var progress = function (from, to, value) { | ||
} | ||
var KeyframesAnimator = (function () { | ||
function KeyframesAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
var _a = this.options, from = _a.from, to = _a.to; | ||
this.values = Array.isArray(to) ? to : [from, to]; | ||
this.createInterpolator(); | ||
function keyframes(_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.to, to = _c === void 0 ? 1 : _c, ease = _a.ease, offset = _a.offset, _d = _a.duration, duration = _d === void 0 ? 300 : _d; | ||
var state = { done: false, value: from }; | ||
var values = Array.isArray(to) ? to : [from, to]; | ||
var times = convertOffsetToTimes(offset !== null && offset !== void 0 ? offset : defaultOffset(values), duration); | ||
function createInterpolator() { | ||
return interpolate(times, values, { | ||
ease: Array.isArray(ease) ? ease : defaultEasing(values, ease), | ||
}); | ||
} | ||
KeyframesAnimator.prototype.createInterpolator = function () { | ||
var _a = this.options, duration = _a.duration, ease = _a.ease, offset = _a.offset; | ||
ease = Array.isArray(ease) ? ease : defaultEasing(this.values, ease); | ||
offset = offset || defaultOffset(this.values); | ||
var times = convertOffsetToTimes(offset, duration); | ||
this.interpolator = interpolate(times, this.values, { ease: ease }); | ||
var interpolator = createInterpolator(); | ||
return { | ||
next: function (t) { | ||
state.value = interpolator(t); | ||
state.done = t >= duration; | ||
return state; | ||
}, | ||
flipTarget: function () { | ||
values.reverse(); | ||
interpolator = createInterpolator(); | ||
}, | ||
}; | ||
KeyframesAnimator.prototype.update = function (t) { | ||
var duration = this.options.duration; | ||
this.isComplete = t >= duration; | ||
return this.interpolator(t); | ||
}; | ||
KeyframesAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.to, to = _c === void 0 ? 1 : _c, ease = _a.ease, offset = _a.offset, _d = _a.duration, duration = _d === void 0 ? 300 : _d; | ||
this.options = { from: from, to: to, ease: ease, offset: offset, duration: duration }; | ||
}; | ||
KeyframesAnimator.prototype.flipTarget = function () { | ||
this.values.reverse(); | ||
this.createInterpolator(); | ||
}; | ||
KeyframesAnimator.needsInterpolation = function () { return false; }; | ||
KeyframesAnimator.uniqueOptionKeys = new Set([ | ||
"duration", | ||
"ease", | ||
]); | ||
return KeyframesAnimator; | ||
}()); | ||
} | ||
var DecayAnimator = (function () { | ||
function DecayAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
var _a = this.options, power = _a.power, velocity = _a.velocity, modifyTarget = _a.modifyTarget, from = _a.from; | ||
var amplitude = power * velocity; | ||
var idealTarget = from + amplitude; | ||
var target = typeof modifyTarget === "undefined" | ||
? idealTarget | ||
: modifyTarget(idealTarget); | ||
if (target !== idealTarget) | ||
amplitude = target - from; | ||
this.target = target; | ||
this.amplitude = amplitude; | ||
} | ||
DecayAnimator.prototype.flipTarget = function () { }; | ||
DecayAnimator.prototype.update = function (t) { | ||
var _a = this.options, timeConstant = _a.timeConstant, restDelta = _a.restDelta; | ||
var delta = -this.amplitude * Math.exp(-t / timeConstant); | ||
this.isComplete = !(delta > restDelta || delta < -restDelta); | ||
return this.isComplete ? this.target : this.target + delta; | ||
function decay(_a) { | ||
var _b = _a.velocity, velocity = _b === void 0 ? 0 : _b, _c = _a.from, from = _c === void 0 ? 0 : _c, _d = _a.power, power = _d === void 0 ? 0.8 : _d, _e = _a.timeConstant, timeConstant = _e === void 0 ? 350 : _e, _f = _a.restDelta, restDelta = _f === void 0 ? 0.5 : _f, modifyTarget = _a.modifyTarget; | ||
var state = { done: false, value: from }; | ||
var amplitude = power * velocity; | ||
var ideal = from + amplitude; | ||
var target = modifyTarget === undefined ? ideal : modifyTarget(ideal); | ||
if (target !== ideal) | ||
amplitude = target - from; | ||
return { | ||
next: function (t) { | ||
var delta = -amplitude * Math.exp(-t / timeConstant); | ||
state.done = !(delta > restDelta || delta < -restDelta); | ||
state.value = state.done ? target : target + delta; | ||
return state; | ||
}, | ||
flipTarget: function () { }, | ||
}; | ||
DecayAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.velocity, velocity = _c === void 0 ? 0 : _c, _d = _b.from, from = _d === void 0 ? 0 : _d, _e = _b.power, power = _e === void 0 ? 0.8 : _e, _f = _b.timeConstant, timeConstant = _f === void 0 ? 350 : _f, _g = _b.restDelta, restDelta = _g === void 0 ? 0.5 : _g, modifyTarget = _b.modifyTarget; | ||
this.options = { | ||
velocity: velocity, | ||
from: from, | ||
power: power, | ||
timeConstant: timeConstant, | ||
restDelta: restDelta, | ||
modifyTarget: modifyTarget, | ||
}; | ||
}; | ||
DecayAnimator.needsInterpolation = function () { return false; }; | ||
DecayAnimator.uniqueOptionKeys = new Set([ | ||
"power", | ||
"timeConstant", | ||
"modifyTarget", | ||
]); | ||
return DecayAnimator; | ||
}()); | ||
} | ||
var animators = [KeyframesAnimator, DecayAnimator, SpringAnimator]; | ||
var types = { | ||
keyframes: KeyframesAnimator, | ||
spring: SpringAnimator, | ||
decay: DecayAnimator, | ||
}; | ||
var numAnimators = animators.length; | ||
var types = { keyframes: keyframes, spring: spring, decay: decay }; | ||
function detectAnimationFromOptions(config) { | ||
if (Array.isArray(config.to)) { | ||
return KeyframesAnimator; | ||
return keyframes; | ||
} | ||
@@ -766,21 +700,16 @@ else if (types[config.type]) { | ||
} | ||
for (var key in config) { | ||
for (var i = 0; i < numAnimators; i++) { | ||
var animator = animators[i]; | ||
if (animator.uniqueOptionKeys.has(key)) | ||
return animator; | ||
} | ||
var keys = new Set(Object.keys(config)); | ||
if (keys.has("ease") || keys.has("duration")) { | ||
return keyframes; | ||
} | ||
return KeyframesAnimator; | ||
else if (keys.has("stiffness") || | ||
keys.has("mass") || | ||
keys.has("damping") || | ||
keys.has("restSpeed") || | ||
keys.has("restDelta")) { | ||
return spring; | ||
} | ||
return keyframes; | ||
} | ||
var invariant$1 = function () { }; | ||
{ | ||
invariant$1 = function (check, message) { | ||
if (!check) { | ||
throw new Error(message); | ||
} | ||
}; | ||
} | ||
var prevTime = 0; | ||
@@ -840,3 +769,3 @@ var onNextFrame = typeof window !== 'undefined' && window.requestAnimationFrame !== undefined ? function (callback) { | ||
} | ||
invariant$1(typeof process === "function", "Argument must be a function"); | ||
invariant(typeof process === "function", "Argument must be a function"); | ||
var addToCurrentBuffer = immediate && isProcessing; | ||
@@ -942,3 +871,4 @@ var buffer = addToCurrentBuffer ? processToRun : processToRunNextFrame; | ||
function animate(_a) { | ||
var from = _a.from, _b = _a.autoplay, autoplay = _b === void 0 ? true : _b, _c = _a.driver, driver = _c === void 0 ? framesync : _c, _d = _a.elapsed, elapsed = _d === void 0 ? 0 : _d, _e = _a.repeat, repeatMax = _e === void 0 ? 0 : _e, _f = _a.repeatType, repeatType = _f === void 0 ? "loop" : _f, _g = _a.repeatDelay, repeatDelay = _g === void 0 ? 0 : _g, onPlay = _a.onPlay, onStop = _a.onStop, onComplete = _a.onComplete, onRepeat = _a.onRepeat, onUpdate = _a.onUpdate, options = __rest(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]); | ||
var _b, _c; | ||
var from = _a.from, _d = _a.autoplay, autoplay = _d === void 0 ? true : _d, _e = _a.driver, driver = _e === void 0 ? framesync : _e, _f = _a.elapsed, elapsed = _f === void 0 ? 0 : _f, _g = _a.repeat, repeatMax = _g === void 0 ? 0 : _g, _h = _a.repeatType, repeatType = _h === void 0 ? "loop" : _h, _j = _a.repeatDelay, repeatDelay = _j === void 0 ? 0 : _j, onPlay = _a.onPlay, onStop = _a.onStop, onComplete = _a.onComplete, onRepeat = _a.onRepeat, onUpdate = _a.onUpdate, options = __rest(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]); | ||
var to = options.to; | ||
@@ -952,4 +882,4 @@ var driverControls; | ||
var interpolateFromNumber; | ||
var Animator = detectAnimationFromOptions(options); | ||
if (Animator.needsInterpolation(from, to)) { | ||
var animator = detectAnimationFromOptions(options); | ||
if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) { | ||
interpolateFromNumber = interpolate([0, 100], [from, to], { | ||
@@ -961,3 +891,3 @@ clamp: false, | ||
} | ||
var animation = new Animator(__assign(__assign({}, options), { from: from, to: to })); | ||
var animation = animator(__assign(__assign({}, options), { from: from, to: to })); | ||
function repeat() { | ||
@@ -975,3 +905,2 @@ repeatCount++; | ||
isComplete = false; | ||
animation.isComplete = false; | ||
onRepeat && onRepeat(); | ||
@@ -988,12 +917,12 @@ } | ||
if (!isComplete) { | ||
latest = animation.update(Math.max(0, elapsed)); | ||
var state = animation.next(Math.max(0, elapsed)); | ||
latest = state.value; | ||
if (interpolateFromNumber) | ||
latest = interpolateFromNumber(latest); | ||
isComplete = isForwardPlayback ? animation.isComplete : elapsed <= 0; | ||
isComplete = isForwardPlayback ? state.done : elapsed <= 0; | ||
} | ||
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest); | ||
if (isComplete) { | ||
if (repeatCount === 0 && computedDuration === undefined) { | ||
computedDuration = elapsed; | ||
} | ||
if (repeatCount === 0) | ||
computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed); | ||
if (repeatCount < repeatMax) { | ||
@@ -1014,7 +943,2 @@ hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat(); | ||
return { | ||
play: play, | ||
pause: function () { }, | ||
resume: function () { }, | ||
reverse: function () { }, | ||
seek: function () { }, | ||
stop: function () { | ||
@@ -1068,6 +992,7 @@ onStop === null || onStop === void 0 ? void 0 : onStop(); | ||
prev_1 = current_1; | ||
current_1 = v; | ||
velocity = velocityPerSecond(v - prev_1, getFrameData().delta); | ||
current_1 = v; | ||
if (!(boundary_1 - v * heading_1 > 0)) { | ||
startSpring({ from: current_1, to: boundary_1, velocity: velocity }); | ||
if ((heading_1 === 1 && v > boundary_1) || | ||
(heading_1 === -1 && v < boundary_1)) { | ||
startSpring({ from: v, to: boundary_1, velocity: velocity }); | ||
} | ||
@@ -1310,5 +1235,2 @@ }; | ||
exports.DecayAnimator = DecayAnimator; | ||
exports.KeyframesAnimator = KeyframesAnimator; | ||
exports.SpringAnimator = SpringAnimator; | ||
exports.angle = angle; | ||
@@ -1335,2 +1257,3 @@ exports.animate = animate; | ||
exports.cubicBezier = cubicBezier; | ||
exports.decay = decay; | ||
exports.degreesToRadians = degreesToRadians; | ||
@@ -1345,2 +1268,3 @@ exports.distance = distance; | ||
exports.isPoint3D = isPoint3D; | ||
exports.keyframes = keyframes; | ||
exports.linear = linear; | ||
@@ -1359,2 +1283,3 @@ exports.mirrorEasing = mirrorEasing; | ||
exports.snap = snap; | ||
exports.spring = spring; | ||
exports.steps = steps$1; | ||
@@ -1361,0 +1286,0 @@ exports.toDecimal = toDecimal; |
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).popmotion={})}(this,function(t){"use strict";var j=function(){return(j=Object.assign||function(t){for(var r,n=1,e=arguments.length;n<e;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)};var r=(n.prototype.createSpring=function(){var n,t=this.options,r=t.velocity,e=t.from,o=t.to,i=t.damping,a=t.stiffness,u=t.mass,s=r?-r/1e3:0,f=o-e,p=i/(2*Math.sqrt(a*u)),c=Math.sqrt(a/u)/1e3;p<1?(this.resolveSpring=function(t){var r=Math.exp(-p*c*t),n=c*Math.sqrt(1-p*p);return o-r*((s+p*c*f)/n*Math.sin(n*t)+f*Math.cos(n*t))},this.resolveVelocity=function(t){var r=Math.exp(-p*c*t),n=c*Math.sqrt(1-p*p);return p*c*r*(Math.sin(n*t)*(s+p*c*f)/n+f*Math.cos(n*t))-r*(Math.cos(n*t)*(s+p*c*f)-n*f*Math.sin(n*t))}):(1==p?this.resolveSpring=function(t){var r=Math.exp(-c*t);return o-r*(f+(s+c*f)*t)}:(n=c*Math.sqrt(p*p-1),this.resolveSpring=function(t){var r=Math.exp(-p*c*t);return o-r*((s+p*c*f)*Math.sinh(n*t)+n*f*Math.cosh(n*t))/n}),this.resolveVelocity=function(){return 0})},n.prototype.update=function(t){var r=this.options,n=r.restSpeed,e=r.restDelta,o=r.to,i=this.resolveSpring(t),a=1e3*this.resolveVelocity(t),u=Math.abs(a)<=n,s=Math.abs(o-i)<=e;return this.isComplete=u&&s,this.isComplete?o:i},n.prototype.updateOptions=function(t){var r=t.from,n=void 0===r?0:r,e=t.to,o=void 0===e?0:e,i=t.velocity,a=void 0===i?0:i,u=t.stiffness,s=void 0===u?100:u,f=t.damping,p=void 0===f?10:f,c=t.mass,v=void 0===c?1:c,l=t.restSpeed,d=void 0===l?2:l,h=t.restDelta;void 0===h&&(h=Math.abs(o-n)<=1?.01:.4),this.options={from:n,to:o,velocity:a,stiffness:s,damping:p,mass:v,restSpeed:d,restDelta:h}},n.prototype.flipTarget=function(){var t=this.options,r=t.from,n=t.to,e=t.velocity;this.options.velocity=-e,this.options.from=n,this.options.to=r,this.createSpring()},n.needsInterpolation=function(t,r){return"string"==typeof t||"string"==typeof r},n.uniqueOptionKeys=new Set(["velocity","stiffness","damping","mass","restSpeed","restDelta"]),n);function n(t){this.isComplete=!1,this.updateOptions(t),this.createSpring()}function s(t,r,n){return-n*t+n*r+t}function e(r,n){return function(t){return Math.max(Math.min(t,n),r)}}function c(t){return t%1?Number(t.toFixed(5)):t}function o(t){return void 0!==t.red}function i(t){return void 0!==t.hue}var a,b=function(t,r,n){var e=r-t;return 0==e?1:(n-t)/e},f=/(-)?(\d[\d\.]*)/g,p=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,u=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,v={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},l=j(j({},v),{transform:e(0,1)}),d=(j(j({},v),{default:1}),a="%",{test:function(t){return"string"==typeof t&&t.endsWith(a)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+a}}),h=(j(j({},d),{parse:function(t){return d.parse(t)/100},transform:function(t){return d.transform(100*t)}}),e(0,255));function m(i){return function(t){if("string"!=typeof t)return t;for(var r,n={},e=(r=t).substring(r.indexOf("(")+1,r.lastIndexOf(")")).replace(/(,|\/)/g," ").split(/ \s*/),o=0;o<4;o++)n[i[o]]=void 0!==e[o]?parseFloat(e[o]):1;return n}}var y=j(j({},v),{transform:function(t){return Math.round(h(t))}});function g(t,r){return t.startsWith(r)&&u.test(t)}function M(t){return"number"==typeof t?0:t}function x(t,r,n){var e=t*t,o=r*r;return Math.sqrt(Math.max(0,n*(o-e)+e))}function O(r){return k.find(function(t){return t.test(r)})}function w(t){return"number"==typeof t}function I(r,n){return function(t){return n(r(t))}}var S={test:function(t){return"string"==typeof t?g(t,"rgb"):o(t)},parse:m(["red","green","blue","alpha"]),transform:function(t){var r,n,e,o,i,a=t.red,u=t.green,s=t.blue,f=t.alpha,p=void 0===f?1:f;return r={red:y.transform(a),green:y.transform(u),blue:y.transform(s),alpha:c(l.transform(p))},n=r.red,e=r.green,o=r.blue,i=r.alpha,"rgba("+n+", "+e+", "+o+", "+(void 0===i?1:i)+")"}},A={test:function(t){return"string"==typeof t?g(t,"hsl"):i(t)},parse:m(["hue","saturation","lightness","alpha"]),transform:function(t){var r,n,e,o,i,a=t.hue,u=t.saturation,s=t.lightness,f=t.alpha,p=void 0===f?1:f;return r={hue:Math.round(a),saturation:d.transform(c(u)),lightness:d.transform(c(s)),alpha:c(l.transform(p))},n=r.hue,e=r.saturation,o=r.lightness,i=r.alpha,"hsla("+n+", "+e+", "+o+", "+(void 0===i?1:i)+")"}},C=j(j({},S),{test:function(t){return"string"==typeof t&&g(t,"#")},parse:function(t){var r="",n="",e="";return 4<t.length?(r=t.substr(1,2),n=t.substr(3,2),e=t.substr(5,2)):(r=t.substr(1,1),n=t.substr(2,1),e=t.substr(3,1),r+=r,n+=n,e+=e),{red:parseInt(r,16),green:parseInt(n,16),blue:parseInt(e,16),alpha:1}}}),D={test:function(t){return"string"==typeof t&&u.test(t)||o(t)||i(t)},parse:function(t){return S.test(t)?S.parse(t):A.test(t)?A.parse(t):C.test(t)?C.parse(t):t},transform:function(t){return o(t)?S.transform(t):i(t)?A.transform(t):t}},T="${c}",P="${n}",q={test:function(t){if("string"!=typeof t||!isNaN(t))return!1;var r=0,n=t.match(f),e=t.match(p);return n&&(r+=n.length),e&&(r+=e.length),0<r},parse:function(t){var r=t,n=[],e=r.match(p);e&&(r=r.replace(p,T),n.push.apply(n,e.map(D.parse)));var o=r.match(f);return o&&n.push.apply(n,o.map(v.parse)),n},createTransformer:function(t){var e=t,o=0,r=t.match(p),i=r?r.length:0;if(r)for(var n=0;n<i;n++)e=e.replace(r[n],T),o++;var a=e.match(f),u=a?a.length:0;if(a)for(n=0;n<u;n++)e=e.replace(a[n],P),o++;return function(t){for(var r=e,n=0;n<o;n++)r=r.replace(n<i?T:P,n<i?D.transform(t[n]):c(t[n]));return r}},getAnimatableNone:function(t){var r=q.parse(t);return q.createTransformer(t)(r.map(M))}},F=function(){},k=[C,S,A],E=function(t,r){var n=O(t),e=O(r);F(n.transform===e.transform);var o=n.parse(t),i=e.parse(r),a=j({},o),u=n===A?s:x;return function(t){for(var r in a)"alpha"!==r&&(a[r]=u(o[r],i[r],t));return a.alpha=s(o.alpha,i.alpha,t),n.transform(a)}},R={x:0,y:0,z:0},U=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.reduce(I)};function z(r,n){return w(r)?function(t){return s(r,n,t)}:(D.test(r)?E:W)(r,n)}var K=function(t,n){var e=function(){for(var t=0,r=0,n=arguments.length;r<n;r++)t+=arguments[r].length;for(var e=Array(t),o=0,r=0;r<n;r++)for(var i=arguments[r],a=0,u=i.length;a<u;a++,o++)e[o]=i[a];return e}(t),o=e.length,i=t.map(function(t,r){return z(t,n[r])});return function(t){for(var r=0;r<o;r++)e[r]=i[r](t);return e}},N=function(t,r){var n=j(j({},t),r),e={};for(var o in n)void 0!==t[o]&&void 0!==r[o]&&(e[o]=z(t[o],r[o]));return function(t){for(var r in e)n[r]=e[r](t);return n}};function V(t){for(var r=q.parse(t),n=r.length,e=0,o=0,i=0,a=0;a<n;a++)e||"number"==typeof r[a]?e++:void 0!==r[a].hue?i++:o++;return{parsed:r,numNumbers:e,numRGB:o,numHSL:i}}var W=function(t,r){var n=q.createTransformer(r),e=V(t),o=V(r);return U(K(e.parsed,o.parsed),n)},B=function(t,r,n){return Math.min(Math.max(n,t),r)},$=function(r,n){return function(t){return s(r,n,t)}};function _(t,r,n){for(var e,o=[],i=n||("number"==typeof(e=t[0])?$:"string"==typeof e?D.test(e)?E:W:Array.isArray(e)?K:"object"==typeof e?N:void 0),a=t.length-1,u=0;u<a;u++){var s,f=i(t[u],t[u+1]);r&&(s=Array.isArray(r)?r[u]:r,f=U(s,f)),o.push(f)}return o}function G(r,t,n){var e=void 0===n?{}:n,o=e.clamp,i=void 0===o||o,a=e.ease,u=e.mixer,s=r.length;F(s===t.length),F(!a||!Array.isArray(a)||a.length===s-1),r[0]>r[s-1]&&(r=[].concat(r),t=[].concat(t),r.reverse(),t.reverse());var f,p,c,v,l,d,h,m,y,g=_(t,a,u),M=2===s?(d=g,h=(l=r)[0],m=l[1],y=d[0],function(t){return y(b(h,m,t))}):(p=g,c=(f=r).length,v=c-1,function(t){var r=0,n=!1;if(t<=f[0]?n=!0:t>=f[v]&&(r=v-1,n=!0),!n){for(var e=1;e<c&&!(f[e]>t||e===v);e++);r=e-1}var o=b(f[r],f[r+1],t);return p[r](o)});return i?function(t){return M(B(r[0],r[s-1],t))}:M}function H(r){return function(t){return 1-r(1-t)}}function L(r){return function(t){return t<=.5?r(2*t)/2:(2-r(2*(1-t)))/2}}function J(r){return function(t){return Math.pow(t,r)}}function Q(r){return function(t){return t*t*((r+1)*t-r)}}function X(t){var r=Q(t);return function(t){return(t*=2)<1?.5*r(t):.5*(2-Math.pow(2,-10*(t-1)))}}function Y(t){return t}function Z(t){return 1-Math.sin(Math.acos(t))}function tt(t){if(1===t||0===t)return t;var r=t*t;return t<4/11?7.5625*r:t<8/11?9.075*r-9.9*t+3.4:t<.9?4356/361*r-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72}var rt=J(2),nt=H(rt),et=L(rt),ot=H(Z),it=L(ot),at=Q(1.525),ut=H(at),st=L(at),ft=X(1.525),pt=H(tt);var ct=(vt.prototype.createInterpolator=function(){var t,r,n,e,o,i=this.options,a=i.duration,u=i.ease,s=i.offset,u=Array.isArray(u)?u:(t=this.values,r=u,t.map(function(){return r||et}).splice(0,t.length-1)),s=s||(n=this.values,e=n.length,n.map(function(t,r){return 0!==r?r/(e-1):0})),f=(o=a,s.map(function(t){return t*o}));this.interpolator=G(f,this.values,{ease:u})},vt.prototype.update=function(t){var r=this.options.duration;return this.isComplete=r<=t,this.interpolator(t)},vt.prototype.updateOptions=function(t){var r=t.from,n=void 0===r?0:r,e=t.to,o=void 0===e?1:e,i=t.ease,a=t.offset,u=t.duration,s=void 0===u?300:u;this.options={from:n,to:o,ease:i,offset:a,duration:s}},vt.prototype.flipTarget=function(){this.values.reverse(),this.createInterpolator()},vt.needsInterpolation=function(){return!1},vt.uniqueOptionKeys=new Set(["duration","ease"]),vt);function vt(t){this.isComplete=!1,this.updateOptions(t);var r=this.options,n=r.from,e=r.to;this.values=Array.isArray(e)?e:[n,e],this.createInterpolator()}var lt=(dt.prototype.flipTarget=function(){},dt.prototype.update=function(t){var r=this.options,n=r.timeConstant,e=r.restDelta,o=-this.amplitude*Math.exp(-t/n);return this.isComplete=!(e<o||o<-e),this.isComplete?this.target:this.target+o},dt.prototype.updateOptions=function(t){var r=void 0===t?{}:t,n=r.velocity,e=void 0===n?0:n,o=r.from,i=void 0===o?0:o,a=r.power,u=void 0===a?.8:a,s=r.timeConstant,f=void 0===s?350:s,p=r.restDelta,c=void 0===p?.5:p,v=r.modifyTarget;this.options={velocity:e,from:i,power:u,timeConstant:f,restDelta:c,modifyTarget:v}},dt.needsInterpolation=function(){return!1},dt.uniqueOptionKeys=new Set(["power","timeConstant","modifyTarget"]),dt);function dt(t){this.isComplete=!1,this.updateOptions(t);var r=this.options,n=r.power,e=r.velocity,o=r.modifyTarget,i=r.from,a=n*e,u=i+a,s=void 0===o?u:o(u);s!==u&&(a=s-i),this.target=s,this.amplitude=a}var ht=[ct,lt,r],mt={keyframes:ct,spring:r,decay:lt},yt=ht.length;function gt(t){return It=t}function Mt(t){return Dt[t].process(At)}var bt=0,xt="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var r=Date.now(),n=Math.max(0,16.7-(r-bt));bt=r+n,setTimeout(function(){return t(bt)},n)},Ot=1/60*1e3,wt=!0,It=!1,St=!1,At={delta:0,timestamp:0},Ct=["read","update","preRender","render","postRender"],Dt=Ct.reduce(function(t,r){var e,i,a,u,s,o,f,p,c;return t[r]=(e=gt,i=[],s=!(a=[]),o=u=0,f=new WeakSet,p=new WeakSet,c={cancel:function(t){var r=a.indexOf(t);f.add(t),-1!==r&&a.splice(r,1)},process:function(t){var r,n;if(s=!0,i=(r=[a,i])[0],(a=r[1]).length=0,u=i.length)for(o=0;o<u;o++)(n=i[o])(t),!0!==p.has(n)||f.has(n)||(c.schedule(n),e(!0));s=!1},schedule:function(t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1);var e=n&&s,o=e?i:a;f.delete(t),r&&p.add(t),-1===o.indexOf(t)&&(o.push(t),e&&(u=i.length))}}),t},{}),Tt=Ct.reduce(function(t,r){var e=Dt[r];return t[r]=function(t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=!1),It||Ft(),e.schedule(t,r,n),t},t},{}),Pt=Ct.reduce(function(t,r){return t[r]=Dt[r].cancel,t},{}),qt=function(t){It=!1,At.delta=wt?Ot:Math.max(Math.min(t-At.timestamp,40),1),wt||(Ot=At.delta),At.timestamp=t,St=!0,Ct.forEach(Mt),St=!1,It&&(wt=!1,xt(qt))},Ft=function(){wt=It=!0,St||xt(qt)};function jt(t,r,n){return void 0===n&&(n=0),t-r-n}var kt=function(n){function t(t){var r=t.delta;return n(r)}return{start:function(){return Tt.update(t,!0,!0)},stop:function(){return Pt.update(t)}}};function Et(t){var o,i,a,r=t.from,n=t.autoplay,e=void 0===n||n,u=t.driver,s=void 0===u?kt:u,f=t.elapsed,p=void 0===f?0:f,c=t.repeat,v=void 0===c?0:c,l=t.repeatType,d=void 0===l?"loop":l,h=t.repeatDelay,m=void 0===h?0:h,y=t.onPlay,g=t.onStop,M=t.onComplete,b=t.onRepeat,x=t.onUpdate,O=function(t,r){var n={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.indexOf(e)<0&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,e=Object.getOwnPropertySymbols(t);o<e.length;o++)r.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(n[e[o]]=t[e[o]]);return n}(t,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]),w=O.to,I=0,S=O.duration,A=!1,C=!0,D=function(t){if(Array.isArray(t.to))return ct;if(mt[t.type])return mt[t.type];for(var r in t)for(var n=0;n<yt;n++){var e=ht[n];if(e.uniqueOptionKeys.has(r))return e}return ct}(O);D.needsInterpolation(r,w)&&(a=G([0,100],[r,w],{clamp:!1}),r=0,w=100);var T=new D(j(j({},O),{from:r,to:w}));function P(){var t,r,n,e;I++,"reverse"===d?(t=p,r=S,void 0===(n=m)&&(n=0),void 0===(e=C=I%2==0)&&(e=!0),p=e?jt(r+-t,r,n):r-(t-r)+n):(p=jt(p,S,m),"mirror"===d&&T.flipTarget()),A=!1,T.isComplete=!1,b&&b()}function q(t){var r,n,e;C||(t=-t),p+=t,A||(i=T.update(Math.max(0,p)),a&&(i=a(i)),A=C?T.isComplete:p<=0),null!=x&&x(i),A&&(0===I&&void 0===S&&(S=p),I<v?(r=p,n=S,e=m,(C?n+e<=r:r<=-e)&&P()):(o.stop(),M&&M()))}function F(){null!=y&&y(),(o=s(q)).start()}return e&&F(),{play:F,pause:function(){},resume:function(){},reverse:function(){},seek:function(){},stop:function(){null!=g&&g(),o.stop()}}}function Rt(t,r){return r?t*(1e3/r):0}function Ut(t){return 180*t/Math.PI}function zt(t){return t}function Kt(i){return void 0===i&&(i=zt),function(t,r,n){var e=r-n,o=-(0-t+1)*(0-i(Math.abs(e)));return e<=0?r+o:r-o}}function Nt(t){return t*Math.PI/180}function Vt(t){return t.hasOwnProperty("x")&&t.hasOwnProperty("y")}function Wt(t){return Vt(t)&&t.hasOwnProperty("z")}function Bt(t,r){return Math.abs(t-r)}var $t=Kt(),_t=Kt(Math.sqrt);function Gt(t,r){return void 0===r&&(r=2),r=Math.pow(10,r),Math.round(t*r)/r}function Ht(t,r,n,e){return void 0===e&&(e=0),Gt(t+n*(r-t)/Math.max(e,n))}function Lt(t,r){return 1-3*r+3*t}function Jt(t,r){return 3*r-6*t}var Qt=function(t,r,n){return((Lt(r,n)*t+Jt(r,n))*t+3*r)*t},Xt=function(t,r,n){return 3*Lt(r,n)*t*t+2*Jt(r,n)*t+3*r},Yt=1e-7,Zt=10;var tr=8;t.DecayAnimator=lt,t.KeyframesAnimator=ct,t.SpringAnimator=r,t.angle=function(t,r){return void 0===r&&(r=R),Ut(Math.atan2(r.y-t.y,r.x-t.x))},t.animate=Et,t.anticipate=ft,t.applyOffset=function(r,n){var e=!0;return void 0===n&&(n=r,e=!1),function(t){return e?t-r+n:(r=t,e=!0,n)}},t.attract=$t,t.attractExpo=_t,t.backIn=at,t.backInOut=st,t.backOut=ut,t.bounceIn=pt,t.bounceInOut=function(t){return t<.5?.5*(1-tt(1-2*t)):.5*tt(2*t-1)+.5},t.bounceOut=tt,t.circIn=Z,t.circInOut=it,t.circOut=ot,t.clamp=B,t.createAnticipate=X,t.createAttractor=Kt,t.createBackIn=Q,t.createExpoIn=J,t.cubicBezier=function(i,r,a,n){if(i===r&&a===n)return Y;for(var u=new Float32Array(11),t=0;t<11;++t)u[t]=Qt(.1*t,i,a);function e(t){for(var r=0,n=1;10!==n&&u[n]<=t;++n)r+=.1;var e=r+.1*((t-u[--n])/(u[n+1]-u[n])),o=Xt(e,i,a);return.001<=o?function(t,r,n,e){for(var o=0;o<tr;++o){var i=Xt(r,n,e);if(0===i)return r;r-=(Qt(r,n,e)-t)/i}return r}(t,e,i,a):0===o?e:function(t,r,n,e,o){for(var i,a,u=0;0<(i=Qt(a=r+(n-r)/2,e,o)-t)?n=a:r=a,Math.abs(i)>Yt&&++u<Zt;);return a}(t,r,r+.1,i,a)}return function(t){return 0===t||1===t?t:Qt(e(t),r,n)}},t.degreesToRadians=Nt,t.distance=function(t,r){if(w(t)&&w(r))return Bt(t,r);if(Vt(t)&&Vt(r)){var n=Bt(t.x,r.x),e=Bt(t.y,r.y),o=Wt(t)&&Wt(r)?Bt(t.z,r.z):0;return Math.sqrt(Math.pow(n,2)+Math.pow(e,2)+Math.pow(o,2))}},t.easeIn=rt,t.easeInOut=et,t.easeOut=nt,t.inertia=function(t){var r,n,e,o,i,a=t.from,u=void 0===a?0:a,s=t.velocity,f=void 0===s?0:s,p=t.min,c=t.max,v=t.power,l=void 0===v?.8:v,d=t.timeConstant,h=void 0===d?750:d,m=t.bounceStiffness,y=void 0===m?500:m,g=t.bounceDamping,M=void 0===g?10:g,b=t.restDelta,x=void 0===b?1:b,O=t.modifyTarget,w=t.driver,I=t.onUpdate,S=t.onComplete;function A(t){return void 0!==p&&t<p||void 0!==c&&c<t}function C(t){return void 0!==p&&(void 0===c||Math.abs(p-t)<Math.abs(c-t))?p:c}function D(n){null!=r&&r.stop(),r=Et(j(j({},n),{driver:w,onUpdate:function(t){var r;null!=I&&I(t),null!==(r=n.onUpdate)&&void 0!==r&&r.call(n,t)},onComplete:S}))}function T(t){D(j({type:"spring",stiffness:y,damping:M,restDelta:x},t))}return A(u)?T({from:u,velocity:f,to:C(u)}):(n=l*f+u,void 0!==O&&(n=O(n)),e=C(n),o=e===p?-1:1,D({type:"decay",from:u,velocity:f,timeConstant:h,power:l,restDelta:x,modifyTarget:O,onUpdate:A(n)?function(t){f=Rt(t-i,At.delta),0<e-(i=t)*o||T({from:i,to:e,velocity:f})}:void 0})),{stop:function(){return null==r?void 0:r.stop()}}},t.interpolate=G,t.isPoint=Vt,t.isPoint3D=Wt,t.linear=Y,t.mirrorEasing=L,t.mix=s,t.mixColor=E,t.mixComplex=W,t.pipe=U,t.pointFromVector=function(t,r,n){return r=Nt(r),{x:n*Math.cos(r)+t.x,y:n*Math.sin(r)+t.y}},t.progress=b,t.radiansToDegrees=Ut,t.reverseEasing=H,t.smooth=function(o){void 0===o&&(o=50);var i=0,a=0;return function(t){var r=At.timestamp,n=r!==a?r-a:0,e=n?Ht(i,t,n,o):i;return a=r,i=e}},t.smoothFrame=Ht,t.snap=function(o){if("number"==typeof o)return function(t){return Math.round(t/o)*o};var i=0,a=o.length;return function(t){var r=Math.abs(o[0]-t);for(i=1;i<a;i++){var n=o[i],e=Math.abs(n-t);if(0===e)return n;if(r<e)return o[i-1];if(i===a-1)return n;r=e}}},t.steps=function(e,o){return void 0===o&&(o="end"),function(t){var r=(t="end"===o?Math.min(t,.999):Math.max(t,.001))*e,n="end"===o?Math.floor(r):Math.ceil(r);return B(0,1,n/e)}},t.toDecimal=Gt,t.velocityPerFrame=function(t,r){return t/(1e3/r)},t.velocityPerSecond=Rt,t.wrap=function(t,r,n){var e=r-t;return((n-t)%e+e)%e+t},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).popmotion={})}(this,function(r){"use strict";var k=function(){return(k=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a]);return r}).apply(this,arguments)};function C(r){var t=r.from,i=void 0===t?0:t,n=r.to,f=void 0===n?0:n,e=r.velocity,s=void 0===e?0:e,a=r.stiffness,c=void 0===a?100:a,o=r.damping,p=void 0===o?10:o,u=r.mass,v=void 0===u?1:u,d=r.restSpeed,l=void 0===d?2:d,h=r.restDelta,m={done:!1,value:i},y=b,g=b;function M(){var n,e=s?-s/1e3:0,a=f-i,o=p/(2*Math.sqrt(c*v)),u=Math.sqrt(c/v)/1e3;null!=h||(h=Math.abs(f-i)<=1?.01:.4),o<1?(y=function(r){var t=Math.exp(-o*u*r),n=u*Math.sqrt(1-o*o);return f-t*((e+o*u*a)/n*Math.sin(n*r)+a*Math.cos(n*r))},g=function(r){var t=Math.exp(-o*u*r),n=u*Math.sqrt(1-o*o);return o*u*t*(Math.sin(n*r)*(e+o*u*a)/n+a*Math.cos(n*r))-t*(Math.cos(n*r)*(e+o*u*a)-n*a*Math.sin(n*r))}):y=1==o?function(r){var t=Math.exp(-u*r);return f-t*(a+(e+u*a)*r)}:(n=u*Math.sqrt(o*o-1),function(r){var t=Math.exp(-o*u*r);return f-t*((e+o*u*a)*Math.sinh(n*r)+n*a*Math.cosh(n*r))/n})}return M(),{next:function(r){var t=y(r),n=1e3*g(r),e=Math.abs(n)<=l,a=Math.abs(f-t)<=h;return m.done=e&&a,m.value=m.done?f:t,m},flipTarget:function(){var r;s=-s,i=(r=[f,i])[0],f=r[1],M()}}}C.needsInterpolation=function(r,t){return"string"==typeof r||"string"==typeof t};function f(r,t,n){return-n*r+n*t+r}function t(t,n){return function(r){return Math.max(Math.min(r,n),t)}}function p(r){return r%1?Number(r.toFixed(5)):r}function n(r){return void 0!==r.red}function e(r){return void 0!==r.hue}var a,b=function(r){return 0},x=function(r,t,n){var e=t-r;return 0==e?1:(n-r)/e},s=/(-)?(\d[\d\.]*)/g,c=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,o=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,u={test:function(r){return"number"==typeof r},parse:parseFloat,transform:function(r){return r}},v=k(k({},u),{transform:t(0,1)}),d=(k(k({},u),{default:1}),a="%",{test:function(r){return"string"==typeof r&&r.endsWith(a)&&1===r.split(" ").length},parse:parseFloat,transform:function(r){return""+r+a}}),i=(k(k({},d),{parse:function(r){return d.parse(r)/100},transform:function(r){return d.transform(100*r)}}),t(0,255));function l(o){return function(r){if("string"!=typeof r)return r;for(var t,n={},e=(t=r).substring(t.indexOf("(")+1,t.lastIndexOf(")")).replace(/(,|\/)/g," ").split(/ \s*/),a=0;a<4;a++)n[o[a]]=void 0!==e[a]?parseFloat(e[a]):1;return n}}var h=k(k({},u),{transform:function(r){return Math.round(i(r))}});function m(r,t){return r.startsWith(t)&&o.test(r)}function y(r){return"number"==typeof r?0:r}function g(r,t,n){var e=r*r,a=t*t;return Math.sqrt(Math.max(0,n*(a-e)+e))}function M(t){return F.find(function(r){return r.test(t)})}function O(r){return"number"==typeof r}function w(t,n){return function(r){return n(t(r))}}var A={test:function(r){return"string"==typeof r?m(r,"rgb"):n(r)},parse:l(["red","green","blue","alpha"]),transform:function(r){var t,n,e,a,o,u=r.red,i=r.green,f=r.blue,s=r.alpha,c=void 0===s?1:s;return t={red:h.transform(u),green:h.transform(i),blue:h.transform(f),alpha:p(v.transform(c))},n=t.red,e=t.green,a=t.blue,o=t.alpha,"rgba("+n+", "+e+", "+a+", "+(void 0===o?1:o)+")"}},I={test:function(r){return"string"==typeof r?m(r,"hsl"):e(r)},parse:l(["hue","saturation","lightness","alpha"]),transform:function(r){var t,n,e,a,o,u=r.hue,i=r.saturation,f=r.lightness,s=r.alpha,c=void 0===s?1:s;return t={hue:Math.round(u),saturation:d.transform(p(i)),lightness:d.transform(p(f)),alpha:p(v.transform(c))},n=t.hue,e=t.saturation,a=t.lightness,o=t.alpha,"hsla("+n+", "+e+", "+a+", "+(void 0===o?1:o)+")"}},P=k(k({},A),{test:function(r){return"string"==typeof r&&m(r,"#")},parse:function(r){var t="",n="",e="";return 4<r.length?(t=r.substr(1,2),n=r.substr(3,2),e=r.substr(5,2)):(t=r.substr(1,1),n=r.substr(2,1),e=r.substr(3,1),t+=t,n+=n,e+=e),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(e,16),alpha:1}}}),T={test:function(r){return"string"==typeof r&&o.test(r)||n(r)||e(r)},parse:function(r){return A.test(r)?A.parse(r):I.test(r)?I.parse(r):P.test(r)?P.parse(r):r},transform:function(r){return n(r)?A.transform(r):e(r)?I.transform(r):r}},D="${c}",S="${n}",j={test:function(r){if("string"!=typeof r||!isNaN(r))return!1;var t=0,n=r.match(s),e=r.match(c);return n&&(t+=n.length),e&&(t+=e.length),0<t},parse:function(r){var t=r,n=[],e=t.match(c);e&&(t=t.replace(c,D),n.push.apply(n,e.map(T.parse)));var a=t.match(s);return a&&n.push.apply(n,a.map(u.parse)),n},createTransformer:function(r){var e=r,a=0,t=r.match(c),o=t?t.length:0;if(t)for(var n=0;n<o;n++)e=e.replace(t[n],D),a++;var u=e.match(s),i=u?u.length:0;if(u)for(n=0;n<i;n++)e=e.replace(u[n],S),a++;return function(r){for(var t=e,n=0;n<a;n++)t=t.replace(n<o?D:S,n<o?T.transform(r[n]):p(r[n]));return t}},getAnimatableNone:function(r){var t=j.parse(r);return j.createTransformer(r)(t.map(y))}},q=function(){},F=[P,A,I],E=function(r,t){var n=M(r),e=M(t);q(n.transform===e.transform);var a=n.parse(r),o=e.parse(t),u=k({},a),i=n===I?f:g;return function(r){for(var t in u)"alpha"!==t&&(u[t]=i(a[t],o[t],r));return u.alpha=f(a.alpha,o.alpha,r),n.transform(u)}},R={x:0,y:0,z:0},U=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return r.reduce(w)};function z(t,n){return O(t)?function(r){return f(t,n,r)}:(T.test(t)?E:$)(t,n)}var N=function(r,n){var e=function(){for(var r=0,t=0,n=arguments.length;t<n;t++)r+=arguments[t].length;for(var e=Array(r),a=0,t=0;t<n;t++)for(var o=arguments[t],u=0,i=o.length;u<i;u++,a++)e[a]=o[u];return e}(r),a=e.length,o=r.map(function(r,t){return z(r,n[t])});return function(r){for(var t=0;t<a;t++)e[t]=o[t](r);return e}},W=function(r,t){var n=k(k({},r),t),e={};for(var a in n)void 0!==r[a]&&void 0!==t[a]&&(e[a]=z(r[a],t[a]));return function(r){for(var t in e)n[t]=e[t](r);return n}};function B(r){for(var t=j.parse(r),n=t.length,e=0,a=0,o=0,u=0;u<n;u++)e||"number"==typeof t[u]?e++:void 0!==t[u].hue?o++:a++;return{parsed:t,numNumbers:e,numRGB:a,numHSL:o}}var $=function(r,t){var n=j.createTransformer(t),e=B(r),a=B(t);return U(N(e.parsed,a.parsed),n)},_=function(r,t,n){return Math.min(Math.max(n,r),t)},G=function(t,n){return function(r){return f(t,n,r)}};function H(r,t,n){for(var e,a=[],o=n||("number"==typeof(e=r[0])?G:"string"==typeof e?T.test(e)?E:$:Array.isArray(e)?N:"object"==typeof e?W:void 0),u=r.length-1,i=0;i<u;i++){var f,s=o(r[i],r[i+1]);t&&(f=Array.isArray(t)?t[i]:t,s=U(f,s)),a.push(s)}return a}function L(t,r,n){var e=void 0===n?{}:n,a=e.clamp,o=void 0===a||a,u=e.ease,i=e.mixer,f=t.length;q(f===r.length),q(!u||!Array.isArray(u)||u.length===f-1),t[0]>t[f-1]&&(t=[].concat(t),r=[].concat(r),t.reverse(),r.reverse());var s,c,p,v,d,l,h,m,y,g=H(r,u,i),M=2===f?(l=g,h=(d=t)[0],m=d[1],y=l[0],function(r){return y(x(h,m,r))}):(c=g,p=(s=t).length,v=p-1,function(r){var t=0,n=!1;if(r<=s[0]?n=!0:r>=s[v]&&(t=v-1,n=!0),!n){for(var e=1;e<p&&!(s[e]>r||e===v);e++);t=e-1}var a=x(s[t],s[t+1],r);return c[t](a)});return o?function(r){return M(_(t[0],t[f-1],r))}:M}function V(t){return function(r){return 1-t(1-r)}}function J(t){return function(r){return r<=.5?t(2*r)/2:(2-t(2*(1-r)))/2}}function K(t){return function(r){return Math.pow(r,t)}}function Q(t){return function(r){return r*r*((t+1)*r-t)}}function X(r){var t=Q(r);return function(r){return(r*=2)<1?.5*t(r):.5*(2-Math.pow(2,-10*(r-1)))}}function Y(r){return r}function Z(r){return 1-Math.sin(Math.acos(r))}function rr(r){if(1===r||0===r)return r;var t=r*r;return r<4/11?7.5625*t:r<8/11?9.075*t-9.9*r+3.4:r<.9?4356/361*t-35442/1805*r+16061/1805:10.8*r*r-20.52*r+10.72}var tr=K(2),nr=V(tr),er=J(tr),ar=V(Z),or=J(ar),ur=Q(1.525),ir=V(ur),fr=J(ur),sr=X(1.525),cr=V(rr);function pr(r){var t,n,e,a,o=r.from,u=void 0===o?0:o,i=r.to,f=void 0===i?1:i,s=r.ease,c=r.offset,p=r.duration,v=void 0===p?300:p,d={done:!1,value:u},l=Array.isArray(f)?f:[u,f],h=(t=null!=c?c:(a=(e=l).length,e.map(function(r,t){return 0!==t?t/(a-1):0})),n=v,t.map(function(r){return r*n}));function m(){return L(h,l,{ease:Array.isArray(s)?s:(t=s,(r=l).map(function(){return t||er}).splice(0,r.length-1))});var r,t}var y=m();return{next:function(r){return d.value=y(r),d.done=v<=r,d},flipTarget:function(){l.reverse(),y=m()}}}function vr(r){var t=r.velocity,n=void 0===t?0:t,e=r.from,a=void 0===e?0:e,o=r.power,u=void 0===o?.8:o,i=r.timeConstant,f=void 0===i?350:i,s=r.restDelta,c=void 0===s?.5:s,p=r.modifyTarget,v={done:!1,value:a},d=u*n,l=a+d,h=void 0===p?l:p(l);return h!==l&&(d=h-a),{next:function(r){var t=-d*Math.exp(-r/f);return v.done=!(c<t||t<-c),v.value=v.done?h:h+t,v},flipTarget:function(){}}}var dr={keyframes:pr,spring:C,decay:vr};function lr(r){return br=r}function hr(r){return Ar[r].process(Or)}var mr=0,yr="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(r){return window.requestAnimationFrame(r)}:function(r){var t=Date.now(),n=Math.max(0,16.7-(t-mr));mr=t+n,setTimeout(function(){return r(mr)},n)},gr=1/60*1e3,Mr=!0,br=!1,xr=!1,Or={delta:0,timestamp:0},wr=["read","update","preRender","render","postRender"],Ar=wr.reduce(function(r,t){var e,o,u,i,f,a,s,c,p;return r[t]=(e=lr,o=[],f=!(u=[]),a=i=0,s=new WeakSet,c=new WeakSet,p={cancel:function(r){var t=u.indexOf(r);s.add(r),-1!==t&&u.splice(t,1)},process:function(r){var t,n;if(f=!0,o=(t=[u,o])[0],(u=t[1]).length=0,i=o.length)for(a=0;a<i;a++)(n=o[a])(r),!0!==c.has(n)||s.has(n)||(p.schedule(n),e(!0));f=!1},schedule:function(r,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var e=n&&f,a=e?o:u;s.delete(r),t&&c.add(r),-1===a.indexOf(r)&&(a.push(r),e&&(i=o.length))}}),r},{}),Ir=wr.reduce(function(r,t){var e=Ar[t];return r[t]=function(r,t,n){return void 0===t&&(t=!1),void 0===n&&(n=!1),br||Dr(),e.schedule(r,t,n),r},r},{}),Pr=wr.reduce(function(r,t){return r[t]=Ar[t].cancel,r},{}),Tr=function(r){br=!1,Or.delta=Mr?gr:Math.max(Math.min(r-Or.timestamp,40),1),Mr||(gr=Or.delta),Or.timestamp=r,xr=!0,wr.forEach(hr),xr=!1,br&&(Mr=!1,yr(Tr))},Dr=function(){Mr=br=!0,xr||yr(Tr)};function Sr(r,t,n){return void 0===n&&(n=0),r-t-n}var jr=function(n){function r(r){var t=r.delta;return n(t)}return{start:function(){return Ir.update(r,!0,!0)},stop:function(){return Pr.update(r)}}};function qr(r){var t,o,u,i,n=r.from,e=r.autoplay,a=void 0===e||e,f=r.driver,s=void 0===f?jr:f,c=r.elapsed,p=void 0===c?0:c,v=r.repeat,d=void 0===v?0:v,l=r.repeatType,h=void 0===l?"loop":l,m=r.repeatDelay,y=void 0===m?0:m,g=r.onPlay,M=r.onStop,b=r.onComplete,x=r.onRepeat,O=r.onUpdate,w=function(r,t){var n={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&t.indexOf(e)<0&&(n[e]=r[e]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,e=Object.getOwnPropertySymbols(r);a<e.length;a++)t.indexOf(e[a])<0&&Object.prototype.propertyIsEnumerable.call(r,e[a])&&(n[e[a]]=r[e[a]]);return n}(r,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]),A=w.to,I=0,P=w.duration,T=!1,D=!0,S=function(r){if(Array.isArray(r.to))return pr;if(dr[r.type])return dr[r.type];var t=new Set(Object.keys(r));return!t.has("ease")&&!t.has("duration")&&(t.has("stiffness")||t.has("mass")||t.has("damping")||t.has("restSpeed")||t.has("restDelta"))?C:pr}(w);null!==(t=S.needsInterpolation)&&void 0!==t&&t.call(S,n,A)&&(i=L([0,100],[n,A],{clamp:!1}),n=0,A=100);var j=S(k(k({},w),{from:n,to:A}));function q(){var r,t,n,e;I++,"reverse"===h?(r=p,t=P,void 0===(n=y)&&(n=0),void 0===(e=D=I%2==0)&&(e=!0),p=e?Sr(t+-r,t,n):t-(r-t)+n):(p=Sr(p,P,y),"mirror"===h&&j.flipTarget()),T=!1,x&&x()}function F(r){var t,n,e,a;D||(r=-r),p+=r,T||(t=j.next(Math.max(0,p)),u=t.value,i&&(u=i(u)),T=D?t.done:p<=0),null!=O&&O(u),T&&(0===I&&(null!=P||(P=p)),I<d?(n=p,e=P,a=y,(D?e+a<=n:n<=-a)&&q()):(o.stop(),b&&b()))}return a&&(null!=g&&g(),(o=s(F)).start()),{stop:function(){null!=M&&M(),o.stop()}}}function Fr(r,t){return t?r*(1e3/t):0}function kr(r){return 180*r/Math.PI}function Cr(r){return r}function Er(o){return void 0===o&&(o=Cr),function(r,t,n){var e=t-n,a=-(0-r+1)*(0-o(Math.abs(e)));return e<=0?t+a:t-a}}function Rr(r){return r*Math.PI/180}function Ur(r){return r.hasOwnProperty("x")&&r.hasOwnProperty("y")}function zr(r){return Ur(r)&&r.hasOwnProperty("z")}function Nr(r,t){return Math.abs(r-t)}var Wr=Er(),Br=Er(Math.sqrt);function $r(r,t){return void 0===t&&(t=2),t=Math.pow(10,t),Math.round(r*t)/t}function _r(r,t,n,e){return void 0===e&&(e=0),$r(r+n*(t-r)/Math.max(e,n))}function Gr(r,t){return 1-3*t+3*r}function Hr(r,t){return 3*t-6*r}var Lr=function(r,t,n){return((Gr(t,n)*r+Hr(t,n))*r+3*t)*r},Vr=function(r,t,n){return 3*Gr(t,n)*r*r+2*Hr(t,n)*r+3*t},Jr=1e-7,Kr=10;var Qr=8;r.angle=function(r,t){return void 0===t&&(t=R),kr(Math.atan2(t.y-r.y,t.x-r.x))},r.animate=qr,r.anticipate=sr,r.applyOffset=function(t,n){var e=!0;return void 0===n&&(n=t,e=!1),function(r){return e?r-t+n:(t=r,e=!0,n)}},r.attract=Wr,r.attractExpo=Br,r.backIn=ur,r.backInOut=fr,r.backOut=ir,r.bounceIn=cr,r.bounceInOut=function(r){return r<.5?.5*(1-rr(1-2*r)):.5*rr(2*r-1)+.5},r.bounceOut=rr,r.circIn=Z,r.circInOut=or,r.circOut=ar,r.clamp=_,r.createAnticipate=X,r.createAttractor=Er,r.createBackIn=Q,r.createExpoIn=K,r.cubicBezier=function(o,t,u,n){if(o===t&&u===n)return Y;for(var i=new Float32Array(11),r=0;r<11;++r)i[r]=Lr(.1*r,o,u);function e(r){for(var t=0,n=1;10!==n&&i[n]<=r;++n)t+=.1;var e=t+.1*((r-i[--n])/(i[n+1]-i[n])),a=Vr(e,o,u);return.001<=a?function(r,t,n,e){for(var a=0;a<Qr;++a){var o=Vr(t,n,e);if(0===o)return t;t-=(Lr(t,n,e)-r)/o}return t}(r,e,o,u):0===a?e:function(r,t,n,e,a){for(var o,u,i=0;0<(o=Lr(u=t+(n-t)/2,e,a)-r)?n=u:t=u,Math.abs(o)>Jr&&++i<Kr;);return u}(r,t,t+.1,o,u)}return function(r){return 0===r||1===r?r:Lr(e(r),t,n)}},r.decay=vr,r.degreesToRadians=Rr,r.distance=function(r,t){if(O(r)&&O(t))return Nr(r,t);if(Ur(r)&&Ur(t)){var n=Nr(r.x,t.x),e=Nr(r.y,t.y),a=zr(r)&&zr(t)?Nr(r.z,t.z):0;return Math.sqrt(Math.pow(n,2)+Math.pow(e,2)+Math.pow(a,2))}},r.easeIn=tr,r.easeInOut=er,r.easeOut=nr,r.inertia=function(r){var t,n,e,a,o,u,i=r.from,f=void 0===i?0:i,s=r.velocity,c=void 0===s?0:s,p=r.min,v=r.max,d=r.power,l=void 0===d?.8:d,h=r.timeConstant,m=void 0===h?750:h,y=r.bounceStiffness,g=void 0===y?500:y,M=r.bounceDamping,b=void 0===M?10:M,x=r.restDelta,O=void 0===x?1:x,w=r.modifyTarget,A=r.driver,I=r.onUpdate,P=r.onComplete;function T(r){return void 0!==p&&r<p||void 0!==v&&v<r}function D(r){return void 0!==p&&(void 0===v||Math.abs(p-r)<Math.abs(v-r))?p:v}function S(n){null!=t&&t.stop(),t=qr(k(k({},n),{driver:A,onUpdate:function(r){var t;null!=I&&I(r),null!==(t=n.onUpdate)&&void 0!==t&&t.call(n,r)},onComplete:P}))}function j(r){S(k({type:"spring",stiffness:g,damping:b,restDelta:O},r))}return T(f)?j({from:f,velocity:c,to:D(f)}):(n=l*c+f,void 0!==w&&(n=w(n)),e=D(n),a=e===p?-1:1,S({type:"decay",from:f,velocity:c,timeConstant:m,power:l,restDelta:O,modifyTarget:w,onUpdate:T(n)?function(r){o=u,c=Fr((u=r)-o,Or.delta),(1==a&&e<r||-1==a&&r<e)&&j({from:r,to:e,velocity:c})}:void 0})),{stop:function(){return null==t?void 0:t.stop()}}},r.interpolate=L,r.isPoint=Ur,r.isPoint3D=zr,r.keyframes=pr,r.linear=Y,r.mirrorEasing=J,r.mix=f,r.mixColor=E,r.mixComplex=$,r.pipe=U,r.pointFromVector=function(r,t,n){return t=Rr(t),{x:n*Math.cos(t)+r.x,y:n*Math.sin(t)+r.y}},r.progress=x,r.radiansToDegrees=kr,r.reverseEasing=V,r.smooth=function(a){void 0===a&&(a=50);var o=0,u=0;return function(r){var t=Or.timestamp,n=t!==u?t-u:0,e=n?_r(o,r,n,a):o;return u=t,o=e}},r.smoothFrame=_r,r.snap=function(a){if("number"==typeof a)return function(r){return Math.round(r/a)*a};var o=0,u=a.length;return function(r){var t=Math.abs(a[0]-r);for(o=1;o<u;o++){var n=a[o],e=Math.abs(n-r);if(0===e)return n;if(t<e)return a[o-1];if(o===u-1)return n;t=e}}},r.spring=C,r.steps=function(e,a){return void 0===a&&(a="end"),function(r){var t=(r="end"===a?Math.min(r,.999):Math.max(r,.001))*e,n="end"===a?Math.floor(t):Math.ceil(t);return _(0,1,n/e)}},r.toDecimal=$r,r.velocityPerFrame=function(r,t){return r/(1e3/t)},r.velocityPerSecond=Fr,r.wrap=function(r,t,n){var e=t-r;return((n-r)%e+e)%e+r},Object.defineProperty(r,"__esModule",{value:!0})}); |
@@ -1,13 +0,5 @@ | ||
import { Animator, DecayOptions } from "./types"; | ||
export declare class DecayAnimator implements Animator<DecayOptions, number> { | ||
options: DecayOptions; | ||
amplitude: number; | ||
target: number; | ||
static needsInterpolation: () => boolean; | ||
isComplete: boolean; | ||
constructor(options: DecayOptions); | ||
flipTarget(): void; | ||
update(t: number): number; | ||
updateOptions({ velocity, from, power, timeConstant, restDelta, modifyTarget, }?: DecayOptions): void; | ||
static uniqueOptionKeys: Set<"to" | "restDelta" | "velocity" | "from" | "timeConstant" | "power" | "modifyTarget">; | ||
import { DecayOptions, Animation } from "./types"; | ||
export declare function decay({ velocity, from, power, timeConstant, restDelta, modifyTarget, }: DecayOptions): Animation<number>; | ||
export declare namespace decay { | ||
var needsInterpolation: () => boolean; | ||
} |
import { Action } from '../../action'; | ||
import { ActionFactory } from '../../action/vector'; | ||
import { DecayProps } from './types'; | ||
declare const decay: (props?: DecayProps) => Action<import("../..").ColdSubscription>; | ||
declare const decay: (props?: DecayProps) => Action; | ||
declare const vectorDecay: ActionFactory; | ||
export default vectorDecay; | ||
export { decay as decaySole }; |
import { Action } from '../../action'; | ||
declare const frame: () => Action<import("../..").ColdSubscription>; | ||
declare const frame: () => Action; | ||
export default frame; |
@@ -1,2 +0,4 @@ | ||
import { Animatable, AnimationOptions, PlaybackControls } from "./types"; | ||
export declare function animate<V extends Animatable>({ from, autoplay, driver, elapsed, repeat: repeatMax, repeatType, repeatDelay, onPlay, onStop, onComplete, onRepeat, onUpdate, ...options }: AnimationOptions<V>): PlaybackControls; | ||
import { AnimationOptions } from "./types"; | ||
export declare function animate<V = number>({ from, autoplay, driver, elapsed, repeat: repeatMax, repeatType, repeatDelay, onPlay, onStop, onComplete, onRepeat, onUpdate, ...options }: AnimationOptions<V>): { | ||
stop: () => void; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { KeyframeOptions, Animator } from "./types"; | ||
import { KeyframeOptions, Animatable } from "./types"; | ||
import { Easing } from "../easing/types"; | ||
@@ -6,14 +6,10 @@ export declare function defaultEasing(values: any[], easing?: Easing): Easing[]; | ||
export declare function convertOffsetToTimes(offset: number[], duration: number): number[]; | ||
export declare class KeyframesAnimator implements Animator<KeyframeOptions, any> { | ||
options: KeyframeOptions; | ||
export declare function keyframes<V extends Animatable>({ from, to, ease, offset, duration, }: KeyframeOptions): { | ||
current: V; | ||
isComplete: boolean; | ||
static needsInterpolation: () => boolean; | ||
interpolator: (t: number) => any; | ||
values: any[]; | ||
constructor(options: KeyframeOptions); | ||
private createInterpolator; | ||
update(t: number): any; | ||
updateOptions({ from, to, ease, offset, duration, }: KeyframeOptions): void; | ||
flipTarget(): void; | ||
static uniqueOptionKeys: Set<"to" | "from" | "ease" | "duration" | "offset">; | ||
update: (t: number) => void; | ||
flipTarget: () => void; | ||
}; | ||
export declare namespace keyframes { | ||
var needsInterpolation: () => boolean; | ||
} |
import { Action } from '../../action'; | ||
import { KeyframesProps } from './types'; | ||
declare const keyframes: ({ easings, ease, times, values, ...tweenProps }: KeyframesProps) => Action<import("../..").ColdSubscription>; | ||
declare const keyframes: ({ easings, ease, times, values, ...tweenProps }: KeyframesProps) => Action; | ||
export default keyframes; |
@@ -1,14 +0,5 @@ | ||
import { SpringOptions, Animator, Animatable } from "./types"; | ||
export declare class SpringAnimator implements Animator<SpringOptions, number> { | ||
options: SpringOptions; | ||
isComplete: boolean; | ||
resolveSpring: (t: number) => number; | ||
resolveVelocity: (t: number) => number; | ||
static needsInterpolation: (from: Animatable, to: Animatable) => boolean; | ||
constructor(options: SpringOptions); | ||
createSpring(): void; | ||
update(t: number): number; | ||
updateOptions({ from, to, velocity, stiffness, damping, mass, restSpeed, restDelta, }: SpringOptions): void; | ||
flipTarget(): void; | ||
static uniqueOptionKeys: Set<"restSpeed" | "to" | "restDelta" | "velocity" | "from" | "damping" | "stiffness" | "mass">; | ||
import { SpringOptions, Animation } from "./types"; | ||
export declare function spring({ from, to, velocity, stiffness, damping, mass, restSpeed, restDelta, }: SpringOptions): Animation<number>; | ||
export declare namespace spring { | ||
var needsInterpolation: (from: any, to: any) => boolean; | ||
} |
import { Action } from '../../action'; | ||
import { ActionFactory } from '../../action/vector'; | ||
import { SpringProps } from './types'; | ||
declare const spring: (props?: SpringProps) => Action<import("../..").ColdSubscription>; | ||
declare const spring: (props?: SpringProps) => Action; | ||
declare const vectorSpring: ActionFactory; | ||
export default vectorSpring; | ||
export { spring as springSole }; |
import { Action } from '../../action'; | ||
import { TweenInterface, TweenProps } from './types'; | ||
declare const tween: (props?: TweenProps) => Action<TweenInterface<number>>; | ||
declare const tween: (props?: TweenProps) => Action<TweenInterface>; | ||
export default tween; |
import { Easing } from "../easing/types"; | ||
export declare type Animatable = string | number; | ||
export interface Animator<O, V> { | ||
options: O; | ||
update(t: number): V; | ||
updateOptions(options: O): void; | ||
export interface Animation<V> { | ||
next: (t: number) => { | ||
value: V; | ||
done: boolean; | ||
}; | ||
flipTarget: () => void; | ||
isComplete: boolean; | ||
} | ||
export interface AnimationState<V> { | ||
value: V; | ||
done: boolean; | ||
} | ||
export interface PlaybackControls { | ||
play: () => void; | ||
pause: () => void; | ||
resume: () => void; | ||
reverse: () => void; | ||
seek: () => void; | ||
stop: () => void; | ||
@@ -24,3 +22,3 @@ } | ||
export declare type Driver = (update: Update) => DriverControls; | ||
export interface PlaybackOptions<V extends Animatable> { | ||
export interface PlaybackOptions<V> { | ||
autoplay?: boolean; | ||
@@ -40,3 +38,3 @@ driver?: Driver; | ||
} | ||
export interface KeyframeOptions<V extends Animatable = number> { | ||
export interface KeyframeOptions<V = number> { | ||
to: V | V[]; | ||
@@ -57,5 +55,5 @@ from?: V; | ||
} | ||
export interface SpringOptions<T extends Animatable = number> { | ||
from?: T; | ||
to?: T; | ||
export interface SpringOptions { | ||
from?: number; | ||
to?: number; | ||
velocity?: number; | ||
@@ -79,3 +77,3 @@ stiffness?: number; | ||
} | ||
export declare type AnimationOptions<V extends Animatable> = PlaybackOptions<V> & (DecayOptions | KeyframeOptions<V> | SpringOptions<V>); | ||
export declare type AnimationOptions<V> = PlaybackOptions<V> & (DecayOptions | KeyframeOptions<V> | SpringOptions); | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import { SpringAnimator } from "../spring"; | ||
import { KeyframesAnimator } from "../keyframes"; | ||
import { DecayAnimator } from "../decay"; | ||
import { spring } from "../generators/spring"; | ||
import { keyframes } from "../generators/keyframes"; | ||
import { decay } from "../generators/decay"; | ||
interface Options { | ||
@@ -8,3 +8,3 @@ to?: any; | ||
} | ||
export declare function detectAnimationFromOptions<T extends Options>(config: T): typeof SpringAnimator | typeof KeyframesAnimator | typeof DecayAnimator; | ||
export declare function detectAnimationFromOptions<T extends Options>(config: T): typeof spring | typeof keyframes | typeof decay; | ||
export {}; |
import { Action } from '../action'; | ||
import { ColdSubscription } from '../action/types'; | ||
declare const chain: (...actions: Action<ColdSubscription>[]) => Action<ColdSubscription>; | ||
declare const chain: (...actions: Action[]) => Action; | ||
export default chain; |
import { Action } from '../action'; | ||
declare const crossfade: (a: Action<import("..").ColdSubscription>, b: Action<import("..").ColdSubscription>) => Action<import("..").ColdSubscription>; | ||
declare const crossfade: (a: Action, b: Action) => Action<import("..").ColdSubscription>; | ||
export default crossfade; |
import { Action } from '../action'; | ||
declare const delay: (timeToDelay: number) => Action<import("..").ColdSubscription>; | ||
declare const delay: (timeToDelay: number) => Action; | ||
export default delay; |
import { Action } from '../action'; | ||
declare const merge: (...actions: Action<import("..").ColdSubscription>[]) => Action<import("..").ColdSubscription>; | ||
declare const merge: (...actions: Action[]) => Action<import("..").ColdSubscription>; | ||
export default merge; |
@@ -12,3 +12,3 @@ import { Action } from '../action'; | ||
}; | ||
declare const multi: <A, T, V, I>({ getCount, getFirst, getOutput, mapApi, setProp, startActions }: MultiProps<A, T, V, I>) => (actions: A) => Action<ColdSubscription>; | ||
declare const multi: <A, T, V, I>({ getCount, getFirst, getOutput, mapApi, setProp, startActions }: MultiProps<A, T, V, I>) => (actions: A) => Action; | ||
export default multi; |
import { Action } from '../action'; | ||
import { ColdSubscription } from '../action/types'; | ||
declare const _default: (...actions: Action<ColdSubscription>[]) => Action<ColdSubscription>; | ||
declare const _default: (...actions: Action[]) => Action<ColdSubscription>; | ||
export default _default; |
import { Action } from '../action'; | ||
declare const schedule: (scheduler: Action<import("..").ColdSubscription>, schedulee: Action<import("..").ColdSubscription>) => Action<import("..").ColdSubscription>; | ||
declare const schedule: (scheduler: Action, schedulee: Action) => Action<import("..").ColdSubscription>; | ||
export default schedule; |
import { Action } from '../action'; | ||
declare type IntervalCalc = (i: number) => number; | ||
declare type Interval = number | IntervalCalc; | ||
declare const stagger: (actions: Action<import("..").ColdSubscription>[], interval: Interval) => Action<import("..").ColdSubscription>; | ||
declare const stagger: (actions: Action[], interval: Interval) => Action; | ||
export default stagger; |
export {}; |
export { animate } from "./animations"; | ||
export { inertia } from "./animations/inertia"; | ||
export { DecayAnimator } from "./animations/decay"; | ||
export { SpringAnimator } from "./animations/spring"; | ||
export { KeyframesAnimator } from "./animations/keyframes"; | ||
export { decay } from "./animations/generators/decay"; | ||
export { spring } from "./animations/generators/spring"; | ||
export { keyframes } from "./animations/generators/keyframes"; | ||
export { angle } from "./utils/angle"; | ||
@@ -7,0 +7,0 @@ export { applyOffset } from "./utils/apply-offset"; |
272
lib/index.js
@@ -13,10 +13,8 @@ 'use strict'; | ||
var SpringAnimator = (function () { | ||
function SpringAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
this.createSpring(); | ||
} | ||
SpringAnimator.prototype.createSpring = function () { | ||
var _a = this.options, velocity = _a.velocity, from = _a.from, to = _a.to, damping = _a.damping, stiffness = _a.stiffness, mass = _a.mass; | ||
function spring(_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 2 : _h, restDelta = _a.restDelta; | ||
var state = { done: false, value: from }; | ||
var resolveSpring = zero; | ||
var resolveVelocity = zero; | ||
function createSpring() { | ||
var initialVelocity = velocity ? -(velocity / 1000) : 0.0; | ||
@@ -26,4 +24,5 @@ var initialDelta = to - from; | ||
var angularFreq = Math.sqrt(stiffness / mass) / 1000; | ||
restDelta !== null && restDelta !== void 0 ? restDelta : (restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4); | ||
if (dampingRatio < 1) { | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -39,3 +38,3 @@ var expoDecay = angularFreq * Math.sqrt(1.0 - dampingRatio * dampingRatio); | ||
}; | ||
this.resolveVelocity = function (t) { | ||
resolveVelocity = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -59,3 +58,3 @@ var expoDecay = angularFreq * Math.sqrt(1.0 - dampingRatio * dampingRatio); | ||
else if (dampingRatio === 1) { | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-angularFreq * t); | ||
@@ -67,7 +66,6 @@ return (to - | ||
}; | ||
this.resolveVelocity = function () { return 0; }; | ||
} | ||
else { | ||
var dampedAngularFreq_1 = angularFreq * Math.sqrt(dampingRatio * dampingRatio - 1); | ||
this.resolveSpring = function (t) { | ||
resolveSpring = function (t) { | ||
var envelope = Math.exp(-dampingRatio * angularFreq * t); | ||
@@ -84,51 +82,28 @@ return (to - | ||
}; | ||
this.resolveVelocity = function () { return 0; }; | ||
} | ||
} | ||
createSpring(); | ||
return { | ||
next: function (t) { | ||
var current = resolveSpring(t); | ||
var velocity = resolveVelocity(t) * 1000; | ||
var isBelowVelocityThreshold = Math.abs(velocity) <= restSpeed; | ||
var isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta; | ||
state.done = | ||
isBelowVelocityThreshold && isBelowDisplacementThreshold; | ||
state.value = state.done ? to : current; | ||
return state; | ||
}, | ||
flipTarget: function () { | ||
var _a; | ||
velocity = -velocity; | ||
_a = [to, from], from = _a[0], to = _a[1]; | ||
createSpring(); | ||
}, | ||
}; | ||
SpringAnimator.prototype.update = function (t) { | ||
var _a = this.options, restSpeed = _a.restSpeed, restDelta = _a.restDelta, to = _a.to; | ||
var latest = this.resolveSpring(t); | ||
var velocity = this.resolveVelocity(t) * 1000; | ||
var isBelowVelocityThreshold = Math.abs(velocity) <= restSpeed; | ||
var isBelowDisplacementThreshold = Math.abs(to - latest) <= restDelta; | ||
this.isComplete = | ||
isBelowVelocityThreshold && isBelowDisplacementThreshold; | ||
return this.isComplete ? to : latest; | ||
}; | ||
SpringAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 0.0 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0.0 : _d, _e = _a.stiffness, stiffness = _e === void 0 ? 100 : _e, _f = _a.damping, damping = _f === void 0 ? 10 : _f, _g = _a.mass, mass = _g === void 0 ? 1.0 : _g, _h = _a.restSpeed, restSpeed = _h === void 0 ? 2 : _h, restDelta = _a.restDelta; | ||
if (restDelta === undefined) { | ||
restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4; | ||
} | ||
this.options = { | ||
from: from, | ||
to: to, | ||
velocity: velocity, | ||
stiffness: stiffness, | ||
damping: damping, | ||
mass: mass, | ||
restSpeed: restSpeed, | ||
restDelta: restDelta, | ||
}; | ||
}; | ||
SpringAnimator.prototype.flipTarget = function () { | ||
var _a = this.options, from = _a.from, to = _a.to, velocity = _a.velocity; | ||
this.options.velocity = -velocity; | ||
this.options.from = to; | ||
this.options.to = from; | ||
this.createSpring(); | ||
}; | ||
SpringAnimator.needsInterpolation = function (from, to) { | ||
return typeof from === "string" || typeof to === "string"; | ||
}; | ||
SpringAnimator.uniqueOptionKeys = new Set([ | ||
"velocity", | ||
"stiffness", | ||
"damping", | ||
"mass", | ||
"restSpeed", | ||
"restDelta", | ||
]); | ||
return SpringAnimator; | ||
}()); | ||
} | ||
spring.needsInterpolation = function (a, b) { | ||
return typeof a === "string" || typeof b === "string"; | ||
}; | ||
var zero = function (_t) { return 0; }; | ||
@@ -416,90 +391,49 @@ var progress = function (from, to, value) { | ||
} | ||
var KeyframesAnimator = (function () { | ||
function KeyframesAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
var _a = this.options, from = _a.from, to = _a.to; | ||
this.values = Array.isArray(to) ? to : [from, to]; | ||
this.createInterpolator(); | ||
function keyframes(_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.to, to = _c === void 0 ? 1 : _c, ease = _a.ease, offset = _a.offset, _d = _a.duration, duration = _d === void 0 ? 300 : _d; | ||
var state = { done: false, value: from }; | ||
var values = Array.isArray(to) ? to : [from, to]; | ||
var times = convertOffsetToTimes(offset !== null && offset !== void 0 ? offset : defaultOffset(values), duration); | ||
function createInterpolator() { | ||
return interpolate(times, values, { | ||
ease: Array.isArray(ease) ? ease : defaultEasing(values, ease), | ||
}); | ||
} | ||
KeyframesAnimator.prototype.createInterpolator = function () { | ||
var _a = this.options, duration = _a.duration, ease = _a.ease, offset = _a.offset; | ||
ease = Array.isArray(ease) ? ease : defaultEasing(this.values, ease); | ||
offset = offset || defaultOffset(this.values); | ||
var times = convertOffsetToTimes(offset, duration); | ||
this.interpolator = interpolate(times, this.values, { ease: ease }); | ||
var interpolator = createInterpolator(); | ||
return { | ||
next: function (t) { | ||
state.value = interpolator(t); | ||
state.done = t >= duration; | ||
return state; | ||
}, | ||
flipTarget: function () { | ||
values.reverse(); | ||
interpolator = createInterpolator(); | ||
}, | ||
}; | ||
KeyframesAnimator.prototype.update = function (t) { | ||
var duration = this.options.duration; | ||
this.isComplete = t >= duration; | ||
return this.interpolator(t); | ||
}; | ||
KeyframesAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.to, to = _c === void 0 ? 1 : _c, ease = _a.ease, offset = _a.offset, _d = _a.duration, duration = _d === void 0 ? 300 : _d; | ||
this.options = { from: from, to: to, ease: ease, offset: offset, duration: duration }; | ||
}; | ||
KeyframesAnimator.prototype.flipTarget = function () { | ||
this.values.reverse(); | ||
this.createInterpolator(); | ||
}; | ||
KeyframesAnimator.needsInterpolation = function () { return false; }; | ||
KeyframesAnimator.uniqueOptionKeys = new Set([ | ||
"duration", | ||
"ease", | ||
]); | ||
return KeyframesAnimator; | ||
}()); | ||
} | ||
var DecayAnimator = (function () { | ||
function DecayAnimator(options) { | ||
this.isComplete = false; | ||
this.updateOptions(options); | ||
var _a = this.options, power = _a.power, velocity = _a.velocity, modifyTarget = _a.modifyTarget, from = _a.from; | ||
var amplitude = power * velocity; | ||
var idealTarget = from + amplitude; | ||
var target = typeof modifyTarget === "undefined" | ||
? idealTarget | ||
: modifyTarget(idealTarget); | ||
if (target !== idealTarget) | ||
amplitude = target - from; | ||
this.target = target; | ||
this.amplitude = amplitude; | ||
} | ||
DecayAnimator.prototype.flipTarget = function () { }; | ||
DecayAnimator.prototype.update = function (t) { | ||
var _a = this.options, timeConstant = _a.timeConstant, restDelta = _a.restDelta; | ||
var delta = -this.amplitude * Math.exp(-t / timeConstant); | ||
this.isComplete = !(delta > restDelta || delta < -restDelta); | ||
return this.isComplete ? this.target : this.target + delta; | ||
function decay(_a) { | ||
var _b = _a.velocity, velocity = _b === void 0 ? 0 : _b, _c = _a.from, from = _c === void 0 ? 0 : _c, _d = _a.power, power = _d === void 0 ? 0.8 : _d, _e = _a.timeConstant, timeConstant = _e === void 0 ? 350 : _e, _f = _a.restDelta, restDelta = _f === void 0 ? 0.5 : _f, modifyTarget = _a.modifyTarget; | ||
var state = { done: false, value: from }; | ||
var amplitude = power * velocity; | ||
var ideal = from + amplitude; | ||
var target = modifyTarget === undefined ? ideal : modifyTarget(ideal); | ||
if (target !== ideal) | ||
amplitude = target - from; | ||
return { | ||
next: function (t) { | ||
var delta = -amplitude * Math.exp(-t / timeConstant); | ||
state.done = !(delta > restDelta || delta < -restDelta); | ||
state.value = state.done ? target : target + delta; | ||
return state; | ||
}, | ||
flipTarget: function () { }, | ||
}; | ||
DecayAnimator.prototype.updateOptions = function (_a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.velocity, velocity = _c === void 0 ? 0 : _c, _d = _b.from, from = _d === void 0 ? 0 : _d, _e = _b.power, power = _e === void 0 ? 0.8 : _e, _f = _b.timeConstant, timeConstant = _f === void 0 ? 350 : _f, _g = _b.restDelta, restDelta = _g === void 0 ? 0.5 : _g, modifyTarget = _b.modifyTarget; | ||
this.options = { | ||
velocity: velocity, | ||
from: from, | ||
power: power, | ||
timeConstant: timeConstant, | ||
restDelta: restDelta, | ||
modifyTarget: modifyTarget, | ||
}; | ||
}; | ||
DecayAnimator.needsInterpolation = function () { return false; }; | ||
DecayAnimator.uniqueOptionKeys = new Set([ | ||
"power", | ||
"timeConstant", | ||
"modifyTarget", | ||
]); | ||
return DecayAnimator; | ||
}()); | ||
} | ||
var animators = [KeyframesAnimator, DecayAnimator, SpringAnimator]; | ||
var types = { | ||
keyframes: KeyframesAnimator, | ||
spring: SpringAnimator, | ||
decay: DecayAnimator, | ||
}; | ||
var numAnimators = animators.length; | ||
var types = { keyframes: keyframes, spring: spring, decay: decay }; | ||
function detectAnimationFromOptions(config) { | ||
if (Array.isArray(config.to)) { | ||
return KeyframesAnimator; | ||
return keyframes; | ||
} | ||
@@ -509,10 +443,14 @@ else if (types[config.type]) { | ||
} | ||
for (var key in config) { | ||
for (var i = 0; i < numAnimators; i++) { | ||
var animator = animators[i]; | ||
if (animator.uniqueOptionKeys.has(key)) | ||
return animator; | ||
} | ||
var keys = new Set(Object.keys(config)); | ||
if (keys.has("ease") || keys.has("duration")) { | ||
return keyframes; | ||
} | ||
return KeyframesAnimator; | ||
else if (keys.has("stiffness") || | ||
keys.has("mass") || | ||
keys.has("damping") || | ||
keys.has("restSpeed") || | ||
keys.has("restDelta")) { | ||
return spring; | ||
} | ||
return keyframes; | ||
} | ||
@@ -546,3 +484,4 @@ | ||
function animate(_a) { | ||
var from = _a.from, _b = _a.autoplay, autoplay = _b === void 0 ? true : _b, _c = _a.driver, driver = _c === void 0 ? framesync : _c, _d = _a.elapsed, elapsed = _d === void 0 ? 0 : _d, _e = _a.repeat, repeatMax = _e === void 0 ? 0 : _e, _f = _a.repeatType, repeatType = _f === void 0 ? "loop" : _f, _g = _a.repeatDelay, repeatDelay = _g === void 0 ? 0 : _g, onPlay = _a.onPlay, onStop = _a.onStop, onComplete = _a.onComplete, onRepeat = _a.onRepeat, onUpdate = _a.onUpdate, options = tslib.__rest(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]); | ||
var _b, _c; | ||
var from = _a.from, _d = _a.autoplay, autoplay = _d === void 0 ? true : _d, _e = _a.driver, driver = _e === void 0 ? framesync : _e, _f = _a.elapsed, elapsed = _f === void 0 ? 0 : _f, _g = _a.repeat, repeatMax = _g === void 0 ? 0 : _g, _h = _a.repeatType, repeatType = _h === void 0 ? "loop" : _h, _j = _a.repeatDelay, repeatDelay = _j === void 0 ? 0 : _j, onPlay = _a.onPlay, onStop = _a.onStop, onComplete = _a.onComplete, onRepeat = _a.onRepeat, onUpdate = _a.onUpdate, options = tslib.__rest(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]); | ||
var to = options.to; | ||
@@ -556,4 +495,4 @@ var driverControls; | ||
var interpolateFromNumber; | ||
var Animator = detectAnimationFromOptions(options); | ||
if (Animator.needsInterpolation(from, to)) { | ||
var animator = detectAnimationFromOptions(options); | ||
if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) { | ||
interpolateFromNumber = interpolate([0, 100], [from, to], { | ||
@@ -565,3 +504,3 @@ clamp: false, | ||
} | ||
var animation = new Animator(tslib.__assign(tslib.__assign({}, options), { from: from, to: to })); | ||
var animation = animator(tslib.__assign(tslib.__assign({}, options), { from: from, to: to })); | ||
function repeat() { | ||
@@ -579,3 +518,2 @@ repeatCount++; | ||
isComplete = false; | ||
animation.isComplete = false; | ||
onRepeat && onRepeat(); | ||
@@ -592,12 +530,12 @@ } | ||
if (!isComplete) { | ||
latest = animation.update(Math.max(0, elapsed)); | ||
var state = animation.next(Math.max(0, elapsed)); | ||
latest = state.value; | ||
if (interpolateFromNumber) | ||
latest = interpolateFromNumber(latest); | ||
isComplete = isForwardPlayback ? animation.isComplete : elapsed <= 0; | ||
isComplete = isForwardPlayback ? state.done : elapsed <= 0; | ||
} | ||
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest); | ||
if (isComplete) { | ||
if (repeatCount === 0 && computedDuration === undefined) { | ||
computedDuration = elapsed; | ||
} | ||
if (repeatCount === 0) | ||
computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed); | ||
if (repeatCount < repeatMax) { | ||
@@ -618,7 +556,2 @@ hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat(); | ||
return { | ||
play: play, | ||
pause: function () { }, | ||
resume: function () { }, | ||
reverse: function () { }, | ||
seek: function () { }, | ||
stop: function () { | ||
@@ -672,6 +605,7 @@ onStop === null || onStop === void 0 ? void 0 : onStop(); | ||
prev_1 = current_1; | ||
current_1 = v; | ||
velocity = velocityPerSecond(v - prev_1, sync.getFrameData().delta); | ||
current_1 = v; | ||
if (!(boundary_1 - v * heading_1 > 0)) { | ||
startSpring({ from: current_1, to: boundary_1, velocity: velocity }); | ||
if ((heading_1 === 1 && v > boundary_1) || | ||
(heading_1 === -1 && v < boundary_1)) { | ||
startSpring({ from: v, to: boundary_1, velocity: velocity }); | ||
} | ||
@@ -914,5 +848,2 @@ }; | ||
exports.DecayAnimator = DecayAnimator; | ||
exports.KeyframesAnimator = KeyframesAnimator; | ||
exports.SpringAnimator = SpringAnimator; | ||
exports.angle = angle; | ||
@@ -939,2 +870,3 @@ exports.animate = animate; | ||
exports.cubicBezier = cubicBezier; | ||
exports.decay = decay; | ||
exports.degreesToRadians = degreesToRadians; | ||
@@ -949,2 +881,3 @@ exports.distance = distance; | ||
exports.isPoint3D = isPoint3D; | ||
exports.keyframes = keyframes; | ||
exports.linear = linear; | ||
@@ -963,2 +896,3 @@ exports.mirrorEasing = mirrorEasing; | ||
exports.snap = snap; | ||
exports.spring = spring; | ||
exports.steps = steps; | ||
@@ -965,0 +899,0 @@ exports.toDecimal = toDecimal; |
import { Action } from '../../action'; | ||
import { PointerProps } from '../pointer/types'; | ||
declare const multitouch: ({ preventDefault, scale, rotate }?: PointerProps) => Action<import("../..").ColdSubscription>; | ||
declare const multitouch: ({ preventDefault, scale, rotate }?: PointerProps) => Action; | ||
export default multitouch; | ||
export declare const getIsTouchDevice: () => boolean; |
import { Action } from '../../action'; | ||
import { PointerProps } from './types'; | ||
declare const _default: ({ x, y, ...props }?: PointerProps) => Action<import("../..").ColdSubscription>; | ||
declare const _default: ({ x, y, ...props }?: PointerProps) => Action; | ||
export default _default; |
import { Action } from '../../action'; | ||
import { PointerProps } from './types'; | ||
declare const mouse: ({ preventDefault }?: PointerProps) => Action<import("../..").ColdSubscription>; | ||
declare const mouse: ({ preventDefault }?: PointerProps) => Action; | ||
export default mouse; |
@@ -33,3 +33,3 @@ import { FrameData } from 'framesync'; | ||
} | ||
declare const _default: (value: Value, initialSubscription?: Function) => ValueReaction; | ||
declare const _default: (value: Value, initialSubscription?: Update) => ValueReaction; | ||
export default _default; |
{ | ||
"name": "popmotion", | ||
"version": "9.0.0-rc.12", | ||
"version": "9.0.0-rc.13", | ||
"description": "The animator's toolbox", | ||
@@ -56,26 +56,7 @@ "author": "Matt Perry", | ||
"@rollup/plugin-commonjs": "^11.0.1", | ||
"tslint-circular-dependencies": "^0.1.0" | ||
"@types/jest": "^26.0.12", | ||
"ts-jest": "^26.3.0", | ||
"tslint-circular-dependencies": "^0.1.0", | ||
"typescript": "^4.0.2" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js" | ||
], | ||
"moduleNameMapper": { | ||
"style-value-types": "<rootDir>/../../style-value-types/src", | ||
"framesync": "<rootDir>/../../framesync/src" | ||
}, | ||
"transform": { | ||
"\\.(ts)$": "../../../node_modules/ts-jest/preprocessor.js" | ||
}, | ||
"testRegex": "/__tests__/.*\\.test.(ts|js)$", | ||
"rootDir": "src", | ||
"collectCoverageFrom": [ | ||
"**/*.{js,jsx,ts,tsx}", | ||
"!**/node_modules/**", | ||
"!**/__tests__/**", | ||
"!**/worklet/**" | ||
], | ||
"coverageDirectory": "<rootDir>/../coverage" | ||
}, | ||
"prettier": { | ||
@@ -82,0 +63,0 @@ "printWidth": 80, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
152
0
363151
5
6806